Back to Community
How does Quantopian Live Trading handle multiple algos that trade the same symbol

Let's say in my IB account I have 100 shares of SPY that I don't want to mess with. If I deploy an algo into that account that buys some SPY in the morning, and then has an " order_target_percent(context.SPY, 0) " scheduled at the end of day for SPY set to 0%, will the algo sell ALL my SPY or just the amount it purchased in the morning?

Thanks for the help!

1 response

Since order_target_percent() is based on your portfolio value (sum of positions value and ending cash balance), you would need to programmatically handle the quantity traded and instead use order_value() to reduce your position size.

You'd also need to allow enough time prior to close of trading (based on typical trading volume) to allow the orders to fill.