alpacahq/alpaca-backtrader-api

Corrupt data with LIVE trading for the first few seconds from starting up

Closed this issue · 3 comments

I am experiencing some corrupt data upon starting up the script and printing data from next().
The data I have seen is the value in:
self.datetime.date()
self.getposition(d).size

DATE  TIME     SYMBOL       SIZE             time.time()
06-10 00:00:00 TVIX: CHECK  121.96 0.00 0.00 1591899222.070981
06-10 00:00:00 TVIX: CHECK  121.96 0.00 0.00 1591899222.0719814
06-11 00:00:00 TVIX: CHECK  171.85 0.00 0.00 1591899222.2689812
06-11 14:13:36 TVIX: CHECK  170.90 0.00 0.00 1591899222.5389812
06-11 14:13:37 TVIX: CHECK  170.90 0.00 0.00 1591899222.809981
06-11 14:13:38 TVIX: CHECK  171.12 0.00 0.00 1591899223.090981

For the live data feed, the first two rows have the DATA/TIME incorrect as well as the position size. The third row shows the time incorrect.
The data starts becoming valid on the 4th row.

you should check that your data is live
something like this:

    def notify_data(self, data, status, *args, **kwargs):
        super().notify_data(data, status, *args, **kwargs)
        print('*' * 5, 'DATA NOTIF:', data._getstatusname(status), *args)

OK, I will try it. Thank you.

closing due to lack of activity