Futures trading hours
Tracking exchange trading hours is an essential task for all market participants. Venues can modify their regular trading hours over time, so having an up-to-date record of these schedules can aid in organizing historical data. Since trading hours are typically modified during holidays, it's important to be aware of these altered schedules.
Overview
In this example we'll use the Historical client to get trading hours for ES futures. We'll look at two holidays to show how trading hours are modified.
We'll use the status schema for this example. This schema provides updates about the trading
session. These updates can be scheduled changes, or they can be unscheduled, such as volatility
halts or other market integrity controls. We'll filter on the reason
field to look for scheduled
changes. We'll also look at the is_trading
column, since not all changes in market state result
in a change to trading functionality.
Example
import datetime as dt
import databento as db
# Create a historical client
client = db.Historical("$YOUR_API_KEY")
# Set parameters
dataset = "GLBX.MDP3"
product = "ES"
start = "2024-12-22"
end = "2025-01-05"
# Get status data
status_data = client.timeseries.get_range(
dataset=dataset,
schema="status",
symbols=f"{product}.v.0",
stype_in="continuous",
start=start,
end=end,
)
# Convert to DataFrame
status_df = status_data.to_df()
# Filter out midnight snapshots
status_df = status_df[status_df.index.time != dt.time.min]
# Keep scheduled changes resulting in a change in trading state
status_df = status_df[status_df["reason"] == db.StatusReason.SCHEDULED]
status_df = status_df[status_df["trading_event"] == db.TradingEvent.NONE]
status_df = status_df[status_df["is_trading"] != status_df["is_trading"].shift()]
# Clean up for readability
status_df = status_df.set_index("ts_event")
status_df = status_df[["symbol", "is_trading"]]
print(status_df)
CME Globex can have different trading hours for different products. For ES futures, there is an early close on Christmas Eve (2024-12-24), as well as a full close on Christmas (2024-12-25) and New Year's Day (2025-01-01).
symbol is_trading
ts_event
2024-12-22 23:00:00+00:00 ES.v.0 Y
2024-12-23 22:00:00+00:00 ES.v.0 N
2024-12-23 23:00:00+00:00 ES.v.0 Y
2024-12-24 18:15:00+00:00 ES.v.0 N
2024-12-25 23:00:00+00:00 ES.v.0 Y
2024-12-26 22:00:00+00:00 ES.v.0 N
2024-12-26 23:00:00+00:00 ES.v.0 Y
2024-12-27 22:00:00+00:00 ES.v.0 N
2024-12-29 23:00:00+00:00 ES.v.0 Y
2024-12-30 22:00:00+00:00 ES.v.0 N
2024-12-30 23:00:00+00:00 ES.v.0 Y
2024-12-31 22:00:00+00:00 ES.v.0 N
2025-01-01 23:00:00+00:00 ES.v.0 Y
2025-01-02 22:00:00+00:00 ES.v.0 N
2025-01-02 23:00:00+00:00 ES.v.0 Y
2025-01-03 22:00:00+00:00 ES.v.0 N