tastytrade.market_sessions¶
- enum tastytrade.market_sessions.ExchangeType(value)¶
-
Contains the valid exchanges to get futures market sessions for.
Valid values are as follows:
-
CME =
<ExchangeType.CME: 'CME'>¶
-
CFE =
<ExchangeType.CFE: 'CFE'>¶
-
NYSE =
<ExchangeType.NYSE: 'Equity'>¶
-
SMALL =
<ExchangeType.SMALL: 'Smalls'>¶
-
CME =
- pydantic model tastytrade.market_sessions.MarketCalendar(*, half_days: list[date], holidays: list[date])¶
Bases:
TastytradeDataDataclass containing information about market holidays and shortened days.
Show JSON schema
{ "title": "MarketCalendar", "description": "Dataclass containing information about market holidays and shortened days.", "type": "object", "properties": { "market-half-days": { "items": { "format": "date", "type": "string" }, "title": "Market-Half-Days", "type": "array" }, "market-holidays": { "items": { "format": "date", "type": "string" }, "title": "Market-Holidays", "type": "array" } }, "required": [ "market-half-days", "market-holidays" ] }
-
pydantic model tastytrade.market_sessions.MarketSession(*, close_at: datetime | None =
None, close_at_ext: datetime | None =None, instrument_collection: str, open_at: datetime | None =None, start_at: datetime | None =None, next_session: MarketSessionSnapshot | None =None, previous_session: MarketSessionSnapshot | None =None, state: MarketStatus)¶ Bases:
TastytradeDataDataclass representing the current, next, and previous sessions.
Show JSON schema
{ "title": "MarketSession", "description": "Dataclass representing the current, next, and previous sessions.", "type": "object", "properties": { "close-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Close-At" }, "close-at-ext": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Close-At-Ext" }, "instrument-collection": { "title": "Instrument-Collection", "type": "string" }, "open-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Open-At" }, "start-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Start-At" }, "next-session": { "anyOf": [ { "$ref": "#/$defs/MarketSessionSnapshot" }, { "type": "null" } ], "default": null }, "previous-session": { "anyOf": [ { "$ref": "#/$defs/MarketSessionSnapshot" }, { "type": "null" } ], "default": null }, "state": { "$ref": "#/$defs/MarketStatus" } }, "$defs": { "MarketSessionSnapshot": { "description": "Dataclass containing information about the upcoming or previous market session.", "properties": { "close-at": { "format": "date-time", "title": "Close-At", "type": "string" }, "close-at-ext": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Close-At-Ext" }, "instrument-collection": { "title": "Instrument-Collection", "type": "string" }, "open-at": { "format": "date-time", "title": "Open-At", "type": "string" }, "session-date": { "format": "date", "title": "Session-Date", "type": "string" }, "start-at": { "format": "date-time", "title": "Start-At", "type": "string" } }, "required": [ "close-at", "instrument-collection", "open-at", "session-date", "start-at" ], "title": "MarketSessionSnapshot", "type": "object" }, "MarketStatus": { "description": "Contains the valid market status values.", "enum": [ "Open", "Closed", "Pre-market", "Extended" ], "title": "MarketStatus", "type": "string" } }, "required": [ "instrument-collection", "state" ] }- Fields:¶
next_session (tastytrade.market_sessions.MarketSessionSnapshot | None)previous_session (tastytrade.market_sessions.MarketSessionSnapshot | None)status (tastytrade.market_sessions.MarketStatus)
-
pydantic model tastytrade.market_sessions.MarketSessionSnapshot(*, close_at: datetime, close_at_ext: datetime | None =
None, instrument_collection: str, open_at: datetime, session_date: date, start_at: datetime)¶ Bases:
TastytradeDataDataclass containing information about the upcoming or previous market session.
Show JSON schema
{ "title": "MarketSessionSnapshot", "description": "Dataclass containing information about the upcoming or previous market session.", "type": "object", "properties": { "close-at": { "format": "date-time", "title": "Close-At", "type": "string" }, "close-at-ext": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Close-At-Ext" }, "instrument-collection": { "title": "Instrument-Collection", "type": "string" }, "open-at": { "format": "date-time", "title": "Open-At", "type": "string" }, "session-date": { "format": "date", "title": "Session-Date", "type": "string" }, "start-at": { "format": "date-time", "title": "Start-At", "type": "string" } }, "required": [ "close-at", "instrument-collection", "open-at", "session-date", "start-at" ] }
- enum tastytrade.market_sessions.MarketStatus(value)¶
-
Contains the valid market status values.
Valid values are as follows:
-
OPEN =
<MarketStatus.OPEN: 'Open'>¶
-
CLOSED =
<MarketStatus.CLOSED: 'Closed'>¶
-
PRE_MARKET =
<MarketStatus.PRE_MARKET: 'Pre-market'>¶
-
EXTENDED =
<MarketStatus.EXTENDED: 'Extended'>¶
-
OPEN =
- async tastytrade.market_sessions.a_get_market_holidays(session: Session) MarketCalendar¶
Retrieves market calendar for half days and holidays.
- async tastytrade.market_sessions.a_get_market_sessions(session: Session, exchanges: list[ExchangeType]) list[MarketSession]¶
Retrieves a list of session timings for the given exchanges.
- tastytrade.market_sessions.get_market_holidays(session: Session) MarketCalendar¶
Retrieves market calendar for half days and holidays.
- tastytrade.market_sessions.get_market_sessions(session: Session, exchanges: list[ExchangeType]) list[MarketSession]¶
Retrieves a list of session timings for the given exchanges.