I had a backtest doing both long and short. Let's say at some time I begin to short a total of $10000 value stock and the trade filled price is 100.
Assume the condition did not change so I'll continue short this stock.
My requirement is Every day I'll check one time if the price drop to some level or rise to some level. To say when the price drops to 90, I'd like to short more (10000-9000=$1000) stocks. The problem is how could I possibly record the initial portfolio value ($10000) so that I can compare it with the current portfolio value to make decisions? The thing I need is the filled price for this stock ($100) and then I can compare everything fast (100 vs data.current("sid[...]","price") ? Help plz!
Edit:
According to The IB Account Information page IB there is a Average Price Average cost of stock and securities options opening positions, including commissions. Any way I can get this field?