interactive brokers java api closing time

thosecars82

Junior member
Messages
16
Likes
0
Hello there
I have this problem.
I might have several symbols corresponding to different financial products.
Is there any method in the java api to ask what the close time is for any particular financial product I have in mind?
Otherwise, what would be the most straitforward and approach to get this close time for every financial product homogenously?

Thanks
 
Hello there
I have this problem.
I might have several symbols corresponding to different financial products.
Is there any method in the java api to ask what the close time is for any particular financial product I have in mind?
Otherwise, what would be the most straitforward and approach to get this close time for every financial product homogenously?

Thanks

reqContractDetails()
 
reqContractDetails()

Thanks for the suggestion.
I understand and I think that makes sense according to the field description of
String m_tradingHours in
http://www.interactivebrokers.com/php/apiUsersGuide/apiguide.htm

However, when I print the contract details for a particular contract
I do not get that field. This is what I got:
Code:
conid = 30351181
symbol = GOOG
secType = STK
expiry = null
strike = 0.0
right = null
multiplier = null
exchange = SMART
primaryExch = NASDAQ
currency = USD
localSymbol = GOOG
marketName = NMS
tradingClass = NMS
minTick = 0.01
price magnifier = 1
orderTypes = ACTIVETIM,ADJUST,ALERT,ALGO,ALLOC,AON,AVGCOST,BASKET,COND,CONDORDER,DARKPOLL,DAY,DEACT,DEACTDIS,DEACTEOD,DIS,GAT,GTC,GTD,GTT,HID,ICE,IOC,LIT,LMT,LOC,MIT,MKT,MOC,MTL,NONALGO,OCA,OPG,OPGREROUT,POSTONLY,PREOPGRTH,REL,RTH,SCALE,SCALERST,STP,STPLMT,SWEEP,TIMEPRIO,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,WHATIF,
validExchanges = SMART,ARCA,BATS,BEX,BTRADE,CBSX,CHX,CSFBALGO,DRCTEDGE,EDGEA,IBSX,ISE,ISLAND,JEFFALGO,LAVA,MIBSX,NSX,TRACKECN,VWAP
underConId = 0
longName = GOOGLE INC-CL A
And as you can see there is no tradingHours field in this listing. Moreover, I just checked the ContractDetails.java source that is downloaded when installing TWS and I did not see any field called m_tradingHours.
Any idea about why this incoherence?
Thansk in advance
 
after the reqcontractdetails, you'll get the info you search in the callback contractDetails(int reqId, ContractDetails contractDetails)

in the object contractDetails you'll find a few fields:
m_tradingHours
m_timeZoneId
m_liquidHours

the format is:
/*
String timeZoneId
The ID of the time zone for the trading hours of the product. For example, EST
String tradingHours
The trading hours of the product. For example, 20090507:0700-1830,1830-2330;20090508:CLOSED.
String liquidHours
The liquid trading hours of the product. For example, 20090507:0930-1600;20090508:CLOSED. *
*/

Since those are strings, you need to break them down and analyze them yourself, it took me a while to get it properly :)
As usual with IB, lack of proper documentation:
warning, it appear that the date mentioned in the field refer to the closing hours.
( i.e. 20090507:1700-1600 1600 is for the date mentioned... so you need there too to make your own logic if you want to create multiple brackets with open/close hours that you want to compare.

Also, you get max two day ahead (current and the day after) don't forget that those are not updated, so if you are running something automated for more than 24 hours, you need to request an update on the contract.
I solved this by simply requesting a contract update every 24 hours.

good luck :)




Thanks for the suggestion.
I understand and I think that makes sense according to the field description of
String m_tradingHours in
http://www.interactivebrokers.com/php/apiUsersGuide/apiguide.htm

However, when I print the contract details for a particular contract
I do not get that field. This is what I got:
Code:
conid = 30351181
symbol = GOOG
secType = STK
expiry = null
strike = 0.0
right = null
multiplier = null
exchange = SMART
primaryExch = NASDAQ
currency = USD
localSymbol = GOOG
marketName = NMS
tradingClass = NMS
minTick = 0.01
price magnifier = 1
orderTypes = ACTIVETIM,ADJUST,ALERT,ALGO,ALLOC,AON,AVGCOST,BASKET,COND,CONDORDER,DARKPOLL,DAY,DEACT,DEACTDIS,DEACTEOD,DIS,GAT,GTC,GTD,GTT,HID,ICE,IOC,LIT,LMT,LOC,MIT,MKT,MOC,MTL,NONALGO,OCA,OPG,OPGREROUT,POSTONLY,PREOPGRTH,REL,RTH,SCALE,SCALERST,STP,STPLMT,SWEEP,TIMEPRIO,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,WHATIF,
validExchanges = SMART,ARCA,BATS,BEX,BTRADE,CBSX,CHX,CSFBALGO,DRCTEDGE,EDGEA,IBSX,ISE,ISLAND,JEFFALGO,LAVA,MIBSX,NSX,TRACKECN,VWAP
underConId = 0
longName = GOOGLE INC-CL A
And as you can see there is no tradingHours field in this listing. Moreover, I just checked the ContractDetails.java source that is downloaded when installing TWS and I did not see any field called m_tradingHours.
Any idea about why this incoherence?
Thansk in advance
 
Top