tastytrade.market_data¶
- enum tastytrade.market_data.ClosePriceType(value)¶
-
Contains possible statuses for close prices.
Valid values are as follows:
-
FINAL =
<ClosePriceType.FINAL: 'Final'>¶
-
INDICATIVE =
<ClosePriceType.INDICATIVE: 'Indicative'>¶
-
PRELIMINARY =
<ClosePriceType.PRELIMINARY: 'Preliminary'>¶
-
REGULAR =
<ClosePriceType.REGULAR: 'Regular'>¶
-
UNKNOWN =
<ClosePriceType.UNKNOWN: 'Unknown'>¶
-
FINAL =
- enum tastytrade.market_data.ExchangeType(value)¶
-
Contains the valid exchanges to fetch data for.
Valid values are as follows:
-
CME =
<ExchangeType.CME: 'CME'>¶
-
CFE =
<ExchangeType.CFE: 'CFE'>¶
-
NYSE =
<ExchangeType.NYSE: 'Equity'>¶
-
SMALL =
<ExchangeType.SMALL: 'Smalls'>¶
-
CBOE =
<ExchangeType.CBOE: 'CBOED'>¶
-
BOND =
<ExchangeType.BOND: 'Bond'>¶
-
CRYPTO =
<ExchangeType.CRYPTO: 'Cryptocurrency'>¶
-
EQUITY_OFFERING =
<ExchangeType.EQUITY_OFFERING: 'Equity Offering'>¶
-
UNKNOWN =
<ExchangeType.UNKNOWN: 'Unknown'>¶
-
CME =
- pydantic model tastytrade.market_data.Instrument(*, symbol: str, instrument_type: InstrumentType, instrument_key: InstrumentKey, underlying_instrument: str, root_symbol: str, exchange: ExchangeType)¶
Bases:
TastytradeDataDataclass containing information about an instrument.
Show JSON schema
{ "title": "Instrument", "description": "Dataclass containing information about an instrument.", "type": "object", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "instrument-key": { "$ref": "#/$defs/InstrumentKey" }, "underlying-instrument": { "title": "Underlying-Instrument", "type": "string" }, "root-symbol": { "title": "Root-Symbol", "type": "string" }, "exchange": { "$ref": "#/$defs/ExchangeType" } }, "$defs": { "ExchangeType": { "description": "Contains the valid exchanges to fetch data for.", "enum": [ "CME", "CFE", "Equity", "Smalls", "CBOED", "Bond", "Cryptocurrency", "Equity Offering", "Unknown" ], "title": "ExchangeType", "type": "string" }, "InstrumentKey": { "description": "Dataclass containing an instrument key.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" } }, "required": [ "symbol", "instrument-type" ], "title": "InstrumentKey", "type": "object" }, "InstrumentType": { "description": "This is an :class:`~enum.Enum` that contains the valid types of instruments\nand their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" } }, "required": [ "symbol", "instrument-type", "instrument-key", "underlying-instrument", "root-symbol", "exchange" ] }
- pydantic model tastytrade.market_data.InstrumentKey(*, symbol: str, instrument_type: InstrumentType)¶
Bases:
TastytradeDataDataclass containing an instrument key.
Show JSON schema
{ "title": "InstrumentKey", "description": "Dataclass containing an instrument key.", "type": "object", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" } }, "$defs": { "InstrumentType": { "description": "This is an :class:`~enum.Enum` that contains the valid types of instruments\nand their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" } }, "required": [ "symbol", "instrument-type" ] }
-
pydantic model tastytrade.market_data.MarketData(*, symbol: str, instrument_type: InstrumentType, updated_at: datetime, bid_size: Decimal, ask_size: Decimal, mark: Decimal, close_price_type: ClosePriceType, summary_date: date, prev_close_date: date, prev_close_price_type: ClosePriceType, halt_start_time: int, halt_end_time: int, ask: Decimal | None =
None, beta: Decimal | None =None, bid: Decimal | None =None, close: Decimal | None =None, day_open: Decimal | None =None, day_high: Decimal | None =None, day_low: Decimal | None =None, day_close: Decimal | None =None, day_high_price: Decimal | None =None, day_low_price: Decimal | None =None, dividend_amount: Decimal | None =None, dividend_frequency: Decimal | None =None, high_limit_price: Decimal | None =None, instrument: Instrument | None =None, last: Decimal | None =None, last_mkt: Decimal | None =None, last_ext: Decimal | None =None, last_trade_time: int | None =None, low_limit_price: Decimal | None =None, mid: Decimal | None =None, open: Decimal | None =None, prev_close: Decimal | None =None, prev_day_close: Decimal | None =None, trading_halted: bool | None =None, trading_halted_reason: str | None =None, volume: Decimal | None =None, year_low_price: Decimal | None =None, year_high_price: Decimal | None =None, open_interest: Decimal | None =None)¶ Bases:
TastytradeDataDataclass containing life market data for a symbol.
Show JSON schema
{ "title": "MarketData", "description": "Dataclass containing life market data for a symbol.", "type": "object", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "updated-at": { "format": "date-time", "title": "Updated-At", "type": "string" }, "bid-size": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Bid-Size" }, "ask-size": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Ask-Size" }, "mark": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Mark" }, "close-price-type": { "$ref": "#/$defs/ClosePriceType" }, "summary-date": { "format": "date", "title": "Summary-Date", "type": "string" }, "prev-close-date": { "format": "date", "title": "Prev-Close-Date", "type": "string" }, "prev-close-price-type": { "$ref": "#/$defs/ClosePriceType" }, "halt-start-time": { "title": "Halt-Start-Time", "type": "integer" }, "halt-end-time": { "title": "Halt-End-Time", "type": "integer" }, "ask": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ask" }, "beta": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Beta" }, "bid": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Bid" }, "close": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Close" }, "day-open": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Day-Open" }, "day-high": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Day-High" }, "day-low": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Day-Low" }, "day-close": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Day-Close" }, "day-high-price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Day-High-Price" }, "day-low-price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Day-Low-Price" }, "dividend-amount": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Dividend-Amount" }, "dividend-frequency": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Dividend-Frequency" }, "high-limit-price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "High-Limit-Price" }, "instrument": { "anyOf": [ { "$ref": "#/$defs/Instrument" }, { "type": "null" } ], "default": null }, "last": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Last" }, "last-mkt": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Last-Mkt" }, "last-ext": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Last-Ext" }, "last-trade-time": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Last-Trade-Time" }, "low-limit-price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Low-Limit-Price" }, "mid": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Mid" }, "open": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Open" }, "prev-close": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Prev-Close" }, "prev-day-close": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Prev-Day-Close" }, "trading-halted": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Trading-Halted" }, "trading-halted-reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Trading-Halted-Reason" }, "volume": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Volume" }, "year-low-price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Year-Low-Price" }, "year-high-price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Year-High-Price" }, "open-interest": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Open-Interest" } }, "$defs": { "ClosePriceType": { "description": "Contains possible statuses for close prices.", "enum": [ "Final", "Indicative", "Preliminary", "Regular", "Unknown" ], "title": "ClosePriceType", "type": "string" }, "ExchangeType": { "description": "Contains the valid exchanges to fetch data for.", "enum": [ "CME", "CFE", "Equity", "Smalls", "CBOED", "Bond", "Cryptocurrency", "Equity Offering", "Unknown" ], "title": "ExchangeType", "type": "string" }, "Instrument": { "description": "Dataclass containing information about an instrument.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "instrument-key": { "$ref": "#/$defs/InstrumentKey" }, "underlying-instrument": { "title": "Underlying-Instrument", "type": "string" }, "root-symbol": { "title": "Root-Symbol", "type": "string" }, "exchange": { "$ref": "#/$defs/ExchangeType" } }, "required": [ "symbol", "instrument-type", "instrument-key", "underlying-instrument", "root-symbol", "exchange" ], "title": "Instrument", "type": "object" }, "InstrumentKey": { "description": "Dataclass containing an instrument key.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" } }, "required": [ "symbol", "instrument-type" ], "title": "InstrumentKey", "type": "object" }, "InstrumentType": { "description": "This is an :class:`~enum.Enum` that contains the valid types of instruments\nand their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" } }, "required": [ "symbol", "instrument-type", "updated-at", "bid-size", "ask-size", "mark", "close-price-type", "summary-date", "prev-close-date", "prev-close-price-type", "halt-start-time", "halt-end-time" ] }
- async tastytrade.market_data.a_get_market_data(session: Session, symbol: str, instrument_type: InstrumentType) MarketData¶
Get market data for the given symbol.
-
async tastytrade.market_data.a_get_market_data_by_type(session: Session, cryptocurrencies: list[str] | None =
None, equities: list[str] | None =None, futures: list[str] | None =None, future_options: list[str] | None =None, indices: list[str] | None =None, options: list[str] | None =None) list[MarketData]¶ Get market data for the given symbols grouped by instrument type. Combined limit across all types is 100.
- Parameters:¶
- session: Session¶
active session to use
- cryptocurrencies: list[str] | None =
None¶ list of cryptocurrencies to fetch
- equities: list[str] | None =
None¶ list of equities to fetch
- futures: list[str] | None =
None¶ list of futures to fetch
- future_options: list[str] | None =
None¶ list of future options to fetch
- indices: list[str] | None =
None¶ list of indices to fetch
- options: list[str] | None =
None¶ list of options to fetch
- tastytrade.market_data.get_market_data(session: Session, symbol: str, instrument_type: InstrumentType) MarketData¶
Get market data for the given symbol.
-
tastytrade.market_data.get_market_data_by_type(session: Session, cryptocurrencies: list[str] | None =
None, equities: list[str] | None =None, futures: list[str] | None =None, future_options: list[str] | None =None, indices: list[str] | None =None, options: list[str] | None =None) list[MarketData]¶ Get market data for the given symbols grouped by instrument type. Combined limit across all types is 100.
- Parameters:¶
- session: Session¶
active session to use
- cryptocurrencies: list[str] | None =
None¶ list of cryptocurrencies to fetch
- equities: list[str] | None =
None¶ list of equities to fetch
- futures: list[str] | None =
None¶ list of futures to fetch
- future_options: list[str] | None =
None¶ list of future options to fetch
- indices: list[str] | None =
None¶ list of indices to fetch
- options: list[str] | None =
None¶ list of options to fetch