Closed bug-or-feature closed 11 months ago
I didn't see these yesterday, but looking at todays logs there are a whole bunch of errors that look similar:
2023-08-23 04:30:29 DEBUG stack_handler {'component': 'ibContractPositionData'} Reqid 79679: 354 Requested market data is not subscribed. for None
2023-08-23 04:30:29 DEBUG stack_handler {'component': 'ibFuturesInstrumentData'} Reqid 79679: 354 Requested market data is not subscribed. for None
2023-08-23 04:30:29 DEBUG stack_handler {'component': 'ibFuturesContractData'} Reqid 79679: 354 Requested market data is not subscribed. for None
2023-08-23 04:30:29 DEBUG stack_handler {'component': 'ibFuturesContractPriceData'} Reqid 79679: 354 Requested market data is not subscribed. for None
2023-08-23 04:30:29 ERROR ib_insync.wrapper Error 300, reqId 79679: Can't find EId with tickerId:79679
2023-08-23 04:30:29 DEBUG stack_handler {'component': 'ibContractPositionData'} Reqid 79679: 300 Can't find EId with tickerId:79679 for None
2023-08-23 04:30:29 DEBUG stack_handler {'component': 'ibFuturesInstrumentData'} Reqid 79679: 300 Can't find EId with tickerId:79679 for None
2023-08-23 04:30:29 DEBUG stack_handler {'component': 'ibFuturesContractData'} Reqid 79679: 300 Can't find EId with tickerId:79679 for None
2023-08-23 04:30:29 DEBUG stack_handler {'component': 'ibFuturesContractPriceData'} Reqid 79679: 300 Can't find EId with tickerId:79679 for None
2023-08-23 04:30:29 INFO arctic.serialization.numpy_records Index has no name, defaulting to 'index'
Perhaps an update to the IB API which I'm not seeing? What happens if you run native ibinsync?
Following checks the contract expiry for robusta
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ib_insync import *
>>> util.startLoop()
>>>
>>> import logging
>>> # util.logToConsole(logging.DEBUG)
>>>
>>> ib = IB()
>>> ib.connect('127.0.0.1',4001,clientId=99999)
<IB connected to 127.0.0.1:4001 clientId=99999>
>>> f = Future('D',exchange='ICEEUSOFT')
>>> c = ib.reqContractDetails(f)
>>> c[0].contract.lastTradeDateOrContractMonth
'20230925'
Thanks for that snippet, very useful
ContractDetails(contract=Contract(secType='FUT', conId=553444806, symbol='D', lastTradeDateOrContractMonth='20231124 12:30:00 GB', multiplier='10', exchange='ICEEUSOFT', currency='USD', localSymbol='RCX3', tradingClass='RC'), marketName='RC', minTick=1.0, orderTypes='ACTIVETIM,AD,ADJUST,ALERT,ALGO,ALLOC,AVGCOST,BASKET,BENCHPX,COND,CONDORDER,DAY,DEACT,DEACTDIS,DEACTEOD,GAT,GTC,GTD,GTT,HID,ICE,IOC,LIT,LMT,MIT,MKT,MTL,NGCOMB,NONALGO,OCA,OPENCLOSE,PEGBENCH,SCALE,SCALERST,SNAPMID,SNAPMKT,SNAPREL,STP,STPLMT,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,WHATIF', validExchanges='ICEEUSOFT', priceMagnifier=1, underConId=27655507, longName='Robusta Coffee', contractMonth='202311', industry='', category='', subcategory='', timeZoneId='GB-Eire', tradingHours='20230823:0900-20230823:1730;20230824:0900-20230824:1730;20230825:0900-20230825:1730', liquidHours='20230823:0900-20230823:1730;20230824:0900-20230824:1730;20230825:0900-20230825:1730', evRule='', evMultiplier=0, mdSizeMultiplier=1, aggGroup=2147483647, underSymbol='D', underSecType='IND', marketRuleIds='33', secIdList=[], realExpirationDate='20231124', lastTradeTime='Eire', stockType='', minSize=1.0, sizeIncrement=1.0, suggestedSizeIncrement=1.0, cusip='', ratings='', descAppend='', bondType='', couponType='', callable=False, putable=False, coupon=0, convertible=False, maturity='', issueDate='', nextOptionDate='', nextOptionType='', nextOptionPartial=False, notes='')
lastTradeDateOrContractMonth='20231124 12:30:00 GB'
So where is that date format coming from, could be a user preference or something?
For realExpirationDate
the date format is consistent in both
What gateway version are you running? 10.23 here
Same 10.23
hmmm. I can identify EURIBOR-ICE with 202509, but not 20250900
>>> euribor = Future('I',exchange='ICEEU',lastTradeDateOrContractMonth='20250900')
>>> c = ib.reqContractDetails(euribor)
Error 200, reqId 3: Invalid value in field # 541, contract: Future(symbol='I', lastTradeDateOrContractMonth='20250900', exchange='ICEEU')
>>> euribor = Future('I',exchange='ICEEU',lastTradeDateOrContractMonth='202509')
>>> c = ib.reqContractDetails(euribor)
>>> c[0]
ContractDetails(contract=Contract(secType='FUT', conId=383665193, symbol='I', lastTradeDateOrContractMonth='20250915 10:00:00 GB', multiplier='2500', exchange='ICEEU', currency='EUR', localSymbol='IU5', tradingClass='I'), marketName='I', minTick=0.005, orderTypes='ACTIVETIM,AD,ADJUST,ALERT,ALGO,ALLOC,AVGCOST,BASKET,BENCHPX,COND,CONDORDER,DAY,DEACT,DEACTDIS,DEACTEOD,GAT,GTC,GTD,GTT,HID,ICE,IOC,LIT,LMT,MIT,MKT,MTL,NGCOMB,NONALGO,OCA,OPENCLOSE,PEGBENCH,REL,RELPCTOFS,SCALE,SCALERST,SNAPMID,SNAPMKT,SNAPREL,STP,STPLMT,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,WHATIF', validExchanges='ICEEU', priceMagnifier=1, underConId=12148668, longName='3 Month EURIBOR Interest Rate', contractMonth='202509', industry='', category='', subcategory='', timeZoneId='GB-Eire', tradingHours='20230823:0100-20230823:2100;20230824:0100-20230824:2100;20230825:0100-20230825:2100;20230826:CLOSED;20230827:CLOSED;20230828:0100-20230828:2100', liquidHours='20230823:0100-20230823:2100;20230824:0100-20230824:2100;20230825:0100-20230825:2100;20230826:CLOSED;20230827:CLOSED;20230828:0100-20230828:2100', evRule='', evMultiplier=0, mdSizeMultiplier=1, aggGroup=2147483647, underSymbol='I', underSecType='IND', marketRuleIds='57', secIdList=[], realExpirationDate='20250915', lastTradeTime='Eire', stockType='', minSize=1.0, sizeIncrement=1.0, suggestedSizeIncrement=1.0, cusip='', ratings='', descAppend='', bondType='', couponType='', callable=False, putable=False, coupon=0, convertible=False, maturity='', issueDate='', nextOptionDate='', nextOptionType='', nextOptionPartial=False, notes='')
Ignore that, it works with 20250915
Same gateway version implies it's a TWS setting or user preference problem.
Yep. There's a Gateway config setting Send instrument specific attributes for dual-mode API client in with possible values operator timezone, instrument timezone, UTC. instrument timezone sends the weird format, the other two use the expected. Thank you for your help
I'll wait and check trades go through before closing
All good, closing. Thanks again
A couple of nice to have ideas that would make dealing with this sort of thing easier in future:
I'm seeing some unexpectedly formatted expiry dates for some instruments from IB. Unfortunately I can't use a debugger with the instance, so I added this code at around line 125 of
sysbrokers/IB/ib_futures_contract_data.py
:That results in log messages like:
I first saw this last week, but I was busy with other stuff and couldn't deal with it properly. I just hacked
expiryDate.from_str()
to only consider the first 8 characters of expiry strings. But today I noticed a contract order on the stack with waaaay too many children. It turned out that there was a contract order to buy some EURIBOR-ICE/20250900; The broker orders were getting cancelled, with log messages like:And then of course, a new broker order would be created, cancelled, and another, etc etc. I noticed after about 300
Anyone know what's going on with the expiry dates? Or know how to resolve the orders getting cancelled by IB?