I have an IB account and I'd like to stream NIFTY data live to AmiBroker. At the moment, live streaming of NIFTY data does not work (discussion here: Chart not updating in real time of index data from IB) and I have not found any workaround for this.
I've worked with IB API for a while now and was wondering if it is possible to send data from python directly to AmiBroker (to solve the NIFTY not streaming live issue)? Is it possible to do something with OLE or something similar?
I use insync-ib api and the code to get 5-sec bars or tick data is very simple:
def onBarUpdate(bars, hasNewBar): if hasNewBar: last_bar = bars[-1] str_to_write = "NSE:NIFTY,%s,%.2f,%.2f,%.2f,%.2f" % (str(bars[-1].time).split('+').replace(' ',','),last_bar.open,last_bar.high,last_bar.low,last_bar.close) logger.info(str_to_write) #Example output: NSE:NIFTY,2019-01-03,08:16:05,10689.85,10689.85,10688.65,10688.70 #how can I send this(str_to_write data) to AmiBroker? nifty = Index('NIFTY50', 'NSE') bars = ib.reqRealTimeBars(nifty, 5, 'TRADES', False) bars.updateEvent += onBarUpdate ib.sleep(60)
Can anyone suggest a way to send these quotes to AmiBroker?