¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 ¿ªÔÆÌåÓý

reqPositionsMulti does not work as intended


 

I am having trouble with the C# API requesting positions via reqPositionsMulti with a modelCode. When I query with an empty string I get all open positions, however, when I populate modelCode with a non-empty string that was attached to the modelCode parameter in the Order class when submitting orders then? "positionMulti" does not return anything.?

Is there a special string that returns ALL positions, regardless of which modelCode was used when submitting orders? At this moment neither works.?


 

To add, my goal is to tag orders with different modelCodes in order to keep positions apart. For example. If I buy 100 shares of Apple with modelCode "Strategy1" and short 100 shares of Apple with modelCode "Strategy2" my net position in TWS would be 0 but when I request positions I want to see two positions, one for each modelcode with their own averagePrice and positions. But I do not seem to be able to get there....


 

Dojo321 wrote: ".. net position in TWS would be 0 but when I request positions I want to see two positions, .. "
This is not possible with an IB account. Your IB account is a netting account, meaning that only the net result of all trading activities in a ticker symbol is available as position size. IB does not provide a so-called "hedging account", which is what you would need for your purpose.


 

Fair enough if that was the case but then what is modelCode good for? I don't seem to be able to make use of it. Orders can be supplied with a model code and that modelCode can be entered into reqPositionsMulti. I don't see the benefit of that if it does not work...?


 

Portfolio models and related to that model codes are for advisors to automate trading of instrument combinations. If you have not done so, take a look at and

´³¨¹°ù²µ±ð²Ô


 

Thanks, will take a look


 

So, this pertains to specific model portfolios that were set up in advisor accounts in seems??

How do you then keep positions apart for specific strategies? Does this all have to be handled on the user side? I have written an OMS, would I need to keep my positions apart myself inside the OMS? I was hoping to be able to distinguish positions that pertain to specific strategies similar to orders/fills. I am not looking to create hedge accounts but for example, I often trade baskets that are made up of individual assets and at the same time trade individual assets that make up some of the baskets yet I want to see positions and position pnl in a segregated fashion for the baskets and the individual assets. I can easily manage it on my end but it is harder to synchronize and reconcile with broker positions if I am unable to obtain the average prices of positions that represent a slice of the entire net position in my IB account...?


 

The has a field called that you can use as you wish. The string you set is also carried over to objects

´³¨¹°ù²µ±ð²Ô


On Tue, Aug 2, 2022 at 09:59 AM, Dojo321 wrote:
So, this pertains to specific model portfolios that were set up in advisor accounts in seems??

How do you then keep positions apart for specific strategies? Does this all have to be handled on the user side? I have written an OMS, would I need to keep my positions apart myself inside the OMS? I was hoping to be able to distinguish positions that pertain to specific strategies similar to orders/fills. I am not looking to create hedge accounts but for example, I often trade baskets that are made up of individual assets and at the same time trade individual assets that make up some of the baskets yet I want to see positions and position pnl in a segregated fashion for the baskets and the individual assets. I can easily manage it on my end but it is harder to synchronize and reconcile with broker positions if I am unable to obtain the average prices of positions that represent a slice of the entire net position in my IB account...?


 

´³¨¹°ù²µ±ð²Ô,?
Thanks I am aware of it and handle order submissions and fills/executions correctly. I will just allocate the fills to pertaining positions on my end.

Thanks for explaining, it makes it very clear.?