qtpylib icon indicating copy to clipboard operation
qtpylib copied to clipboard

Strategy Stuck on Backfill - Ticker match

Open lionelyoung opened this issue 6 years ago • 3 comments

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)

lionelyoung avatar Jan 22 '19 13:01 lionelyoung

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

lionelyoung avatar Jan 24 '19 17:01 lionelyoung

what was your fix for this Lionel?

JMA6971 avatar Jul 30 '19 15:07 JMA6971

If I force it to backfill, it works but it touchy. Didn't end up fixing it, just restarted everything and reinstalled

lionelyoung avatar Jul 30 '19 16:07 lionelyoung