tastytrade.instruments¶
- pydantic model tastytrade.instruments.Cryptocurrency(*, instrument_type: InstrumentType, symbol: str, id: int, short_description: str, description: str, is_closing_only: bool, active: bool, tick_size: Decimal, destination_venue_symbols: list[DestinationVenueSymbol], streamer_symbol: str)¶
Bases:
TradeableTastytradeDataDataclass that represents a Tastytrade cryptocurrency object. Contains information about the cryptocurrency and methods to populate that data using cryptocurrency symbol(s).
Show JSON schema
{ "title": "Cryptocurrency", "description": "Dataclass that represents a Tastytrade cryptocurrency object. Contains\ninformation about the cryptocurrency and methods to populate that data\nusing cryptocurrency symbol(s).", "type": "object", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "id": { "title": "Id", "type": "integer" }, "short-description": { "title": "Short-Description", "type": "string" }, "description": { "title": "Description", "type": "string" }, "is-closing-only": { "title": "Is-Closing-Only", "type": "boolean" }, "active": { "title": "Active", "type": "boolean" }, "tick-size": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Tick-Size" }, "destination-venue-symbols": { "items": { "$ref": "#/$defs/DestinationVenueSymbol" }, "title": "Destination-Venue-Symbols", "type": "array" }, "streamer-symbol": { "title": "Streamer-Symbol", "type": "string" } }, "$defs": { "DestinationVenueSymbol": { "description": "Dataclass representing a specific destination venue symbol for a\ncryptocurrency.", "properties": { "id": { "title": "Id", "type": "integer" }, "symbol": { "title": "Symbol", "type": "string" }, "destination-venue": { "title": "Destination-Venue", "type": "string" }, "routable": { "title": "Routable", "type": "boolean" }, "max-quantity-precision": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Max-Quantity-Precision" }, "max-price-precision": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Max-Price-Precision" } }, "required": [ "id", "symbol", "destination-venue", "routable" ], "title": "DestinationVenueSymbol", "type": "object" }, "InstrumentType": { "description": "Contains the valid types of instruments and 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": [ "instrument-type", "symbol", "id", "short-description", "description", "is-closing-only", "active", "tick-size", "destination-venue-symbols", "streamer-symbol" ] }- Fields:¶
- field destination_venue_symbols : list[DestinationVenueSymbol] [Required] (alias 'destination-venue-symbols')¶
-
pydantic model tastytrade.instruments.Deliverable(*, id: int, root_symbol: str, deliverable_type: str, description: str, amount: Decimal, percent: str, symbol: str | None =
None, instrument_type: InstrumentType | None =None)¶ Bases:
TastytradeDataDataclass representing the deliverable for an option.
Show JSON schema
{ "title": "Deliverable", "description": "Dataclass representing the deliverable for an option.", "type": "object", "properties": { "id": { "title": "Id", "type": "integer" }, "root-symbol": { "title": "Root-Symbol", "type": "string" }, "deliverable-type": { "title": "Deliverable-Type", "type": "string" }, "description": { "title": "Description", "type": "string" }, "amount": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Amount" }, "percent": { "title": "Percent", "type": "string" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" }, "instrument-type": { "anyOf": [ { "$ref": "#/$defs/InstrumentType" }, { "type": "null" } ], "default": null } }, "$defs": { "InstrumentType": { "description": "Contains the valid types of instruments and 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": [ "id", "root-symbol", "deliverable-type", "description", "amount", "percent" ] }- Fields:¶
-
field instrument_type : InstrumentType | None =
None(alias 'instrument-type')¶
-
pydantic model tastytrade.instruments.DestinationVenueSymbol(*, id: int, symbol: str, destination_venue: str, routable: bool, max_quantity_precision: int | None =
None, max_price_precision: int | None =None)¶ Bases:
TastytradeDataDataclass representing a specific destination venue symbol for a cryptocurrency.
Show JSON schema
{ "title": "DestinationVenueSymbol", "description": "Dataclass representing a specific destination venue symbol for a\ncryptocurrency.", "type": "object", "properties": { "id": { "title": "Id", "type": "integer" }, "symbol": { "title": "Symbol", "type": "string" }, "destination-venue": { "title": "Destination-Venue", "type": "string" }, "routable": { "title": "Routable", "type": "boolean" }, "max-quantity-precision": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Max-Quantity-Precision" }, "max-price-precision": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Max-Price-Precision" } }, "required": [ "id", "symbol", "destination-venue", "routable" ] }- Fields:¶
-
pydantic model tastytrade.instruments.Equity(*, instrument_type: InstrumentType, symbol: str, id: int, is_index: bool, description: str, lendability: str, market_time_instrument_collection: str, is_closing_only: bool, is_options_closing_only: bool, active: bool, is_illiquid: bool, is_etf: bool, streamer_symbol: str, borrow_rate: Decimal | None =
None, cusip: str | None =None, short_description: str | None =None, halted_at: datetime | None =None, stops_trading_at: datetime | None =None, is_fractional_quantity_eligible: bool | None =None, tick_sizes: list[TickSize] | None =None, listed_market: str | None =None, option_tick_sizes: list[TickSize] | None =None)¶ Bases:
TradeableTastytradeDataDataclass that represents a Tastytrade equity object. Contains information about the equity and methods to populate that data using equity symbol(s).
Show JSON schema
{ "title": "Equity", "description": "Dataclass that represents a Tastytrade equity object. Contains information\nabout the equity and methods to populate that data using equity symbol(s).", "type": "object", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "id": { "title": "Id", "type": "integer" }, "is-index": { "title": "Is-Index", "type": "boolean" }, "description": { "title": "Description", "type": "string" }, "lendability": { "title": "Lendability", "type": "string" }, "market-time-instrument-collection": { "title": "Market-Time-Instrument-Collection", "type": "string" }, "is-closing-only": { "title": "Is-Closing-Only", "type": "boolean" }, "is-options-closing-only": { "title": "Is-Options-Closing-Only", "type": "boolean" }, "active": { "title": "Active", "type": "boolean" }, "is-illiquid": { "title": "Is-Illiquid", "type": "boolean" }, "is-etf": { "title": "Is-Etf", "type": "boolean" }, "streamer-symbol": { "title": "Streamer-Symbol", "type": "string" }, "borrow-rate": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Borrow-Rate" }, "cusip": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cusip" }, "short-description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Short-Description" }, "halted-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Halted-At" }, "stops-trading-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Stops-Trading-At" }, "is-fractional-quantity-eligible": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Is-Fractional-Quantity-Eligible" }, "tick-sizes": { "anyOf": [ { "items": { "$ref": "#/$defs/TickSize" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Tick-Sizes" }, "listed-market": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Listed-Market" }, "option-tick-sizes": { "anyOf": [ { "items": { "$ref": "#/$defs/TickSize" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Option-Tick-Sizes" } }, "$defs": { "InstrumentType": { "description": "Contains the valid types of instruments and 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" }, "TickSize": { "description": "Dataclass representing the tick size for an instrument.", "properties": { "value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Value" }, "threshold": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Threshold" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" } }, "required": [ "value" ], "title": "TickSize", "type": "object" } }, "required": [ "instrument-type", "symbol", "id", "is-index", "description", "lendability", "market-time-instrument-collection", "is-closing-only", "is-options-closing-only", "active", "is-illiquid", "is-etf", "streamer-symbol" ] }-
field is_fractional_quantity_eligible : bool | None =
None(alias 'is-fractional-quantity-eligible')¶
- field market_time_instrument_collection : str [Required] (alias 'market-time-instrument-collection')¶
- async classmethod get(session: Session, symbols: str) Self¶
-
async classmethod get(session: Session, symbols: Iterable[str], *, per_page: int =
250, page_offset: int | None =0, lendability: str | None =None, is_index: bool | None =None, is_etf: bool | None =None) list[Self] Returns a list of Equity objects from the given symbols, or a single Equity object if a list is not provided.
- Parameters:¶
- session: Session¶
the session to use for the request.
- symbols: str¶
- symbols: Iterable[str]
the symbol(s) to get the equities for.
- per_page: int =
250 the number of options to get per page.
- page_offset: int | None =
0 provide a specific page to get; if None, get all pages
- lendability: str | None =
None the lendability of the equities; e.g. ‘Easy To Borrow’, ‘Locate Required’, ‘Preborrow’
- is_index: bool | None =
None whether the equities are indexes.
- is_etf: bool | None =
None whether the equities are ETFs.
-
async classmethod get_active_equities(session: Session, per_page: int =
1000, page_offset: int | None =0, lendability: str | None =None) list[Self]¶ Returns a list of actively traded Equity objects.
- Parameters:¶
- session: Session¶
the session to use for the request.
- per_page: int =
1000¶ the number of equities to get per page.
- page_offset: int | None =
0¶ provide a specific page to get; if None, get all pages
- lendability: str | None =
None¶ the lendability of the equities; e.g. ‘Easy To Borrow’, ‘Locate Required’, ‘Preborrow’
-
field is_fractional_quantity_eligible : bool | None =
- pydantic model tastytrade.instruments.Forex(*, id: int, description: str, streamer_symbol: str, symbol: str, instrument_type: InstrumentType)¶
Bases:
TastytradeDataDataclass that represents a Tastytrade currency pair object. Contains information about the pair and ways to stream it.
Show JSON schema
{ "title": "Forex", "description": "Dataclass that represents a Tastytrade currency pair object. Contains\ninformation about the pair and ways to stream it.", "type": "object", "properties": { "id": { "title": "Id", "type": "integer" }, "description": { "title": "Description", "type": "string" }, "dx-symbol": { "title": "Dx-Symbol", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" } }, "$defs": { "InstrumentType": { "description": "Contains the valid types of instruments and 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": [ "id", "description", "dx-symbol", "symbol", "instrument-type" ] }- Fields:¶
- field instrument_type : InstrumentType [Required] (alias 'instrument-type')¶
- pydantic model tastytrade.instruments.Future(*, instrument_type: InstrumentType, symbol: str)¶
Bases:
TradeableTastytradeDataDataclass that represents a Tastytrade future object. Contains information about the future and methods to fetch futures for symbol(s).
Show JSON schema
{ "title": "Future", "description": "Dataclass that represents a Tastytrade future object. Contains information\nabout the future and methods to fetch futures for symbol(s).", "type": "object", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType", "default": "Future" }, "symbol": { "title": "Symbol", "type": "string" }, "product-code": { "title": "Product-Code", "type": "string" }, "tick-size": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Tick-Size" }, "notional-multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Notional-Multiplier" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "last-trade-date": { "format": "date", "title": "Last-Trade-Date", "type": "string" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "active": { "title": "Active", "type": "boolean" }, "active-month": { "title": "Active-Month", "type": "boolean" }, "next-active-month": { "title": "Next-Active-Month", "type": "boolean" }, "is-closing-only": { "title": "Is-Closing-Only", "type": "boolean" }, "stops-trading-at": { "format": "date-time", "title": "Stops-Trading-At", "type": "string" }, "expires-at": { "format": "date-time", "title": "Expires-At", "type": "string" }, "product-group": { "title": "Product-Group", "type": "string" }, "exchange": { "title": "Exchange", "type": "string" }, "streamer-exchange-code": { "title": "Streamer-Exchange-Code", "type": "string" }, "back-month-first-calendar-symbol": { "title": "Back-Month-First-Calendar-Symbol", "type": "boolean" }, "streamer-symbol": { "default": "", "title": "Streamer-Symbol", "type": "string" }, "closing-only-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Closing-Only-Date" }, "is-tradeable": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Is-Tradeable" }, "future-product": { "anyOf": [ { "$ref": "#/$defs/FutureProduct" }, { "type": "null" } ], "default": null }, "contract-size": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Contract-Size" }, "main-fraction": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Main-Fraction" }, "sub-fraction": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Sub-Fraction" }, "first-notice-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "First-Notice-Date" }, "roll-target-symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Roll-Target-Symbol" }, "true-underlying-symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "True-Underlying-Symbol" }, "future-etf-equivalent": { "anyOf": [ { "$ref": "#/$defs/FutureEtfEquivalent" }, { "type": "null" } ], "default": null }, "tick-sizes": { "anyOf": [ { "items": { "$ref": "#/$defs/TickSize" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Tick-Sizes" }, "option-tick-sizes": { "anyOf": [ { "items": { "$ref": "#/$defs/TickSize" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Option-Tick-Sizes" }, "spread-tick-sizes": { "anyOf": [ { "items": { "$ref": "#/$defs/TickSize" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Spread-Tick-Sizes" } }, "$defs": { "FutureEtfEquivalent": { "description": "Dataclass that represents the ETF equivalent for a future (aka, the number\nof shares of the ETF that are equivalent to one future, leverage-wise).", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "share-quantity": { "title": "Share-Quantity", "type": "integer" } }, "required": [ "symbol", "share-quantity" ], "title": "FutureEtfEquivalent", "type": "object" }, "FutureMonthCode": { "description": "Contains the valid month codes for futures.\n\nThis is really here for reference, as the API barely uses these codes.", "enum": [ "F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z" ], "title": "FutureMonthCode", "type": "string" }, "FutureOptionProduct": { "description": "Dataclass that represents a Tastytrade future option product object.\nContains information about the future option product (deliverable for\nthe future option).", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "code": { "title": "Code", "type": "string" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "exchange": { "title": "Exchange", "type": "string" }, "product-type": { "title": "Product-Type", "type": "string" }, "expiration-type": { "title": "Expiration-Type", "type": "string" }, "settlement-delay-days": { "title": "Settlement-Delay-Days", "type": "integer" }, "market-sector": { "title": "Market-Sector", "type": "string" }, "clearing-code": { "title": "Clearing-Code", "type": "string" }, "clearing-exchange-code": { "title": "Clearing-Exchange-Code", "type": "string" }, "clearing-price-multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Clearing-Price-Multiplier" }, "is-rollover": { "title": "Is-Rollover", "type": "boolean" }, "future-product": { "anyOf": [ { "$ref": "#/$defs/FutureProduct" }, { "type": "null" } ], "default": null }, "product-subtype": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Product-Subtype" }, "legacy-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Code" }, "clearport-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clearport-Code" } }, "required": [ "root-symbol", "cash-settled", "code", "display-factor", "exchange", "product-type", "expiration-type", "settlement-delay-days", "market-sector", "clearing-code", "clearing-exchange-code", "clearing-price-multiplier", "is-rollover" ], "title": "FutureOptionProduct", "type": "object" }, "FutureProduct": { "description": "Dataclass that represents a Tastytrade future product object. Contains\ninformation about the future product and a method to fetch one for a\nsymbol.\n\nUseful for fetching general information about a family of futures, without\nknowing the specific expirations or symbols.", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "code": { "title": "Code", "type": "string" }, "description": { "title": "Description", "type": "string" }, "exchange": { "title": "Exchange", "type": "string" }, "product-type": { "title": "Product-Type", "type": "string" }, "listed-months": { "items": { "$ref": "#/$defs/FutureMonthCode" }, "title": "Listed-Months", "type": "array" }, "active-months": { "items": { "$ref": "#/$defs/FutureMonthCode" }, "title": "Active-Months", "type": "array" }, "notional-multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Notional-Multiplier" }, "tick-size": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Tick-Size" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "streamer-exchange-code": { "title": "Streamer-Exchange-Code", "type": "string" }, "small-notional": { "title": "Small-Notional", "type": "boolean" }, "back-month-first-calendar-symbol": { "title": "Back-Month-First-Calendar-Symbol", "type": "boolean" }, "first-notice": { "title": "First-Notice", "type": "boolean" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "market-sector": { "title": "Market-Sector", "type": "string" }, "clearing-code": { "title": "Clearing-Code", "type": "string" }, "clearing-exchange-code": { "title": "Clearing-Exchange-Code", "type": "string" }, "roll": { "$ref": "#/$defs/Roll" }, "base-tick": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Base-Tick" }, "sub-tick": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Sub-Tick" }, "contract-limit": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Contract-Limit" }, "product-subtype": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Product-Subtype" }, "security-group": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Security-Group" }, "true-underlying-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "True-Underlying-Code" }, "clearport-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clearport-Code" }, "legacy-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Code" }, "legacy-exchange-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Exchange-Code" }, "option-products": { "anyOf": [ { "items": { "$ref": "#/$defs/FutureOptionProduct" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Option-Products" } }, "required": [ "root-symbol", "code", "description", "exchange", "product-type", "listed-months", "active-months", "notional-multiplier", "tick-size", "display-factor", "streamer-exchange-code", "small-notional", "back-month-first-calendar-symbol", "first-notice", "cash-settled", "market-sector", "clearing-code", "clearing-exchange-code", "roll" ], "title": "FutureProduct", "type": "object" }, "InstrumentType": { "description": "Contains the valid types of instruments and 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" }, "Roll": { "description": "Dataclass representing a roll for a future.", "properties": { "name": { "title": "Name", "type": "string" }, "active-count": { "title": "Active-Count", "type": "integer" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "business-days-offset": { "title": "Business-Days-Offset", "type": "integer" }, "first-notice": { "title": "First-Notice", "type": "boolean" } }, "required": [ "name", "active-count", "cash-settled", "business-days-offset", "first-notice" ], "title": "Roll", "type": "object" }, "TickSize": { "description": "Dataclass representing the tick size for an instrument.", "properties": { "value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Value" }, "threshold": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Threshold" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" } }, "required": [ "value" ], "title": "TickSize", "type": "object" } }, "required": [ "symbol", "product-code", "tick-size", "notional-multiplier", "display-factor", "last-trade-date", "expiration-date", "active", "active-month", "next-active-month", "is-closing-only", "stops-trading-at", "expires-at", "product-group", "exchange", "streamer-exchange-code", "back-month-first-calendar-symbol" ] }- Fields:¶
- field back_month_first_calendar_symbol : bool [Required] (alias 'back-month-first-calendar-symbol')¶
-
field future_etf_equivalent : FutureEtfEquivalent | None =
None(alias 'future-etf-equivalent')¶
-
field future_product : FutureProduct | None =
None(alias 'future-product')¶
-
field instrument_type : InstrumentType =
InstrumentType.FUTURE(alias 'instrument-type')¶
- async classmethod get(session: Session, symbols: str) Self¶
-
async classmethod get(session: Session, symbols: Iterable[str] | None =
None, *, product_codes: list[str] | None =None, per_page: int =250, page_offset: int | None =0) list[Self] Returns a list of Future objects from the given symbols or product codes.
- Parameters:¶
- session: Session¶
the session to use for the request.
- symbols: str¶
- symbols: Iterable[str] | None =
None symbol(s) of the futures, e.g. ‘ESZ9’, ‘/ESZ9’.
- product_codes: list[str] | None =
None the product codes of the futures, e.g. ‘ES’, ‘6A’. Ignored if symbols are provided.
- per_page: int =
250 the number of options to get per page.
- page_offset: int | None =
0 provide a specific page to get; if None, get all pages
- pydantic model tastytrade.instruments.FutureEtfEquivalent(*, symbol: str, share_quantity: int)¶
Bases:
TastytradeDataDataclass that represents the ETF equivalent for a future (aka, the number of shares of the ETF that are equivalent to one future, leverage-wise).
Show JSON schema
{ "title": "FutureEtfEquivalent", "description": "Dataclass that represents the ETF equivalent for a future (aka, the number\nof shares of the ETF that are equivalent to one future, leverage-wise).", "type": "object", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "share-quantity": { "title": "Share-Quantity", "type": "integer" } }, "required": [ "symbol", "share-quantity" ] }- Fields:¶
- class tastytrade.instruments.FutureMonthCode(value)¶
Bases:
StrEnumContains the valid month codes for futures.
This is really here for reference, as the API barely uses these codes.
-
APR =
'J'¶
-
AUG =
'Q'¶
-
DEC =
'Z'¶
-
FEB =
'G'¶
-
JAN =
'F'¶
-
JUL =
'N'¶
-
JUN =
'M'¶
-
MAR =
'H'¶
-
MAY =
'K'¶
-
NOV =
'X'¶
-
OCT =
'V'¶
-
SEP =
'U'¶
-
APR =
-
pydantic model tastytrade.instruments.FutureOption(*, instrument_type: InstrumentType =
InstrumentType.FUTURE_OPTION, symbol: str, underlying_symbol: str, product_code: str, expiration_date: date, root_symbol: str, option_root_symbol: str, strike_price: Decimal, exchange: str, streamer_symbol: str, option_type: OptionType, exercise_style: str, is_vanilla: bool, is_primary_deliverable: bool, future_price_ratio: Decimal, multiplier: Decimal, underlying_count: Decimal, is_confirmed: bool, notional_value: Decimal, display_factor: Decimal, settlement_type: str, strike_factor: Decimal, maturity_date: date, is_exercisable_weekly: bool, last_trade_time: str, days_to_expiration: int, is_closing_only: bool, active: bool, stops_trading_at: datetime, expires_at: datetime, exchange_symbol: str, security_exchange: str, sx_id: str, future_option_product: FutureOptionProduct | None =None)¶ Bases:
TradeableTastytradeDataDataclass that represents a Tastytrade future option object. Contains information about the future option, and methods to get future options.
Show JSON schema
{ "title": "FutureOption", "description": "Dataclass that represents a Tastytrade future option object. Contains\ninformation about the future option, and methods to get future options.", "type": "object", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType", "default": "Future Option" }, "symbol": { "title": "Symbol", "type": "string" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "product-code": { "title": "Product-Code", "type": "string" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "root-symbol": { "title": "Root-Symbol", "type": "string" }, "option-root-symbol": { "title": "Option-Root-Symbol", "type": "string" }, "strike-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Price" }, "exchange": { "title": "Exchange", "type": "string" }, "streamer-symbol": { "title": "Streamer-Symbol", "type": "string" }, "option-type": { "$ref": "#/$defs/OptionType" }, "exercise-style": { "title": "Exercise-Style", "type": "string" }, "is-vanilla": { "title": "Is-Vanilla", "type": "boolean" }, "is-primary-deliverable": { "title": "Is-Primary-Deliverable", "type": "boolean" }, "future-price-ratio": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Future-Price-Ratio" }, "multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Multiplier" }, "underlying-count": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Underlying-Count" }, "is-confirmed": { "title": "Is-Confirmed", "type": "boolean" }, "notional-value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Notional-Value" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "settlement-type": { "title": "Settlement-Type", "type": "string" }, "strike-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Factor" }, "maturity-date": { "format": "date", "title": "Maturity-Date", "type": "string" }, "is-exercisable-weekly": { "title": "Is-Exercisable-Weekly", "type": "boolean" }, "last-trade-time": { "title": "Last-Trade-Time", "type": "string" }, "days-to-expiration": { "title": "Days-To-Expiration", "type": "integer" }, "is-closing-only": { "title": "Is-Closing-Only", "type": "boolean" }, "active": { "title": "Active", "type": "boolean" }, "stops-trading-at": { "format": "date-time", "title": "Stops-Trading-At", "type": "string" }, "expires-at": { "format": "date-time", "title": "Expires-At", "type": "string" }, "exchange-symbol": { "title": "Exchange-Symbol", "type": "string" }, "security-exchange": { "title": "Security-Exchange", "type": "string" }, "sx-id": { "title": "Sx-Id", "type": "string" }, "future-option-product": { "anyOf": [ { "$ref": "#/$defs/FutureOptionProduct" }, { "type": "null" } ], "default": null } }, "$defs": { "FutureMonthCode": { "description": "Contains the valid month codes for futures.\n\nThis is really here for reference, as the API barely uses these codes.", "enum": [ "F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z" ], "title": "FutureMonthCode", "type": "string" }, "FutureOptionProduct": { "description": "Dataclass that represents a Tastytrade future option product object.\nContains information about the future option product (deliverable for\nthe future option).", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "code": { "title": "Code", "type": "string" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "exchange": { "title": "Exchange", "type": "string" }, "product-type": { "title": "Product-Type", "type": "string" }, "expiration-type": { "title": "Expiration-Type", "type": "string" }, "settlement-delay-days": { "title": "Settlement-Delay-Days", "type": "integer" }, "market-sector": { "title": "Market-Sector", "type": "string" }, "clearing-code": { "title": "Clearing-Code", "type": "string" }, "clearing-exchange-code": { "title": "Clearing-Exchange-Code", "type": "string" }, "clearing-price-multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Clearing-Price-Multiplier" }, "is-rollover": { "title": "Is-Rollover", "type": "boolean" }, "future-product": { "anyOf": [ { "$ref": "#/$defs/FutureProduct" }, { "type": "null" } ], "default": null }, "product-subtype": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Product-Subtype" }, "legacy-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Code" }, "clearport-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clearport-Code" } }, "required": [ "root-symbol", "cash-settled", "code", "display-factor", "exchange", "product-type", "expiration-type", "settlement-delay-days", "market-sector", "clearing-code", "clearing-exchange-code", "clearing-price-multiplier", "is-rollover" ], "title": "FutureOptionProduct", "type": "object" }, "FutureProduct": { "description": "Dataclass that represents a Tastytrade future product object. Contains\ninformation about the future product and a method to fetch one for a\nsymbol.\n\nUseful for fetching general information about a family of futures, without\nknowing the specific expirations or symbols.", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "code": { "title": "Code", "type": "string" }, "description": { "title": "Description", "type": "string" }, "exchange": { "title": "Exchange", "type": "string" }, "product-type": { "title": "Product-Type", "type": "string" }, "listed-months": { "items": { "$ref": "#/$defs/FutureMonthCode" }, "title": "Listed-Months", "type": "array" }, "active-months": { "items": { "$ref": "#/$defs/FutureMonthCode" }, "title": "Active-Months", "type": "array" }, "notional-multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Notional-Multiplier" }, "tick-size": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Tick-Size" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "streamer-exchange-code": { "title": "Streamer-Exchange-Code", "type": "string" }, "small-notional": { "title": "Small-Notional", "type": "boolean" }, "back-month-first-calendar-symbol": { "title": "Back-Month-First-Calendar-Symbol", "type": "boolean" }, "first-notice": { "title": "First-Notice", "type": "boolean" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "market-sector": { "title": "Market-Sector", "type": "string" }, "clearing-code": { "title": "Clearing-Code", "type": "string" }, "clearing-exchange-code": { "title": "Clearing-Exchange-Code", "type": "string" }, "roll": { "$ref": "#/$defs/Roll" }, "base-tick": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Base-Tick" }, "sub-tick": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Sub-Tick" }, "contract-limit": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Contract-Limit" }, "product-subtype": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Product-Subtype" }, "security-group": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Security-Group" }, "true-underlying-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "True-Underlying-Code" }, "clearport-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clearport-Code" }, "legacy-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Code" }, "legacy-exchange-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Exchange-Code" }, "option-products": { "anyOf": [ { "items": { "$ref": "#/$defs/FutureOptionProduct" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Option-Products" } }, "required": [ "root-symbol", "code", "description", "exchange", "product-type", "listed-months", "active-months", "notional-multiplier", "tick-size", "display-factor", "streamer-exchange-code", "small-notional", "back-month-first-calendar-symbol", "first-notice", "cash-settled", "market-sector", "clearing-code", "clearing-exchange-code", "roll" ], "title": "FutureProduct", "type": "object" }, "InstrumentType": { "description": "Contains the valid types of instruments and 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" }, "OptionType": { "description": "Contains the valid types of options and their abbreviations in the API.", "enum": [ "C", "P" ], "title": "OptionType", "type": "string" }, "Roll": { "description": "Dataclass representing a roll for a future.", "properties": { "name": { "title": "Name", "type": "string" }, "active-count": { "title": "Active-Count", "type": "integer" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "business-days-offset": { "title": "Business-Days-Offset", "type": "integer" }, "first-notice": { "title": "First-Notice", "type": "boolean" } }, "required": [ "name", "active-count", "cash-settled", "business-days-offset", "first-notice" ], "title": "Roll", "type": "object" } }, "required": [ "symbol", "underlying-symbol", "product-code", "expiration-date", "root-symbol", "option-root-symbol", "strike-price", "exchange", "streamer-symbol", "option-type", "exercise-style", "is-vanilla", "is-primary-deliverable", "future-price-ratio", "multiplier", "underlying-count", "is-confirmed", "notional-value", "display-factor", "settlement-type", "strike-factor", "maturity-date", "is-exercisable-weekly", "last-trade-time", "days-to-expiration", "is-closing-only", "active", "stops-trading-at", "expires-at", "exchange-symbol", "security-exchange", "sx-id" ] }- Fields:¶
- Validators:¶
-
field future_option_product : FutureOptionProduct | None =
None(alias 'future-option-product')¶
-
field instrument_type : InstrumentType =
InstrumentType.FUTURE_OPTION(alias 'instrument-type')¶
- field option_type : OptionType [Required] (alias 'option-type')¶
- async classmethod get(session: Session, symbol: str) Self¶
Returns a FutureOption object corresponding to the given symbol.
- validator parse_date_with_utc » maturity_date¶
-
pydantic model tastytrade.instruments.FutureOptionProduct(*, root_symbol: str, cash_settled: bool, code: str, display_factor: Decimal, exchange: str, product_type: str, expiration_type: str, settlement_delay_days: int, market_sector: str, clearing_code: str, clearing_exchange_code: str, clearing_price_multiplier: Decimal, is_rollover: bool, future_product: FutureProduct | None =
None, product_subtype: str | None =None, legacy_code: str | None =None, clearport_code: str | None =None)¶ Bases:
TastytradeDataDataclass that represents a Tastytrade future option product object. Contains information about the future option product (deliverable for the future option).
Show JSON schema
{ "$defs": { "FutureMonthCode": { "description": "Contains the valid month codes for futures.\n\nThis is really here for reference, as the API barely uses these codes.", "enum": [ "F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z" ], "title": "FutureMonthCode", "type": "string" }, "FutureOptionProduct": { "description": "Dataclass that represents a Tastytrade future option product object.\nContains information about the future option product (deliverable for\nthe future option).", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "code": { "title": "Code", "type": "string" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "exchange": { "title": "Exchange", "type": "string" }, "product-type": { "title": "Product-Type", "type": "string" }, "expiration-type": { "title": "Expiration-Type", "type": "string" }, "settlement-delay-days": { "title": "Settlement-Delay-Days", "type": "integer" }, "market-sector": { "title": "Market-Sector", "type": "string" }, "clearing-code": { "title": "Clearing-Code", "type": "string" }, "clearing-exchange-code": { "title": "Clearing-Exchange-Code", "type": "string" }, "clearing-price-multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Clearing-Price-Multiplier" }, "is-rollover": { "title": "Is-Rollover", "type": "boolean" }, "future-product": { "anyOf": [ { "$ref": "#/$defs/FutureProduct" }, { "type": "null" } ], "default": null }, "product-subtype": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Product-Subtype" }, "legacy-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Code" }, "clearport-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clearport-Code" } }, "required": [ "root-symbol", "cash-settled", "code", "display-factor", "exchange", "product-type", "expiration-type", "settlement-delay-days", "market-sector", "clearing-code", "clearing-exchange-code", "clearing-price-multiplier", "is-rollover" ], "title": "FutureOptionProduct", "type": "object" }, "FutureProduct": { "description": "Dataclass that represents a Tastytrade future product object. Contains\ninformation about the future product and a method to fetch one for a\nsymbol.\n\nUseful for fetching general information about a family of futures, without\nknowing the specific expirations or symbols.", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "code": { "title": "Code", "type": "string" }, "description": { "title": "Description", "type": "string" }, "exchange": { "title": "Exchange", "type": "string" }, "product-type": { "title": "Product-Type", "type": "string" }, "listed-months": { "items": { "$ref": "#/$defs/FutureMonthCode" }, "title": "Listed-Months", "type": "array" }, "active-months": { "items": { "$ref": "#/$defs/FutureMonthCode" }, "title": "Active-Months", "type": "array" }, "notional-multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Notional-Multiplier" }, "tick-size": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Tick-Size" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "streamer-exchange-code": { "title": "Streamer-Exchange-Code", "type": "string" }, "small-notional": { "title": "Small-Notional", "type": "boolean" }, "back-month-first-calendar-symbol": { "title": "Back-Month-First-Calendar-Symbol", "type": "boolean" }, "first-notice": { "title": "First-Notice", "type": "boolean" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "market-sector": { "title": "Market-Sector", "type": "string" }, "clearing-code": { "title": "Clearing-Code", "type": "string" }, "clearing-exchange-code": { "title": "Clearing-Exchange-Code", "type": "string" }, "roll": { "$ref": "#/$defs/Roll" }, "base-tick": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Base-Tick" }, "sub-tick": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Sub-Tick" }, "contract-limit": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Contract-Limit" }, "product-subtype": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Product-Subtype" }, "security-group": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Security-Group" }, "true-underlying-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "True-Underlying-Code" }, "clearport-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clearport-Code" }, "legacy-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Code" }, "legacy-exchange-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Exchange-Code" }, "option-products": { "anyOf": [ { "items": { "$ref": "#/$defs/FutureOptionProduct" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Option-Products" } }, "required": [ "root-symbol", "code", "description", "exchange", "product-type", "listed-months", "active-months", "notional-multiplier", "tick-size", "display-factor", "streamer-exchange-code", "small-notional", "back-month-first-calendar-symbol", "first-notice", "cash-settled", "market-sector", "clearing-code", "clearing-exchange-code", "roll" ], "title": "FutureProduct", "type": "object" }, "Roll": { "description": "Dataclass representing a roll for a future.", "properties": { "name": { "title": "Name", "type": "string" }, "active-count": { "title": "Active-Count", "type": "integer" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "business-days-offset": { "title": "Business-Days-Offset", "type": "integer" }, "first-notice": { "title": "First-Notice", "type": "boolean" } }, "required": [ "name", "active-count", "cash-settled", "business-days-offset", "first-notice" ], "title": "Roll", "type": "object" } }, "$ref": "#/$defs/FutureOptionProduct" }-
field future_product : FutureProduct | None =
None(alias 'future-product')¶
-
field future_product : FutureProduct | None =
-
pydantic model tastytrade.instruments.FutureProduct(*, root_symbol: str, code: str, description: str, exchange: str, product_type: str, listed_months: list[FutureMonthCode], active_months: list[FutureMonthCode], notional_multiplier: Decimal, tick_size: Decimal, display_factor: Decimal, streamer_exchange_code: str, small_notional: bool, back_month_first_calendar_symbol: bool, first_notice: bool, cash_settled: bool, market_sector: str, clearing_code: str, clearing_exchange_code: str, roll: Roll, base_tick: int | None =
None, sub_tick: int | None =None, contract_limit: int | None =None, product_subtype: str | None =None, security_group: str | None =None, true_underlying_code: str | None =None, clearport_code: str | None =None, legacy_code: str | None =None, legacy_exchange_code: str | None =None, option_products: list[FutureOptionProduct] | None =None)¶ Bases:
TastytradeDataDataclass that represents a Tastytrade future product object. Contains information about the future product and a method to fetch one for a symbol.
Useful for fetching general information about a family of futures, without knowing the specific expirations or symbols.
Show JSON schema
{ "$defs": { "FutureMonthCode": { "description": "Contains the valid month codes for futures.\n\nThis is really here for reference, as the API barely uses these codes.", "enum": [ "F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z" ], "title": "FutureMonthCode", "type": "string" }, "FutureOptionProduct": { "description": "Dataclass that represents a Tastytrade future option product object.\nContains information about the future option product (deliverable for\nthe future option).", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "code": { "title": "Code", "type": "string" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "exchange": { "title": "Exchange", "type": "string" }, "product-type": { "title": "Product-Type", "type": "string" }, "expiration-type": { "title": "Expiration-Type", "type": "string" }, "settlement-delay-days": { "title": "Settlement-Delay-Days", "type": "integer" }, "market-sector": { "title": "Market-Sector", "type": "string" }, "clearing-code": { "title": "Clearing-Code", "type": "string" }, "clearing-exchange-code": { "title": "Clearing-Exchange-Code", "type": "string" }, "clearing-price-multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Clearing-Price-Multiplier" }, "is-rollover": { "title": "Is-Rollover", "type": "boolean" }, "future-product": { "anyOf": [ { "$ref": "#/$defs/FutureProduct" }, { "type": "null" } ], "default": null }, "product-subtype": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Product-Subtype" }, "legacy-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Code" }, "clearport-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clearport-Code" } }, "required": [ "root-symbol", "cash-settled", "code", "display-factor", "exchange", "product-type", "expiration-type", "settlement-delay-days", "market-sector", "clearing-code", "clearing-exchange-code", "clearing-price-multiplier", "is-rollover" ], "title": "FutureOptionProduct", "type": "object" }, "FutureProduct": { "description": "Dataclass that represents a Tastytrade future product object. Contains\ninformation about the future product and a method to fetch one for a\nsymbol.\n\nUseful for fetching general information about a family of futures, without\nknowing the specific expirations or symbols.", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "code": { "title": "Code", "type": "string" }, "description": { "title": "Description", "type": "string" }, "exchange": { "title": "Exchange", "type": "string" }, "product-type": { "title": "Product-Type", "type": "string" }, "listed-months": { "items": { "$ref": "#/$defs/FutureMonthCode" }, "title": "Listed-Months", "type": "array" }, "active-months": { "items": { "$ref": "#/$defs/FutureMonthCode" }, "title": "Active-Months", "type": "array" }, "notional-multiplier": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Notional-Multiplier" }, "tick-size": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Tick-Size" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "streamer-exchange-code": { "title": "Streamer-Exchange-Code", "type": "string" }, "small-notional": { "title": "Small-Notional", "type": "boolean" }, "back-month-first-calendar-symbol": { "title": "Back-Month-First-Calendar-Symbol", "type": "boolean" }, "first-notice": { "title": "First-Notice", "type": "boolean" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "market-sector": { "title": "Market-Sector", "type": "string" }, "clearing-code": { "title": "Clearing-Code", "type": "string" }, "clearing-exchange-code": { "title": "Clearing-Exchange-Code", "type": "string" }, "roll": { "$ref": "#/$defs/Roll" }, "base-tick": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Base-Tick" }, "sub-tick": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Sub-Tick" }, "contract-limit": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Contract-Limit" }, "product-subtype": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Product-Subtype" }, "security-group": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Security-Group" }, "true-underlying-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "True-Underlying-Code" }, "clearport-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Clearport-Code" }, "legacy-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Code" }, "legacy-exchange-code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Legacy-Exchange-Code" }, "option-products": { "anyOf": [ { "items": { "$ref": "#/$defs/FutureOptionProduct" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Option-Products" } }, "required": [ "root-symbol", "code", "description", "exchange", "product-type", "listed-months", "active-months", "notional-multiplier", "tick-size", "display-factor", "streamer-exchange-code", "small-notional", "back-month-first-calendar-symbol", "first-notice", "cash-settled", "market-sector", "clearing-code", "clearing-exchange-code", "roll" ], "title": "FutureProduct", "type": "object" }, "Roll": { "description": "Dataclass representing a roll for a future.", "properties": { "name": { "title": "Name", "type": "string" }, "active-count": { "title": "Active-Count", "type": "integer" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "business-days-offset": { "title": "Business-Days-Offset", "type": "integer" }, "first-notice": { "title": "First-Notice", "type": "boolean" } }, "required": [ "name", "active-count", "cash-settled", "business-days-offset", "first-notice" ], "title": "Roll", "type": "object" } }, "$ref": "#/$defs/FutureProduct" }- Fields:¶
- field active_months : list[FutureMonthCode] [Required] (alias 'active-months')¶
- field back_month_first_calendar_symbol : bool [Required] (alias 'back-month-first-calendar-symbol')¶
- field listed_months : list[FutureMonthCode] [Required] (alias 'listed-months')¶
-
field option_products : list[FutureOptionProduct] | None =
None(alias 'option-products')¶
- pydantic model tastytrade.instruments.NestedFutureOptionChain(*, futures: list[NestedFutureOptionFuture], option_chains: list[NestedFutureOptionSubchain])¶
Bases:
TastytradeDataDataclass that represents a Tastytrade nested option chain object. Contains information about the option chain and a method to fetch one for a symbol.
This is cleaner than calling
get_future_option_chain()but if you want to create actualFutureOptionobjects you’ll need to make an extra API request or two.Show JSON schema
{ "title": "NestedFutureOptionChain", "description": "Dataclass that represents a Tastytrade nested option chain object. Contains\ninformation about the option chain and a method to fetch one for a symbol.\n\nThis is cleaner than calling :meth:`get_future_option_chain` but if you\nwant to create actual :class:`FutureOption` objects you'll need to make an\nextra API request or two.", "type": "object", "properties": { "futures": { "items": { "$ref": "#/$defs/NestedFutureOptionFuture" }, "title": "Futures", "type": "array" }, "option-chains": { "items": { "$ref": "#/$defs/NestedFutureOptionSubchain" }, "title": "Option-Chains", "type": "array" } }, "$defs": { "NestedFutureOptionChainExpiration": { "description": "Dataclass representing an expiration in a nested future options chain.", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "notional-value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Notional-Value" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "strike-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Factor" }, "days-to-expiration": { "title": "Days-To-Expiration", "type": "integer" }, "option-root-symbol": { "title": "Option-Root-Symbol", "type": "string" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "expires-at": { "format": "date-time", "title": "Expires-At", "type": "string" }, "asset": { "title": "Asset", "type": "string" }, "expiration-type": { "title": "Expiration-Type", "type": "string" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "option-contract-symbol": { "title": "Option-Contract-Symbol", "type": "string" }, "stops-trading-at": { "format": "date-time", "title": "Stops-Trading-At", "type": "string" }, "settlement-type": { "title": "Settlement-Type", "type": "string" }, "strikes": { "items": { "$ref": "#/$defs/Strike" }, "title": "Strikes", "type": "array" }, "tick-sizes": { "items": { "$ref": "#/$defs/TickSize" }, "title": "Tick-Sizes", "type": "array" } }, "required": [ "root-symbol", "notional-value", "underlying-symbol", "strike-factor", "days-to-expiration", "option-root-symbol", "expiration-date", "expires-at", "asset", "expiration-type", "display-factor", "option-contract-symbol", "stops-trading-at", "settlement-type", "strikes", "tick-sizes" ], "title": "NestedFutureOptionChainExpiration", "type": "object" }, "NestedFutureOptionFuture": { "description": "Dataclass representing an underlying future in a nested future options\nchain.", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "days-to-expiration": { "title": "Days-To-Expiration", "type": "integer" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "expires-at": { "format": "date-time", "title": "Expires-At", "type": "string" }, "next-active-month": { "title": "Next-Active-Month", "type": "boolean" }, "symbol": { "title": "Symbol", "type": "string" }, "active-month": { "title": "Active-Month", "type": "boolean" }, "stops-trading-at": { "format": "date-time", "title": "Stops-Trading-At", "type": "string" }, "maturity-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Maturity-Date" } }, "required": [ "root-symbol", "days-to-expiration", "expiration-date", "expires-at", "next-active-month", "symbol", "active-month", "stops-trading-at" ], "title": "NestedFutureOptionFuture", "type": "object" }, "NestedFutureOptionSubchain": { "description": "Dataclass that represents a Tastytrade nested future option chain for a\nspecific futures underlying symbol.", "properties": { "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "root-symbol": { "title": "Root-Symbol", "type": "string" }, "exercise-style": { "title": "Exercise-Style", "type": "string" }, "expirations": { "items": { "$ref": "#/$defs/NestedFutureOptionChainExpiration" }, "title": "Expirations", "type": "array" } }, "required": [ "underlying-symbol", "root-symbol", "exercise-style", "expirations" ], "title": "NestedFutureOptionSubchain", "type": "object" }, "Strike": { "description": "Dataclass representing a specific strike in an options chain, containing\nthe symbols for the call and put options.", "properties": { "strike-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Price" }, "call": { "title": "Call", "type": "string" }, "put": { "title": "Put", "type": "string" }, "call-streamer-symbol": { "title": "Call-Streamer-Symbol", "type": "string" }, "put-streamer-symbol": { "title": "Put-Streamer-Symbol", "type": "string" } }, "required": [ "strike-price", "call", "put", "call-streamer-symbol", "put-streamer-symbol" ], "title": "Strike", "type": "object" }, "TickSize": { "description": "Dataclass representing the tick size for an instrument.", "properties": { "value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Value" }, "threshold": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Threshold" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" } }, "required": [ "value" ], "title": "TickSize", "type": "object" } }, "required": [ "futures", "option-chains" ] }- Fields:¶
- field futures : list[NestedFutureOptionFuture] [Required]¶
- field option_chains : list[NestedFutureOptionSubchain] [Required] (alias 'option-chains')¶
- pydantic model tastytrade.instruments.NestedFutureOptionChainExpiration(*, root_symbol: str, notional_value: Decimal, underlying_symbol: str, strike_factor: Decimal, days_to_expiration: int, option_root_symbol: str, expiration_date: date, expires_at: datetime, asset: str, expiration_type: str, display_factor: Decimal, option_contract_symbol: str, stops_trading_at: datetime, settlement_type: str, strikes: list[Strike], tick_sizes: list[TickSize])¶
Bases:
TastytradeDataDataclass representing an expiration in a nested future options chain.
Show JSON schema
{ "title": "NestedFutureOptionChainExpiration", "description": "Dataclass representing an expiration in a nested future options chain.", "type": "object", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "notional-value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Notional-Value" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "strike-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Factor" }, "days-to-expiration": { "title": "Days-To-Expiration", "type": "integer" }, "option-root-symbol": { "title": "Option-Root-Symbol", "type": "string" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "expires-at": { "format": "date-time", "title": "Expires-At", "type": "string" }, "asset": { "title": "Asset", "type": "string" }, "expiration-type": { "title": "Expiration-Type", "type": "string" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "option-contract-symbol": { "title": "Option-Contract-Symbol", "type": "string" }, "stops-trading-at": { "format": "date-time", "title": "Stops-Trading-At", "type": "string" }, "settlement-type": { "title": "Settlement-Type", "type": "string" }, "strikes": { "items": { "$ref": "#/$defs/Strike" }, "title": "Strikes", "type": "array" }, "tick-sizes": { "items": { "$ref": "#/$defs/TickSize" }, "title": "Tick-Sizes", "type": "array" } }, "$defs": { "Strike": { "description": "Dataclass representing a specific strike in an options chain, containing\nthe symbols for the call and put options.", "properties": { "strike-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Price" }, "call": { "title": "Call", "type": "string" }, "put": { "title": "Put", "type": "string" }, "call-streamer-symbol": { "title": "Call-Streamer-Symbol", "type": "string" }, "put-streamer-symbol": { "title": "Put-Streamer-Symbol", "type": "string" } }, "required": [ "strike-price", "call", "put", "call-streamer-symbol", "put-streamer-symbol" ], "title": "Strike", "type": "object" }, "TickSize": { "description": "Dataclass representing the tick size for an instrument.", "properties": { "value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Value" }, "threshold": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Threshold" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" } }, "required": [ "value" ], "title": "TickSize", "type": "object" } }, "required": [ "root-symbol", "notional-value", "underlying-symbol", "strike-factor", "days-to-expiration", "option-root-symbol", "expiration-date", "expires-at", "asset", "expiration-type", "display-factor", "option-contract-symbol", "stops-trading-at", "settlement-type", "strikes", "tick-sizes" ] }- Fields:¶
-
pydantic model tastytrade.instruments.NestedFutureOptionFuture(*, root_symbol: str, days_to_expiration: int, expiration_date: date, expires_at: datetime, next_active_month: bool, symbol: str, active_month: bool, stops_trading_at: datetime, maturity_date: date | None =
None)¶ Bases:
TastytradeDataDataclass representing an underlying future in a nested future options chain.
Show JSON schema
{ "title": "NestedFutureOptionFuture", "description": "Dataclass representing an underlying future in a nested future options\nchain.", "type": "object", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "days-to-expiration": { "title": "Days-To-Expiration", "type": "integer" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "expires-at": { "format": "date-time", "title": "Expires-At", "type": "string" }, "next-active-month": { "title": "Next-Active-Month", "type": "boolean" }, "symbol": { "title": "Symbol", "type": "string" }, "active-month": { "title": "Active-Month", "type": "boolean" }, "stops-trading-at": { "format": "date-time", "title": "Stops-Trading-At", "type": "string" }, "maturity-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Maturity-Date" } }, "required": [ "root-symbol", "days-to-expiration", "expiration-date", "expires-at", "next-active-month", "symbol", "active-month", "stops-trading-at" ] }- validator parse_date_with_utc » maturity_date¶
- pydantic model tastytrade.instruments.NestedFutureOptionSubchain(*, underlying_symbol: str, root_symbol: str, exercise_style: str, expirations: list[NestedFutureOptionChainExpiration])¶
Bases:
TastytradeDataDataclass that represents a Tastytrade nested future option chain for a specific futures underlying symbol.
Show JSON schema
{ "title": "NestedFutureOptionSubchain", "description": "Dataclass that represents a Tastytrade nested future option chain for a\nspecific futures underlying symbol.", "type": "object", "properties": { "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "root-symbol": { "title": "Root-Symbol", "type": "string" }, "exercise-style": { "title": "Exercise-Style", "type": "string" }, "expirations": { "items": { "$ref": "#/$defs/NestedFutureOptionChainExpiration" }, "title": "Expirations", "type": "array" } }, "$defs": { "NestedFutureOptionChainExpiration": { "description": "Dataclass representing an expiration in a nested future options chain.", "properties": { "root-symbol": { "title": "Root-Symbol", "type": "string" }, "notional-value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Notional-Value" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "strike-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Factor" }, "days-to-expiration": { "title": "Days-To-Expiration", "type": "integer" }, "option-root-symbol": { "title": "Option-Root-Symbol", "type": "string" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "expires-at": { "format": "date-time", "title": "Expires-At", "type": "string" }, "asset": { "title": "Asset", "type": "string" }, "expiration-type": { "title": "Expiration-Type", "type": "string" }, "display-factor": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Display-Factor" }, "option-contract-symbol": { "title": "Option-Contract-Symbol", "type": "string" }, "stops-trading-at": { "format": "date-time", "title": "Stops-Trading-At", "type": "string" }, "settlement-type": { "title": "Settlement-Type", "type": "string" }, "strikes": { "items": { "$ref": "#/$defs/Strike" }, "title": "Strikes", "type": "array" }, "tick-sizes": { "items": { "$ref": "#/$defs/TickSize" }, "title": "Tick-Sizes", "type": "array" } }, "required": [ "root-symbol", "notional-value", "underlying-symbol", "strike-factor", "days-to-expiration", "option-root-symbol", "expiration-date", "expires-at", "asset", "expiration-type", "display-factor", "option-contract-symbol", "stops-trading-at", "settlement-type", "strikes", "tick-sizes" ], "title": "NestedFutureOptionChainExpiration", "type": "object" }, "Strike": { "description": "Dataclass representing a specific strike in an options chain, containing\nthe symbols for the call and put options.", "properties": { "strike-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Price" }, "call": { "title": "Call", "type": "string" }, "put": { "title": "Put", "type": "string" }, "call-streamer-symbol": { "title": "Call-Streamer-Symbol", "type": "string" }, "put-streamer-symbol": { "title": "Put-Streamer-Symbol", "type": "string" } }, "required": [ "strike-price", "call", "put", "call-streamer-symbol", "put-streamer-symbol" ], "title": "Strike", "type": "object" }, "TickSize": { "description": "Dataclass representing the tick size for an instrument.", "properties": { "value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Value" }, "threshold": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Threshold" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" } }, "required": [ "value" ], "title": "TickSize", "type": "object" } }, "required": [ "underlying-symbol", "root-symbol", "exercise-style", "expirations" ] }- Fields:¶
- field expirations : list[NestedFutureOptionChainExpiration] [Required]¶
-
pydantic model tastytrade.instruments.NestedOptionChain(*, underlying_symbol: str, root_symbol: str, option_chain_type: str, shares_per_contract: int, tick_sizes: list[TickSize], expirations: list[NestedOptionChainExpiration], deliverables: list[Deliverable] | None =
None)¶ Bases:
TastytradeDataDataclass that represents a Tastytrade nested option chain object. Contains information about the option chain and a method to fetch one for a symbol.
This is cleaner than calling
get_option_chain()but if you want to create actualOptionobjects you’ll need to make an extra API request or two.Show JSON schema
{ "title": "NestedOptionChain", "description": "Dataclass that represents a Tastytrade nested option chain object.\nContains information about the option chain and a method to fetch one for\na symbol.\n\nThis is cleaner than calling :meth:`get_option_chain` but if you want to\ncreate actual :class:`Option` objects you'll need to make an extra API\nrequest or two.", "type": "object", "properties": { "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "root-symbol": { "title": "Root-Symbol", "type": "string" }, "option-chain-type": { "title": "Option-Chain-Type", "type": "string" }, "shares-per-contract": { "title": "Shares-Per-Contract", "type": "integer" }, "tick-sizes": { "items": { "$ref": "#/$defs/TickSize" }, "title": "Tick-Sizes", "type": "array" }, "expirations": { "items": { "$ref": "#/$defs/NestedOptionChainExpiration" }, "title": "Expirations", "type": "array" }, "deliverables": { "anyOf": [ { "items": { "$ref": "#/$defs/Deliverable" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Deliverables" } }, "$defs": { "Deliverable": { "description": "Dataclass representing the deliverable for an option.", "properties": { "id": { "title": "Id", "type": "integer" }, "root-symbol": { "title": "Root-Symbol", "type": "string" }, "deliverable-type": { "title": "Deliverable-Type", "type": "string" }, "description": { "title": "Description", "type": "string" }, "amount": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Amount" }, "percent": { "title": "Percent", "type": "string" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" }, "instrument-type": { "anyOf": [ { "$ref": "#/$defs/InstrumentType" }, { "type": "null" } ], "default": null } }, "required": [ "id", "root-symbol", "deliverable-type", "description", "amount", "percent" ], "title": "Deliverable", "type": "object" }, "InstrumentType": { "description": "Contains the valid types of instruments and 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" }, "NestedOptionChainExpiration": { "description": "Dataclass representing an expiration in a nested options chain.", "properties": { "expiration-type": { "title": "Expiration-Type", "type": "string" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "days-to-expiration": { "title": "Days-To-Expiration", "type": "integer" }, "settlement-type": { "title": "Settlement-Type", "type": "string" }, "strikes": { "items": { "$ref": "#/$defs/Strike" }, "title": "Strikes", "type": "array" } }, "required": [ "expiration-type", "expiration-date", "days-to-expiration", "settlement-type", "strikes" ], "title": "NestedOptionChainExpiration", "type": "object" }, "Strike": { "description": "Dataclass representing a specific strike in an options chain, containing\nthe symbols for the call and put options.", "properties": { "strike-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Price" }, "call": { "title": "Call", "type": "string" }, "put": { "title": "Put", "type": "string" }, "call-streamer-symbol": { "title": "Call-Streamer-Symbol", "type": "string" }, "put-streamer-symbol": { "title": "Put-Streamer-Symbol", "type": "string" } }, "required": [ "strike-price", "call", "put", "call-streamer-symbol", "put-streamer-symbol" ], "title": "Strike", "type": "object" }, "TickSize": { "description": "Dataclass representing the tick size for an instrument.", "properties": { "value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Value" }, "threshold": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Threshold" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" } }, "required": [ "value" ], "title": "TickSize", "type": "object" } }, "required": [ "underlying-symbol", "root-symbol", "option-chain-type", "shares-per-contract", "tick-sizes", "expirations" ] }- Fields:¶
-
field deliverables : list[Deliverable] | None =
None¶
- field expirations : list[NestedOptionChainExpiration] [Required]¶
- pydantic model tastytrade.instruments.NestedOptionChainExpiration(*, expiration_type: str, expiration_date: date, days_to_expiration: int, settlement_type: str, strikes: list[Strike])¶
Bases:
TastytradeDataDataclass representing an expiration in a nested options chain.
Show JSON schema
{ "title": "NestedOptionChainExpiration", "description": "Dataclass representing an expiration in a nested options chain.", "type": "object", "properties": { "expiration-type": { "title": "Expiration-Type", "type": "string" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "days-to-expiration": { "title": "Days-To-Expiration", "type": "integer" }, "settlement-type": { "title": "Settlement-Type", "type": "string" }, "strikes": { "items": { "$ref": "#/$defs/Strike" }, "title": "Strikes", "type": "array" } }, "$defs": { "Strike": { "description": "Dataclass representing a specific strike in an options chain, containing\nthe symbols for the call and put options.", "properties": { "strike-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Price" }, "call": { "title": "Call", "type": "string" }, "put": { "title": "Put", "type": "string" }, "call-streamer-symbol": { "title": "Call-Streamer-Symbol", "type": "string" }, "put-streamer-symbol": { "title": "Put-Streamer-Symbol", "type": "string" } }, "required": [ "strike-price", "call", "put", "call-streamer-symbol", "put-streamer-symbol" ], "title": "Strike", "type": "object" } }, "required": [ "expiration-type", "expiration-date", "days-to-expiration", "settlement-type", "strikes" ] }- Fields:¶
-
pydantic model tastytrade.instruments.Option(*, instrument_type: InstrumentType, symbol: str, active: bool, strike_price: Decimal, root_symbol: str, underlying_symbol: str, expiration_date: date, exercise_style: str, shares_per_contract: int, option_type: OptionType, option_chain_type: str, expiration_type: str, settlement_type: str, stops_trading_at: datetime, market_time_instrument_collection: str, days_to_expiration: int, is_closing_only: bool, expires_at: datetime | None =
None, streamer_symbol: str ='', listed_market: str | None =None, halted_at: datetime | None =None, old_security_number: str | None =None)¶ Bases:
TradeableTastytradeDataDataclass that represents a Tastytrade option object. Contains information about the option and methods to populate that data using an option symbol.
Show JSON schema
{ "title": "Option", "description": "Dataclass that represents a Tastytrade option object. Contains information\nabout the option and methods to populate that data using an option symbol.", "type": "object", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "active": { "title": "Active", "type": "boolean" }, "strike-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Price" }, "root-symbol": { "title": "Root-Symbol", "type": "string" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "expiration-date": { "format": "date", "title": "Expiration-Date", "type": "string" }, "exercise-style": { "title": "Exercise-Style", "type": "string" }, "shares-per-contract": { "title": "Shares-Per-Contract", "type": "integer" }, "option-type": { "$ref": "#/$defs/OptionType" }, "option-chain-type": { "title": "Option-Chain-Type", "type": "string" }, "expiration-type": { "title": "Expiration-Type", "type": "string" }, "settlement-type": { "title": "Settlement-Type", "type": "string" }, "stops-trading-at": { "format": "date-time", "title": "Stops-Trading-At", "type": "string" }, "market-time-instrument-collection": { "title": "Market-Time-Instrument-Collection", "type": "string" }, "days-to-expiration": { "title": "Days-To-Expiration", "type": "integer" }, "is-closing-only": { "title": "Is-Closing-Only", "type": "boolean" }, "expires-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Expires-At" }, "streamer-symbol": { "default": "", "title": "Streamer-Symbol", "type": "string" }, "listed-market": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Listed-Market" }, "halted-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Halted-At" }, "old-security-number": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Old-Security-Number" } }, "$defs": { "InstrumentType": { "description": "Contains the valid types of instruments and 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" }, "OptionType": { "description": "Contains the valid types of options and their abbreviations in the API.", "enum": [ "C", "P" ], "title": "OptionType", "type": "string" } }, "required": [ "instrument-type", "symbol", "active", "strike-price", "root-symbol", "underlying-symbol", "expiration-date", "exercise-style", "shares-per-contract", "option-type", "option-chain-type", "expiration-type", "settlement-type", "stops-trading-at", "market-time-instrument-collection", "days-to-expiration", "is-closing-only" ] }- Fields:¶
- Validators:¶
set_streamer_symbol»all fields
- field market_time_instrument_collection : str [Required] (alias 'market-time-instrument-collection')¶
- Validated by:¶
- field option_type : OptionType [Required] (alias 'option-type')¶
- Validated by:¶
- async classmethod get(session: Session, symbol: str) Self¶
Returns an Option object corresponding to the given symbol.
- classmethod occ_to_streamer_symbol(occ: str) str¶
Returns the dxfeed symbol for use in the streamer from the given OCC 2010 symbol.
- classmethod streamer_symbol_to_occ(streamer_symbol: str) str¶
Returns the OCC 2010 symbol equivalent to the given streamer symbol.
- validator set_streamer_symbol » all fields¶
- class tastytrade.instruments.OptionType(value)¶
Bases:
StrEnumContains the valid types of options and their abbreviations in the API.
-
CALL =
'C'¶
-
PUT =
'P'¶
-
CALL =
-
pydantic model tastytrade.instruments.QuantityDecimalPrecision(*, instrument_type: InstrumentType, value: int, minimum_increment_precision: int, symbol: str | None =
None)¶ Bases:
TastytradeDataDataclass representing the decimal precision (number of places) for an instrument.
Show JSON schema
{ "title": "QuantityDecimalPrecision", "description": "Dataclass representing the decimal precision (number of places) for an\ninstrument.", "type": "object", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "value": { "title": "Value", "type": "integer" }, "minimum-increment-precision": { "title": "Minimum-Increment-Precision", "type": "integer" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" } }, "$defs": { "InstrumentType": { "description": "Contains the valid types of instruments and 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": [ "instrument-type", "value", "minimum-increment-precision" ] }- Fields:¶
- field instrument_type : InstrumentType [Required] (alias 'instrument-type')¶
- pydantic model tastytrade.instruments.Roll(*, name: str, active_count: int, cash_settled: bool, business_days_offset: int, first_notice: bool)¶
Bases:
TastytradeDataDataclass representing a roll for a future.
Show JSON schema
{ "title": "Roll", "description": "Dataclass representing a roll for a future.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "active-count": { "title": "Active-Count", "type": "integer" }, "cash-settled": { "title": "Cash-Settled", "type": "boolean" }, "business-days-offset": { "title": "Business-Days-Offset", "type": "integer" }, "first-notice": { "title": "First-Notice", "type": "boolean" } }, "required": [ "name", "active-count", "cash-settled", "business-days-offset", "first-notice" ] }- Fields:¶
- pydantic model tastytrade.instruments.Strike(*, strike_price: Decimal, call: str, put: str, call_streamer_symbol: str, put_streamer_symbol: str)¶
Bases:
TastytradeDataDataclass representing a specific strike in an options chain, containing the symbols for the call and put options.
Show JSON schema
{ "title": "Strike", "description": "Dataclass representing a specific strike in an options chain, containing\nthe symbols for the call and put options.", "type": "object", "properties": { "strike-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Strike-Price" }, "call": { "title": "Call", "type": "string" }, "put": { "title": "Put", "type": "string" }, "call-streamer-symbol": { "title": "Call-Streamer-Symbol", "type": "string" }, "put-streamer-symbol": { "title": "Put-Streamer-Symbol", "type": "string" } }, "required": [ "strike-price", "call", "put", "call-streamer-symbol", "put-streamer-symbol" ] }- Fields:¶
-
pydantic model tastytrade.instruments.TickSize(*, value: Decimal, threshold: Decimal | None =
None, symbol: str | None =None)¶ Bases:
TastytradeDataDataclass representing the tick size for an instrument.
Show JSON schema
{ "title": "TickSize", "description": "Dataclass representing the tick size for an instrument.", "type": "object", "properties": { "value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Value" }, "threshold": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Threshold" }, "symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Symbol" } }, "required": [ "value" ] }
-
pydantic model tastytrade.instruments.Warrant(*, symbol: str, instrument_type: InstrumentType, listed_market: str, description: str, is_closing_only: bool, active: bool, cusip: str | None =
None)¶ Bases:
TastytradeDataDataclass that represents a Tastytrade warrant object. Contains information about the warrant, and methods to get warrants.
Show JSON schema
{ "title": "Warrant", "description": "Dataclass that represents a Tastytrade warrant object. Contains\ninformation about the warrant, and methods to get warrants.", "type": "object", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "listed-market": { "title": "Listed-Market", "type": "string" }, "description": { "title": "Description", "type": "string" }, "is-closing-only": { "title": "Is-Closing-Only", "type": "boolean" }, "active": { "title": "Active", "type": "boolean" }, "cusip": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cusip" } }, "$defs": { "InstrumentType": { "description": "Contains the valid types of instruments and 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", "listed-market", "description", "is-closing-only", "active" ] }- Fields:¶
- field instrument_type : InstrumentType [Required] (alias 'instrument-type')¶
- async tastytrade.instruments.get_future_option_chain(session: Session, symbol: str) dict[date, list[FutureOption]]¶
Returns a mapping of expiration date to a list of futures options objects representing the options chain for the given symbol.
In the case that there are two expiries on the same day (e.g. EW and ES options), both will be returned in the same list. If you just want one expiry, you’ll need to filter the list yourself, or use
NestedFutureOptionChaininstead.
- async tastytrade.instruments.get_option_chain(session: Session, symbol: str) dict[date, list[Option]]¶
Returns a mapping of expiration date to a list of option objects representing the options chain for the given symbol.
In the case that there are two expiries on the same day (e.g. SPXW and SPX AM options), both will be returned in the same list. If you just want one expiry, you’ll need to filter the list yourself, or use
NestedOptionChaininstead.