Hi,

I am trying to understand symbol data subscriptions and universes. My intent would be to run some scheduled universe event at anytime past midnight, select the stocks to be traded (more than 50 stocks daily) by sending a MarketOrder or a LimitOrder on that same day. For instance, if the universe selection is run on 2020-01-01 at 0:15AM, I would expect the LimitOrder to be active and submitted by 2020-01-01 at 9:30AM (if that was a real trading day). Then, if the order has not filled during the day, I would like to remove the data subscription to that ticker, and remove it from the universe, to free up some space in the subscription manager.

In live trading however, I end up with > 100 active subscriptions very fast because the Symbols stay in the ActiveSecurities object (IB caps you at 100 active data lines).

As a demo, when I run the attached backtest, I expect SPY to be removed from the universe at each even timestep, and added back at each odd timestep. This works until 2013-10-09, at which point it is never removed from the universe and appears in both ActiveSecurities and the OnData slice. Why is that? 

Author