I am using zipline for daily data back testing and everything works fine except when an order is placed and filled before missing days: it cannot be removed until future existing days or never.
I am using:
order_target_percent(symbol, 0.0)
when the symbol no longer exists on missing days where the symbol is no longer in data.history.
But checking back on subsequent days, the context.portfolio.positions entry is still there taking up space. The order is not executed: the position and order are still there for all subsequent days (unless the stock again has values for future dates).
Please note: all other positions and orders are removed and executed fine that have no missing days.
Is there any way to back out a position that no longer exists: or sell it at the last known value?
Or must we constrain zipline symbols to those that are available for ALL dates in history (missing out on numerous opportunities)?