Hi Jack Simonson and thanks for the message. I am familiar with the contracts and CME contract specifications.
I was wrong, I just checked the Algo lab and the profit is calculated properly, meaning the trade
Date Time Symbol Type Price Quantity Operation Status Tag
2018-12-27 00:00:00 SI27Z18 Market $15.01 USD 1 Buy Filled
2018-12-28 17:00:00 SI27Z18 Market $15.17 USD -1 Sell Filled
was calculated properly like SI 15.17 - SI 15.01 = 0.16 * $5000 = $800 profit. I initially thought the result just took $0.16 as a profit, not taking the contract value into consideration.
But is the margin also taken into account? I mean IB says $3,354 intraday initial margin, so this margin should be deducted from my backtest account balance. But I did not find any such info in the Quantconnect data.
Can I simulate the margin? I.e. with Reallity modelling and Buying power models?
I admit I am not that into Python, but I see
class IBuyingPowerModel:
self.GetReservedBuyingPowerForPosition(security):
return decimal
self.GetBuyingPower(portfolio, security, direction):
return decimal
but there are not Setter methods...? Does it work? Can you please post some example?