For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Delayed data only; IKBR and Backtrader integration
-
Hello,
I have a funded account with data subsciptions which is linked to a paper trading account. Every security I try to recieve live data from returns delayed data. Does anyone have any idea what could be a solution. I have included some basic code as well as the output here mainly which I have created from following some popular tutorials. Thank you for the help!import backtrader as bt print('Starting Backtrader') cerebro = bt.Cerebro() ibstore = bt.stores.IBStore(host='127.0.0.1', port=7497, clientId=35) cerebro.broker = ibstore.getbroker() data = ibstore.getdata(dataname = 'GBP.USD', sectype = 'CASH', exchange = 'IDEALPRO', currency = 'USD', timeframe = bt.TimeFrame.Seconds) cerebro.adddata(data) class example(bt.Strategy): def __init__(self): pass def notify_data(self, data, status): print('Data Status =>', data._getstatusname(status)) if status == data.LIVE: self.data_ready = True def log_data(self): ohlcv = [] ohlcv.append(str(self.data.datetime.datetime())) ohlcv.append(str(self.data.open[0])) ohlcv.append(str(self.data.high[0])) ohlcv.append(str(self.data.low[0])) ohlcv.append(str(self.data.close[0])) ohlcv.append(str(self.data.volume[0])) print(",".join(ohlcv)) def next(self): self.log_data() if not self.data_ready: return
Starting Backtrader
Server Version: 76
TWS Time at connection:20221201 19:23:15 EST
Data Status => DELAYED