Is there any way to open independent positions when trading on the same ticker? As in if I send two trades of the same size at the same time it would open two independent positions instead of working out the average into one. I am used to do this kind of execution with other brokers and was wondering if we have the option with IB.
No you can't. What you refer to is a so-called "hedging account", whereas an IB gives you a so-called "netting account". As the name implies you will hold the net ticker size in your account. Your individual trades do not show up as individual position sizes, as you would have with a hedging account.
That is exactly what I am seeing, I am going to try to look at the trades execution response. The Portfolio->Trades endpoint gives a row per trade that contains the size as well as the price at the time of execution. Those trades are independent and then they add up to the position record. That way I can work out a some kind of "virtual" position that will help with the visualization. Thanks!
Be aware that executed orders (i.e. trades) will only remain visible for a limited number of days (I believe the maximum is 7). Trades older than this cut-off point are not visible. So your visualization is limited to this time window. Older trades are only retrievable through the Reports functionality in online account management.
Good one, I will save them in my personal database then. I will have to handle partial closures for my positions and match them with those execution records. Quite a few lines of code that I wasn't planning to write .
It's a nice 6 month project to get right. To make it spicy I also monitor auto-liquidations and manual executions to work together with the (clientId specific) orders. Partial fills are fun for the whole family.