Trading Hours & Holidays#
Both Trading Hours and historic holidays are recorded in the database OQD_MKTCAL
.
Data is divided between Equity Markets and Futures products given that different futures products on the same venue may have different trading hours.
Equity Market Holiday History#
Equity Market Holidays are retrieved by setting the SYMBOL_NAME
to the required database prefixed with CLOUD_DB_
. The Time range should cover the required history of holiday events,
while the ACTIVITY_NAME
should include HOLIDAY
. The results will include the fields TIME_ZONE
, START_TIME
, END_TIME
, START_DATE
and END_DATE
.
def mktcal():
pt = otq.Passthrough().tick_type('MKTCAL')
where = otq.WhereClause(where='ACTIVITY_NAME like "%HOLIDAY%"')
graph = otq.Graph(pt >> where)
return graph
result = otq.run(mktcal(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2023,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='UTC',
symbols='OQD_MKTCAL::CLOUD_DB_LSE'
)
Time |
CALENDAR_NAME |
ACTIVITY_NAME |
TIME_ZONE |
START_DATE |
END_DATE |
START_TIME |
END_TIME |
WEEKDAYS |
DELETED_TIME |
TICK_STATUS |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2023-04-07 |
CLOUD_DB_LSE |
ALL_HOLIDAY |
Europe/London |
2023-04-07 |
2023-04-07 |
00:00 |
24:00 |
32 |
1970-01-01 |
0 |
622 |
1 |
2023-04-10 |
CLOUD_DB_LSE |
ALL_HOLIDAY |
Europe/London |
2023-04-10 |
2023-04-10 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
250 |
2 |
2023-05-01 |
CLOUD_DB_LSE |
ALL_HOLIDAY |
Europe/London |
2023-05-01 |
2023-05-01 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
390 |
3 |
2023-05-08 |
CLOUD_DB_LSE |
ALL_HOLIDAY |
Europe/London |
2023-05-08 |
2023-05-08 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
34 |
4 |
2023-05-29 |
CLOUD_DB_LSE |
ALL_HOLIDAY |
Europe/London |
2023-05-29 |
2023-05-29 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
240 |
5 |
2023-08-28 |
CLOUD_DB_LSE |
ALL_HOLIDAY |
Europe/London |
2023-08-28 |
2023-08-28 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
24 |
6 |
2023-12-22 |
CLOUD_DB_LSE |
DAY_HOLIDAY |
Europe/London |
2023-12-22 |
2023-12-22 |
08:00 |
12:30 |
32 |
1970-01-01 |
0 |
37 |
7 |
2023-12-25 |
CLOUD_DB_LSE |
ALL_HOLIDAY |
Europe/London |
2023-12-25 |
2023-12-25 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
565 |
8 |
2023-12-26 |
CLOUD_DB_LSE |
ALL_HOLIDAY |
Europe/London |
2023-12-26 |
2023-12-26 |
00:00 |
24:00 |
4 |
1970-01-01 |
0 |
326 |
9 |
2023-12-29 |
CLOUD_DB_LSE |
DAY_HOLIDAY |
Europe/London |
2023-12-29 |
2023-12-29 |
08:00 |
12:30 |
32 |
1970-01-01 |
0 |
99 |
Equity Trading Hour History#
Equity Trading Hours are retrieved by setting the SYMBOL_NAME
to the required database prefixed with CLOUD_DB_
. The Time range should cover the required history of trading hours,
while the ACTIVITY_NAME
should not include HOLIDAY
. The results will include the fields TIME_ZONE
, START_TIME
, END_TIME
, START_DATE
, END_DATE
and ACTIVITIY_NAME
.
def mkt_hours():
pt = otq.Passthrough().tick_type('MKTCAL')
where = otq.WhereClause(where='ACTIVITY_NAME not like "%HOLIDAY%"')
graph = otq.Graph(pt >> where)
return graph
result = otq.run(mkt_hours(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(1990,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='UTC',
symbols='OQD_MKTCAL::CLOUD_DB_LSE'
)
Time |
CALENDAR_NAME |
ACTIVITY_NAME |
TIME_ZONE |
START_DATE |
END_DATE |
START_TIME |
END_TIME |
WEEKDAYS |
DELETED_TIME |
TICK_STATUS |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
1993-01-01 |
CLOUD_DB_LSE |
MARKET |
Europe/London |
1993-01-01 |
2068-07-19 |
08:00 |
16:30 |
62 |
1970-01-01 |
0 |
586 |
1 |
1993-01-01 |
CLOUD_DB_LSE |
POST_MARKET |
Europe/London |
1993-01-01 |
2068-07-19 |
16:30 |
18:30 |
62 |
1970-01-01 |
0 |
587 |
2 |
1993-01-01 |
CLOUD_DB_LSE |
PRE_MARKET |
Europe/London |
1993-01-01 |
2068-07-19 |
07:00 |
08:00 |
62 |
1970-01-01 |
0 |
588 |
3 |
1993-01-01 |
CLOUD_DB_LSE |
X_MARKET_MTF |
Europe/London |
1993-01-01 |
2068-07-19 |
08:00 |
16:30 |
62 |
1970-01-01 |
0 |
589 |
Latest Market Trading Hours#
As trading hours can change across time, the latest available trading hours can be retrieved adding a LastTick
node to the graph, with the group_by
attribute set to ACTIVITY_NAME
def latest_mkt_hours():
pt = otq.Passthrough().tick_type('MKTCAL')
where = otq.WhereClause(where='ACTIVITY_NAME not like "%HOLIDAY%"')
latest = otq.LastTick(group_by='ACTIVITY_NAME')
graph = otq.Graph(pt >> where >> latest)
return graph
result = otq.run(latest_mkt_hours(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(1990,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='UTC',
symbols='OQD_MKTCAL::CLOUD_DB_LSE'
)
Time |
CALENDAR_NAME |
ACTIVITY_NAME |
TIME_ZONE |
START_DATE |
END_DATE |
START_TIME |
END_TIME |
WEEKDAYS |
DELETED_TIME |
TICK_STATUS |
OMDSEQ |
TICK_TIME |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-04 |
CLOUD_DB_LSE |
MARKET |
Europe/London |
1993-01-01 |
2068-07-19 |
08:00 |
16:30 |
62 |
1970-01-01 |
0 |
586 |
1993-01-01 |
1 |
2024-01-04 |
CLOUD_DB_LSE |
POST_MARKET |
Europe/London |
1993-01-01 |
2068-07-19 |
16:30 |
18:30 |
62 |
1970-01-01 |
0 |
587 |
1993-01-01 |
2 |
2024-01-04 |
CLOUD_DB_LSE |
PRE_MARKET |
Europe/London |
1993-01-01 |
2068-07-19 |
07:00 |
08:00 |
62 |
1970-01-01 |
0 |
588 |
1993-01-01 |
3 |
2024-01-04 |
CLOUD_DB_LSE |
X_MARKET_MTF |
Europe/London |
1993-01-01 |
2068-07-19 |
08:00 |
16:30 |
62 |
1970-01-01 |
0 |
589 |
1993-01-01 |
Futures Product Holiday History#
Futures products may have different market holidays within the same exchange.
Consequently Futures product Holidays are retrieved by setting the SYMBOL_NAME
to the required Futures product prefixed with TDI_F_
. The Time range should cover the required history of holiday events,
while the ACTIVITY_NAME
should include HOLIDAY
. The results will include the fields TIME_ZONE
, START_TIME
, END_TIME
, START_DATE
and END_DATE
.
def futures_mktcal():
pt = otq.Passthrough().tick_type('MKTCAL')
where = otq.WhereClause(where='ACTIVITY_NAME like "%HOLIDAY%"')
graph = otq.Graph(pt >> where)
return graph
result = otq.run(futures_mktcal(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(2023,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='UTC',
symbols='OQD_MKTCAL::TDI_F_CL'
)
Time |
CALENDAR_NAME |
ACTIVITY_NAME |
TIME_ZONE |
START_DATE |
END_DATE |
START_TIME |
END_TIME |
WEEKDAYS |
DELETED_TIME |
TICK_STATUS |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
Time |
CALENDAR_NAME |
ACTIVITY_NAME |
TIME_ZONE |
START_DATE |
END_DATE |
START_TIME |
END_TIME |
WEEKDAYS |
DELETED_TIME |
TICK_STATUS |
OMDSEQ |
|
0 |
2023-01-16 |
TDI_F_CL |
NIGHT2_HOLIDAY |
America/New_York |
2023-01-16 |
2023-01-16 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
503 |
1 |
2023-02-20 |
TDI_F_CL |
NIGHT2_HOLIDAY |
America/New_York |
2023-02-20 |
2023-02-20 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
690 |
2 |
2023-04-07 |
TDI_F_CL |
ALL_HOLIDAY |
America/New_York |
2023-04-07 |
2023-04-07 |
00:00 |
24:00 |
32 |
1970-01-01 |
0 |
1899 |
3 |
2023-05-29 |
TDI_F_CL |
NIGHT2_HOLIDAY |
America/New_York |
2023-05-29 |
2023-05-29 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
699 |
4 |
2023-06-19 |
TDI_F_CL |
NIGHT2_HOLIDAY |
America/New_York |
2023-06-19 |
2023-06-19 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
495 |
5 |
2023-07-04 |
TDI_F_CL |
NIGHT2_HOLIDAY |
America/New_York |
2023-07-04 |
2023-07-04 |
00:00 |
24:00 |
4 |
1970-01-01 |
0 |
481 |
6 |
2023-09-04 |
TDI_F_CL |
NIGHT2_HOLIDAY |
America/New_York |
2023-09-04 |
2023-09-04 |
00:00 |
24:00 |
2 |
1970-01-01 |
0 |
650 |
7 |
2023-11-23 |
TDI_F_CL |
NIGHT2_HOLIDAY |
America/New_York |
2023-11-23 |
2023-11-23 |
00:00 |
24:00 |
16 |
1970-01-01 |
0 |
610 |
8 |
2023-11-24 |
TDI_F_CL |
DAY_HOLIDAY |
America/New_York |
2023-11-24 |
2023-11-24 |
09:00 |
13:45 |
32 |
1970-01-01 |
0 |
541 |
9 |
2023-11-24 |
TDI_F_CL |
NIGHT2_HOLIDAY |
America/New_York |
2023-11-24 |
2023-11-24 |
00:00 |
24:00 |
32 |
1970-01-01 |
0 |
542 |
Futures Product Trading Hour History#
Futures products may have different trading hours within the same exchange.
Futures Prodict Trading Hours are retrieved by setting the SYMBOL_NAME
to the required database prefixed with TDI_F_CL_
. The Time range should cover the required history of trading hours,
while the ACTIVITY_NAME
should not include HOLIDAY
. The results will include the fields TIME_ZONE
, START_TIME
, END_TIME
, START_DATE
, END_DATE
and ACTIVITIY_NAME
.
def futures_hours():
pt = otq.Passthrough().tick_type('MKTCAL')
where = otq.WhereClause(where='ACTIVITY_NAME not like "%HOLIDAY%"')
graph = otq.Graph(pt >> where)
return graph
result = otq.run(futures_hours(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(1990,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='UTC',
symbols='OQD_MKTCAL::TDI_F_CL'
)
Time |
CALENDAR_NAME |
ACTIVITY_NAME |
TIME_ZONE |
START_DATE |
END_DATE |
START_TIME |
END_TIME |
WEEKDAYS |
DELETED_TIME |
TICK_STATUS |
OMDSEQ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
1993-01-06 |
TDI_F_CL |
DAY |
America/New_York |
1993-01-06 |
1993-03-12 |
09:45 |
15:40 |
62 |
1970-01-01 |
0 |
2 |
1 |
1993-03-13 |
TDI_F_CL |
DAY |
America/New_York |
1993-03-13 |
2001-09-10 |
09:45 |
15:15 |
62 |
1970-01-01 |
0 |
2 |
2 |
2001-09-17 |
TDI_F_CL |
DAY |
America/New_York |
2001-09-17 |
2001-09-17 |
11:45 |
14:40 |
62 |
1970-01-01 |
0 |
20 |
3 |
2001-09-18 |
TDI_F_CL |
DAY |
America/New_York |
2001-09-18 |
2001-09-19 |
09:45 |
13:45 |
62 |
1970-01-01 |
0 |
8 |
4 |
2001-09-20 |
TDI_F_CL |
DAY |
America/New_York |
2001-09-20 |
2001-09-28 |
10:45 |
13:50 |
62 |
1970-01-01 |
0 |
43 |
5 |
2001-10-01 |
TDI_F_CL |
DAY |
America/New_York |
2001-10-01 |
2001-10-05 |
10:00 |
14:00 |
62 |
1970-01-01 |
0 |
10 |
6 |
2001-10-06 |
TDI_F_CL |
DAY |
America/New_York |
2001-10-06 |
2006-06-10 |
10:00 |
14:30 |
62 |
1970-01-01 |
0 |
33 |
7 |
2001-10-06 |
TDI_F_CL |
NIGHT1 |
America/New_York |
2001-10-06 |
2006-06-10 |
15:15 |
09:30 |
60 |
1970-01-01 |
0 |
34 |
8 |
2001-10-06 |
TDI_F_CL |
NIGHT1 |
America/New_York |
2001-10-06 |
2006-06-10 |
19:00 |
09:30 |
2 |
1970-01-01 |
0 |
35 |
9 |
2006-06-11 |
TDI_F_CL |
DAY |
America/New_York |
2006-06-11 |
2007-01-31 |
10:00 |
14:30 |
62 |
1970-01-01 |
0 |
45 |
Latest Furures Product Trading Hours#
As trading hours can change across time, the latest available trading hours can be retrieved adding a LastTick
node to the graph, with the group_by
attribute set to ACTIVITY_NAME
def latest_futures_hours():
pt = otq.Passthrough().tick_type('MKTCAL')
where = otq.WhereClause(where='ACTIVITY_NAME not like "%HOLIDAY%"')
latest = otq.LastTick(group_by='ACTIVITY_NAME')
graph = otq.Graph(pt >> where >> latest)
return graph
result = otq.run(latest_futures_hours(),
http_address=rest_url,access_token=access_token,
output_mode="pandas",
start=datetime(1990,1,3,0,0,0),
end = datetime(2024,1,4,0,0,0),
timezone='UTC',
symbols='OQD_MKTCAL::TDI_F_CL'
)
Time |
CALENDAR_NAME |
ACTIVITY_NAME |
TIME_ZONE |
START_DATE |
END_DATE |
START_TIME |
END_TIME |
WEEKDAYS |
DELETED_TIME |
TICK_STATUS |
OMDSEQ |
TICK_TIME |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-01-04 |
TDI_F_CL |
DAY |
America/New_York |
2007-02-01 |
2050-12-31 |
09:00 |
14:30 |
62 |
1970-01-01 |
0 |
33 |
2007-02-01 |
1 |
2024-01-04 |
TDI_F_CL |
NIGHT1 |
America/New_York |
2008-09-16 |
2068-07-19 |
18:00 |
09:00 |
62 |
1970-01-01 |
0 |
28 |
2008-09-16 |
2 |
2024-01-04 |
TDI_F_CL |
NIGHT2 |
America/New_York |
2015-09-21 |
2068-07-19 |
14:30 |
17:00 |
62 |
1970-01-01 |
0 |
196 |
2015-09-21 |