qtpylib
qtpylib copied to clipboard
Strategy Stuck on Backfill - Ticker match
My strategy gets stuck in backfill (just sits there after all the .... printing)
I dropped a few debug print statements and believe this check fails and the subsequent self.backfilled = True
doesn't get reached:
https://github.com/ranaroussi/qtpylib/blob/048657dab146a932642f20a349cb23add3e4ec21/qtpylib/blotter.py#L360
My debug statements show:
- self.backfilled_symbols is ['ESH2019_FUT']
- ibConn tickerIds is dict_items([(0, 'SYMBOL'), (1, 'ES'), (2, 'ESH2019_FUT'), (3, 'ES12019_FUT')])
- Thus, tickers is {'ES12019_FUT', 'ES', 'ESH2019_FUT'}
So the if tickers == set(self.backfilled_symbols):
will fail
Commenting out the if tickers == set(self.backfilled_symbols):
and directly setting self.backfilled = True
will work
Any ideas if I'm breaking anything by removing this? (I guess if I have multiple algos)
This issue went away with a TWS restart, but this is an edge condition that may come up again
Perhaps a tickers in (set(self.backfilled_symbols)
kind of check instead of ==
can address if it comes up again in the future
what was your fix for this Lionel?
If I force it to backfill, it works but it touchy. Didn't end up fixing it, just restarted everything and reinstalled