qtpylib
qtpylib copied to clipboard
Only 1minute timeframe works (5T not working)
Issue
When I pass in '5T' resolution into the strategy, it is firing on_bar every minute instead of every 5 minutes
My strategy code
ib_tuple = futures.make_tuple('CL')
strategy = QFSimpleCross(instruments=[ ib_tuple, ],
resolution='5T',
bar_window='50,
preload='1D',
ibport=7497,
blotter='MainBlotter')
(here is the full strategy code: link)
Trying to debug
When I add a few breakpoints to explore, prepare_history
is resampling correctly and I can see the resampled 5-min dataframe
https://github.com/ranaroussi/qtpylib/blob/0dbbc465fafd9cb9b0f4d10e1e07fae4e15032dd/qtpylib/blotter.py#L1022
But soon after that line, the dataframe goes back to a 1-min resolution and when _update_window
gets a hold of it
https://github.com/ranaroussi/qtpylib/blob/0dbbc465fafd9cb9b0f4d10e1e07fae4e15032dd/qtpylib/algo.py#L814
Haven't been able to chase down why I'm losing the 5-min dataframe for 'newbar' and on_bar:
https://github.com/ranaroussi/qtpylib/blob/0dbbc465fafd9cb9b0f4d10e1e07fae4e15032dd/qtpylib/algo.py#L850
Looking at the reported issues, it appears that qtpylib has numerous problems with properly sending out bars at the correct frequency. Has any progress been made to solve this issue? If we can't reliably get an on_bar callback every 5 minutes or every hour or every whatever frequency we want, then this library isn't really usable.