live broker with ccxt - next() not called
-
I'm using the bt-ccxt-store library to connect backtrader to ccxt. Tested it with the binance crypto exchange and it worked alright.
Now I wanted to switch to the FTX exchange. Using ccxt in isolation works alright so I know that my keys work. I get ohlcv data. But when I plug it into backtrader the way I did with binance, for some reason the next() method is not being called.My questions are:
- how do I go about debugging this?
- what are the typical reasons why next() wouldn't be called?
- could something wrong with my ohlcv data be a reason? and if yes, why are there no error messages?
thanks for reading!
-
After reading some more about the strategy lifecycle I want to add that the longest period in my indicators is 420 bars and I'm getting 450 minutes worth of ohlcv data with "Minutes" timeframe:
history_length_in_minutes = 450 hist_start_date = dt.datetime.utcnow() - dt.timedelta(minutes=history_length_in_minutes) data = store.getdata( dataname='SOL/USD', name="SOL/USD", timeframe=bt.TimeFrame.Minutes, fromdate=hist_start_date, compression=1, ohlcv_limit=history_length_in_minutes, drop_newest=True )
I see that
prenext
is being called butnextstart
andnext
never are. It would seem that my strategy hasn't seen enough data yet but like I wrote above, 420 bars should have been enough. -
Guess I should've played around with that 450 limit some more before posting... It turns out that i need to retrieve 571 or more ticks before my strategy can run. I have no clue why but right now i'm just happy it's working.