Receiving data too late for minute bars using CCXT
-
Hi,
I'm new to this platform, so, please excuse me if i havent posted my problem correctly.I'm pulling historical and live minute data from a broker feed using CCXT and the historical data is working perfectly. However, the on-going live bars are pulled in at random times and not the actual minute!
I've included an example below:
So, using the following code:
cerebro = bt.Cerebro() hist_start_date = dt.datetime.utcnow() - dt.timedelta(minutes=10) data_min = bt.feeds.CCXT(exchange='ftx', symbol="BTC/USD", name="btc_usd_min", fromdate=hist_start_date, timeframe=bt.TimeFrame.Minutes) cerebro.adddata(data_min) cerebro.addstrategy(TestStrategy) cerebro.run()
The following output is produced:
historical data:
2021-08-03 13:44:00 btc_usd_min 38587.0 38600.0 38585.0 38600.0 23909.0193 Minute 10 2021-08-03 14:44:25.408706live data:
2021-08-03 13:45:00 btc_usd_min 38596.0 38625.0 38583.0 38606.0 380417.3058 Minute 11 2021-08-03 14:45:27.0887862021-08-03 13:46:00 btc_usd_min 38626.0 38635.0 38610.0 38631.0 595484.7427 Minute 12 2021-08-03 14:46:28.494754
Why are the live minute bars for 14:45 being pulled in at 14:45:27?? If i start the program again at a different time, the minute bars get pulled in at different times again. It's very strange.
Could somebody help with this? Thanks.
-
@rntrading Just something I noticed which may help you dig your problem : According to your logs, historical data is also produced at hh:mm:25, also not at an exact minute end. So this may not be a live data problem.
-
@rntrading Interesting question. It appears to me on a quick look that the data is correct/live when it arrives, but not matching up with the
top of the hour
time stamp.