Suppose I have a position of 100 MSFT in IB prior to using Quantopian, and then I turn on live trading of Quantopian with IB, will context.portfolio.positions[sec].amount, for MSFT will this equal 100?
For the following code, will positions automatically be synced up with IB? Or will IB and Quantopian have different notions of "position?"
def liquidate_orders(context):
for sec in context.secs:
amount = context.portfolio.positions[sec].amount
if amount:
order_target(sec,-amount)
message = 'Liquidate order for {amount} shares in {stock}'
message = message.format(amount, stock=sec)
log.info(message)
And, furthermore, can you have multiple portfolios in Quantopian? In IB? Can they be mapped 1:1 and how?
If a stock split occurs and IB adjusts the position, will that automatically flow through to Quantopian?
Thanks,
Abe