For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Fetched data delayed
-
My code:
Storing data
data = store.getdata(dataname='BTC/USD', name="BTCUSD", timeframe=bt.TimeFrame.Minutes, fromdate=hist_start_date, config={'rateLimit': 13200, 'enableRateLimit': True}, ohlcv_limit=999, drop_newest=True, buffered=True)
cerebro config:
dn = data._name dt = datetime.utcnow() msg = 'Data Status: {}, Order Status: {}'.format(data._getstatusname(status), status) print(dt, dn, msg) if data._getstatusname(status) == 'LIVE': self.live_data = True else: self.live_data = False
def next(self): if self.live_data: cash, value = self.broker.get_wallet_balance('BTC') print('{} - {} | Cash {} | O: {} H: {} L: {} C: {} V:{} SMA:{} mcross:{} '.format(self.data.datetime.datetime(), self.data._name, cash, self.data.open[0], self.data.high[0], self.data.low[0], self.data.close[0], self.data.volume[0], self.sma[0], self.mcross[0]))
Output
2021-03-04 13:05:54.565059 BTCUSD Data Status: DELAYED, Order Status: 3 2021-03-04 13:05:56.843969 BTCUSD Data Status: LIVE, Order Status: 4 2021-03-04 13:05:00 - BTCUSD | Cash 0.00693513 | O: 49105.0 H: 49105.0 L: 49082.5 C: 49082.5 V:94200.0 SMA:49342.683333333334 mcross:0.0 2021-03-04 13:06:00 - BTCUSD | Cash 0.00693513 | O: 49082.5 H: 49081.0 L: 49081.0 C: 49081.0 V:5.0 SMA:49333.6 mcross:0.0 2021-03-04 13:07:00 - BTCUSD | Cash 0.00693513 | O: 49081.0 H: 49081.0 L: 49081.0 C: 49081.0 V:530.0 SMA:49324.51666666667 mcross:0.0 2021-03-04 13:08:00 - BTCUSD | Cash 0.00693513 | O: 49081.0 H: 49080.5 L: 49000.0 C: 49000.0 V:55558.0 SMA:49305.4 mcross:0.0
Values received during next execution are delayed by 1 minute, could somebody give me an explanation of why? Is it the exchange rate limit?
Thanks