¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

easiest way to tell if contract is trading today?


 

What is the easiest why to tell if a contract's markets are open today?


?I'm just beginning to use the API and was think of writing a loop that every day check's to see if the market for a particular contract (say SPY) is open.


if so, initiate trade

else, try again next day?


also, any way to find out for early close days via API? like day after thanksgiving


Nick
 

¿ªÔÆÌåÓý

If you are talking about cme futures, there aren't many holidays in a year. You can create a list of holidays and have the program check the list. It's low-tech but pretty reliable.

On 5/25/2016 12:46 PM, andrewdavischan@... [TWSAPI] wrote:

?

What is the easiest why to tell if a contract's markets are open today?


?I'm just beginning to use the API and was think of writing a loop that every day check's to see if the market for a particular contract (say SPY) is open.


if so, initiate trade

else, try again next day?


also, any way to find out for early close days via API? like day after thanksgiving



 

¿ªÔÆÌåÓý

Info returned in NewContractDetails includes market availability.

?


On 05/25/2016 01:47 PM, Nick news1000@... [TWSAPI] wrote:

?

If you are talking about cme futures, there aren't many holidays in a year. You can create a list of holidays and have the program check the list. It's low-tech but pretty reliable.

On 5/25/2016 12:46 PM, andrewdavischan@... [TWSAPI] wrote:
?

What is the easiest why to tell if a contract's markets are open today?


?I'm just beginning to use the API and was think of writing a loop that every day check's to see if the market for a particular contract (say SPY) is open.


if so, initiate trade

else, try again next day?


also, any way to find out for early close days via API? like day after thanksgiving




 

agree w Nick.
Below are useful details:
Gd luck
S

NYSE holidays:
Jan 1, 3rd Mon of Jan (luther-king day), 3rd Mon of Feb (Washiongton b-day), good friday, last Mon of May (memorial day), Jul 4, 1st Mon of Sep (labor day), last Thu of Nov (thanksgiving), Dec 25.
If a holiday falls on a Sunday, the Nyse closes on Monday; if it falls on a Sat, it closes on Fri (except if end of accounting month/year); eg: Mon 20040705 and Mon 20100705 were closed.
NB: extra holiday on 20040611 (mourning Reagan), on 20070102 (mourning Ford), on 20121029 & 20121030 (hurricane Sandy, index futures closed after 9:15 NY time, but energy/metals/agro open, bonds closed only on 20121129 after 10am NY time but neglect).
Nyse closures since 1885: http://www.chronos-st.org/NYSE_Observed_Holidays-1885-Present.html
half-days:? Jul 3 (or Jul 5 if the 4th is a Thu - but not in 2013), day after thanksgiving, Dec 24, Dec 26 if it's a Fri; these are listed below (since 2000):
20000703
20001124
20010703
20011123
20011224
20020705
20021129
20030703
20031128
20031224
20031226
20041126
20051125
20060703
20061124
20070703
20071123
20071224
20080703
20081128
20081224
20091127
20091224
20101126
20101224
20111125
20111224
20120703
20121123
20121224
20130703
20131122
20131224
20140703
20141128
20141224
20141226
20151127
20151224
20161125
20161224

NYMEX:
as NYSE since 2007; prior that, download holidays from BB (CDR code NM); a few differences...

CBOT (ie Govt bond & bond fut, DJ fut, agric fut):
ame holidays as for Nyse; Columbus and Veteran days are traded but not settled.? Hence include Columbus & Vet days since 2008, and also 20010913, 20010914, 20040611, 20070102 (Nyse closed but CBOT open); also include 19960405, 19990402 (easter fridays, bizarrely settled). As NYSE since 2008.

_____________________________________________________________________
LIFFE:
FTSE,gilt,sterling,commo and LSE follow UK holidays; the rest (euro$,euroY,euribor,...) follows EU holidays (Jan 1, good friday, easter monday, Dec 25,26; ie Euronext holidays w/o May 1).? get the latter holidays from the former by suppressing Jan 2 or 3, May & Aug bank holidays, Dec 27-28 (where appropriate). Note for uk: if xmas/boxingDay or newyear fall on a weekend, get 1 or 2 days off on Dec 27/28 or Jan 2/3.? NB: 20110429 is royal wedding; 20120528 bank holiday is shifted to 20120604 to bridge to exceptional holiday on 20120605 (Queen's diamond jubilee, .uk).

Euronext:
Jan 1, good friday, easter monday, May 1, Dec 25,26 (early closing on Dec 24,31).?

Eurex and Xetra:
idem, plus? Dec 24, Dec 31. Prior 2000 also Ascension, Pentecost and Oct 3 (20001003 has STXE,FSMI,FGBL but no FDX).? FDX/Dax also closed on WhitMon since 2015 (FGBL/Bund also in 2015, not 2016).?

easter? ascencion? WhitMon? CorpusChristi :
19960407 19960516 19960527 19960606
19970330 19970508 19970519 19970529
19980412 19980521 19980601 19980611
19990404 19990513 19990524 19990603
20000423 20000601 20000612 20000622
20010415 20010524 20010604 20010614
20020331 20020509 20020520 20020530
20030420 20030529 20030609 20030619
20040411 20040520 20040531 20040610
20050327 20050505 20050516 20050526
20060416 20060525 20060605 20060615
20070408 20070517 20070528 20070607
20080323 20080501 20080512 20080522
20090412 20090521 20090601 20090611
20100404 20100513 20100524 20100603
20110424 20110602 20110613 20110623
20120408 20120517 20120528 20120607
20130331 20130509 20130520 20130530
20140420 20140529 20140609 20140619
20150405 20150514 20150525 20150604
20160327 20160505 20160516 20160526


 

thanks for the replies. ?Just thought it would be cleaner if it was available from api instead of maintaining a calendar that needs to be periodically updated. ?Also, looked at NewContractDetails, unfortunately, they have some info on trading times, but no flag with a timestamp indicating market is available for trading?


 

contractDetails returned from reqContractDetails has the total hours a contract is trading for the current day. It should say "CLOSED" if it's not trading, unfortunately it's not 100% reliable.

Josh