How does updateEvent emit boolean when there is a new bar on BarDataList? #52
-
Hi guys, I am browsing through source codes for eventkit and ib_async, but still couldn't figure out the relevant codes for returning True value when there is a new bar on a BarDataList (updated by reqHistoricalData with keepUpToDate = True). In the below example provided by blog AlgoTrading101, there is a callback function on_new_bar to which boolean value & BarDataList are emitted. I wonder how this boolean value is generated after new bar is received. I have looked through wrapper.HistoricalDataUpdate, ib.reqHistoriclaData, ib.reqHistoricalDataAsync. Still no clues. May I have your kind help? from ib_insync import * def place_order(direction, qty, df, tp, sl): for ord in bracket_order: def on_new_bar(bars: BarDataList, has_new_bar: bool): if contract not in [i.contract for i in ib.positions()]: elif df.close.iloc[-1] < sma - std_dev: contract = ContFuture('HE', 'GLOBEX') data = ib.reqHistoricalData( data.updateEvent += on_new_bar ib.run() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's in wrapper.realtimeBar |
Beta Was this translation helpful? Give feedback.
It's in wrapper.realtimeBar