Skip to main content

Market Hours & Timezones

Market data is tied to the exchange, asset class, and session where the instrument trades. yfin exposes market-state and timezone fields so applications can label data correctly.

Market State

Quote responses commonly include fields such as marketState and market-time values. Examples of market states include regular session, pre-market, post-market, and closed.

Use /v1/market_time when you need market-level session information:

curl "https://api.yfin.dev/v1/market_time?region=US" \
-H "X-Yfin-Contact: you@example.com"
const marketTime = await client.marketTime({ region: "US" });

Timestamps

Historical price responses use Unix timestamps. Interpret those timestamps with the timezone returned in chart metadata, not with the timezone of your server or browser.

import yfin

client = yfin.Client(contact="you@example.com")
history = client.history("AAPL", period="5d", interval="1h")

Regular And Extended Sessions

For equities, regular trading hours and extended trading hours are different. Set prepost=true when you want pre-market and post-market bars and the selected symbol/interval supports them.

curl "https://api.yfin.dev/v1/history?symbol=AAPL&period=5d&interval=1h&prepost=true"

Practical Rules

  • Display a market-state label when showing current quote data.
  • Convert chart timestamps with the exchange timezone when grouping by trading day.
  • Do not assume US equity hours for crypto, FX, futures, or international listings.
  • Use market-time data for dashboard state instead of hard-coding exchange calendars.