Closed Roh-codeur closed 10 months ago
Edit: removed previous comment.
The issue I am facing is that req historical data call with keep up to date doesn’t do a callback. I can confirm that if I call this method repeatedly, I see updated data. I am wondering what I have got wrong in the callback. I do indeed use the ib.run() in the end. My other callbacks work fine
def onBarUpdate(bars, hasNewBar):
if hasNewBar:
print(bars)
else:
print("No new bars")
bars = ib.reqHistoricalData(
contract,
endDateTime='',
durationStr='60 S',
barSizeSetting='5 secs',
whatToShow='TRADES',
useRTH=False,
keepUpToDate=True,
formatDate=1)
ib.barUpdateEvent += onBarUpdate
ib.run()
durationStr你设置一天,我怀疑是数据量太大,盈透不给了,或者处理不了五秒获取一天的数据 我记得获取数据有限制来着
获取数据的限制:https://interactivebrokers.github.io/tws-api/historical_limitations.html durationStr=1D,barSizeSetting的范围要在1min~1D
@cgntiger : you, my friend, are a Star! thanks for this. I will try out with the 1min~1day.
thanks a lot!
The proper data subscriptions are needed, or else delayed data can be used with ib.reqMarketDataType(3)
.
Hi
thanks for all your work on this.
I am using the below code to subscribe to historical Trades and keepThemUpToDate. I see historical trades, I don't however, see any updates to that. I have tried both barUpdateEvent and updateEvent. Do you know whereI could have gone wrong please? or is this not supported? also, I am using Paper account. I did, however, tried placing orders which got filled. so, presumably, that should have triggered a response.
thanks Roh