tastytrade.order¶
-
pydantic model tastytrade.order.AdvancedInstructions(*, strict_position_effect_validation: bool =
False)¶ Bases:
TastytradeDataDataclass containing advanced order rules.
Show JSON schema
{ "title": "AdvancedInstructions", "description": "Dataclass containing advanced order rules.", "type": "object", "properties": { "strict-position-effect-validation": { "default": false, "title": "Strict-Position-Effect-Validation", "type": "boolean" } } }
- pydantic model tastytrade.order.BuyingPowerEffect(*, change_in_margin_requirement: Decimal, change_in_buying_power: Decimal, current_buying_power: Decimal, new_buying_power: Decimal, isolated_order_margin_requirement: Decimal, is_spread: bool, impact: Decimal, effect: PriceEffect)¶
Bases:
TastytradeDataDataclass containing information about the effect of a trade on buying power.
Show JSON schema
{ "title": "BuyingPowerEffect", "description": "Dataclass containing information about the effect of a trade on buying\npower.", "type": "object", "properties": { "change-in-margin-requirement": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Change-In-Margin-Requirement" }, "change-in-buying-power": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Change-In-Buying-Power" }, "current-buying-power": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Current-Buying-Power" }, "new-buying-power": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "New-Buying-Power" }, "isolated-order-margin-requirement": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Isolated-Order-Margin-Requirement" }, "is-spread": { "title": "Is-Spread", "type": "boolean" }, "impact": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Impact" }, "effect": { "$ref": "#/$defs/PriceEffect" } }, "$defs": { "PriceEffect": { "description": "This is an :class:`~enum.Enum` that shows the sign of a price effect, since\nTastytrade is apparently against negative numbers.", "enum": [ "Credit", "Debit", "None" ], "title": "PriceEffect", "type": "string" } }, "required": [ "change-in-margin-requirement", "change-in-buying-power", "current-buying-power", "new-buying-power", "isolated-order-margin-requirement", "is-spread", "impact", "effect" ] }
- enum tastytrade.order.ComplexOrderType(value)¶
-
This is an
Enumthat contains the valid complex order types.Valid values are as follows:
-
OCO =
<ComplexOrderType.OCO: 'OCO'>¶
-
OTOCO =
<ComplexOrderType.OTOCO: 'OTOCO'>¶
-
OCO =
-
pydantic model tastytrade.order.ComputedData(*, open: bool, updated_at: datetime, total_fees: Decimal, total_commissions: Decimal, realized_gain: Decimal, realized_gain_with_fees: Decimal, winner_realized_and_closed: bool, winner_realized: bool, winner_realized_with_fees: bool, roll_count: int, opened_at: datetime, last_occurred_at: datetime, started_at_days_to_expiration: int, duration: int, total_opening_cost: Decimal, total_closing_cost: Decimal, total_cost: Decimal, gcd_open_quantity: Decimal, fees_missing: bool, open_entries: list[OrderChainEntry], total_cost_per_unit: Decimal | None =
None)¶ Bases:
TastytradeDataDataclass containing computed data about an order chain.
Show JSON schema
{ "title": "ComputedData", "description": "Dataclass containing computed data about an order chain.", "type": "object", "properties": { "open": { "title": "Open", "type": "boolean" }, "updated-at": { "format": "date-time", "title": "Updated-At", "type": "string" }, "total-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Fees" }, "total-commissions": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Commissions" }, "realized-gain": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Realized-Gain" }, "realized-gain-with-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Realized-Gain-With-Fees" }, "winner-realized-and-closed": { "title": "Winner-Realized-And-Closed", "type": "boolean" }, "winner-realized": { "title": "Winner-Realized", "type": "boolean" }, "winner-realized-with-fees": { "title": "Winner-Realized-With-Fees", "type": "boolean" }, "roll-count": { "title": "Roll-Count", "type": "integer" }, "opened-at": { "format": "date-time", "title": "Opened-At", "type": "string" }, "last-occurred-at": { "format": "date-time", "title": "Last-Occurred-At", "type": "string" }, "started-at-days-to-expiration": { "title": "Started-At-Days-To-Expiration", "type": "integer" }, "duration": { "title": "Duration", "type": "integer" }, "total-opening-cost": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Opening-Cost" }, "total-closing-cost": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Closing-Cost" }, "total-cost": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Cost" }, "gcd-open-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Gcd-Open-Quantity" }, "fees-missing": { "title": "Fees-Missing", "type": "boolean" }, "open-entries": { "items": { "$ref": "#/$defs/OrderChainEntry" }, "title": "Open-Entries", "type": "array" }, "total-cost-per-unit": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Total-Cost-Per-Unit" } }, "$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" }, "OrderChainEntry": { "description": "Dataclass containing information about a single order in an order chain.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "title": "Quantity", "type": "string" }, "quantity-type": { "title": "Quantity-Type", "type": "string" }, "quantity-numeric": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity-Numeric" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-type", "quantity-numeric" ], "title": "OrderChainEntry", "type": "object" } }, "required": [ "open", "updated-at", "total-fees", "total-commissions", "realized-gain", "realized-gain-with-fees", "winner-realized-and-closed", "winner-realized", "winner-realized-with-fees", "roll-count", "opened-at", "last-occurred-at", "started-at-days-to-expiration", "duration", "total-opening-cost", "total-closing-cost", "total-cost", "gcd-open-quantity", "fees-missing", "open-entries" ] }
- pydantic model tastytrade.order.FeeCalculation(*, regulatory_fees: Decimal, clearing_fees: Decimal, commission: Decimal, proprietary_index_option_fees: Decimal, total_fees: Decimal)¶
Bases:
TastytradeDataDataclass containing information about the fees associated with a trade.
Show JSON schema
{ "title": "FeeCalculation", "description": "Dataclass containing information about the fees associated with a trade.", "type": "object", "properties": { "regulatory-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Regulatory-Fees" }, "clearing-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Clearing-Fees" }, "commission": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Commission" }, "proprietary-index-option-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Proprietary-Index-Option-Fees" }, "total-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Fees" } }, "required": [ "regulatory-fees", "clearing-fees", "commission", "proprietary-index-option-fees", "total-fees" ] }
-
pydantic model tastytrade.order.FillInfo(*, fill_id: str, quantity: Decimal, fill_price: Decimal, filled_at: datetime, destination_venue: str | None =
None, ext_group_fill_id: str | None =None, ext_exec_id: str | None =None)¶ Bases:
TastytradeDataDataclass that contains information about an order fill.
Show JSON schema
{ "title": "FillInfo", "description": "Dataclass that contains information about an order fill.", "type": "object", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Price" }, "filled-at": { "format": "date-time", "title": "Filled-At", "type": "string" }, "destination-venue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Destination-Venue" }, "ext-group-fill-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Group-Fill-Id" }, "ext-exec-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Exec-Id" } }, "required": [ "fill-id", "quantity", "fill-price", "filled-at" ] }
- enum tastytrade.order.InstrumentType(value)¶
-
This is an
Enumthat contains the valid types of instruments and their representation in the API.Valid values are as follows:
-
BOND =
<InstrumentType.BOND: 'Bond'>¶
-
CRYPTOCURRENCY =
<InstrumentType.CRYPTOCURRENCY: 'Cryptocurrency'>¶
-
CURRENCY_PAIR =
<InstrumentType.CURRENCY_PAIR: 'Currency Pair'>¶
-
EQUITY =
<InstrumentType.EQUITY: 'Equity'>¶
-
EQUITY_OFFERING =
<InstrumentType.EQUITY_OFFERING: 'Equity Offering'>¶
-
EQUITY_OPTION =
<InstrumentType.EQUITY_OPTION: 'Equity Option'>¶
-
FIXED_INCOME =
<InstrumentType.FIXED_INCOME: 'Fixed Income Security'>¶
-
FUTURE =
<InstrumentType.FUTURE: 'Future'>¶
-
FUTURE_OPTION =
<InstrumentType.FUTURE_OPTION: 'Future Option'>¶
-
INDEX =
<InstrumentType.INDEX: 'Index'>¶
-
LIQUIDITY_POOL =
<InstrumentType.LIQUIDITY_POOL: 'Liquidity Pool'>¶
-
UNKNOWN =
<InstrumentType.UNKNOWN: 'Unknown'>¶
-
WARRANT =
<InstrumentType.WARRANT: 'Warrant'>¶
-
BOND =
-
pydantic model tastytrade.order.Leg(*, instrument_type: InstrumentType, symbol: str, action: OrderAction, quantity: Decimal | int | None =
None, remaining_quantity: Decimal | None =None, fills: list[FillInfo] | None =None)¶ Bases:
TastytradeDataDataclass that represents an order leg.
Classes that inherit from
TradeableTastytradeDatacan callbuild_leg()to build a leg from the dataclass.Show JSON schema
{ "title": "Leg", "description": "Dataclass that represents an order leg.\n\nClasses that inherit from :class:`TradeableTastytradeData` can\ncall :meth:`build_leg` to build a leg from the dataclass.", "type": "object", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "action": { "$ref": "#/$defs/OrderAction" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Remaining-Quantity" }, "fills": { "anyOf": [ { "items": { "$ref": "#/$defs/FillInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Fills" } }, "$defs": { "FillInfo": { "description": "Dataclass that contains information about an order fill.", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Price" }, "filled-at": { "format": "date-time", "title": "Filled-At", "type": "string" }, "destination-venue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Destination-Venue" }, "ext-group-fill-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Group-Fill-Id" }, "ext-exec-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Exec-Id" } }, "required": [ "fill-id", "quantity", "fill-price", "filled-at" ], "title": "FillInfo", "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" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" } }, "required": [ "instrument-type", "symbol", "action" ] }
-
pydantic model tastytrade.order.Message(*, code: str, message: str, preflight_id: str | None =
None)¶ Bases:
TastytradeDataDataclass that represents a message from the Tastytrade API, usually a warning or an error.
Show JSON schema
{ "title": "Message", "description": "Dataclass that represents a message from the Tastytrade API, usually\na warning or an error.", "type": "object", "properties": { "code": { "title": "Code", "type": "string" }, "message": { "title": "Message", "type": "string" }, "preflight-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Preflight-Id" } }, "required": [ "code", "message" ] }
-
pydantic model tastytrade.order.NewComplexOrder(*, orders: list[NewOrder], source: str =
'tastyware/tastytrade:v11.0.5', trigger_order: NewOrder | None =None, type: ComplexOrderType =ComplexOrderType.OCO)¶ Bases:
TastytradeDataDataclass containing information about a new OTOCO order. Also used for modifying existing orders.
Show JSON schema
{ "title": "NewComplexOrder", "description": "Dataclass containing information about a new OTOCO order.\nAlso used for modifying existing orders.", "type": "object", "properties": { "orders": { "items": { "$ref": "#/$defs/NewOrder" }, "title": "Orders", "type": "array" }, "source": { "default": "tastyware/tastytrade:v11.0.5", "title": "Source", "type": "string" }, "trigger-order": { "anyOf": [ { "$ref": "#/$defs/NewOrder" }, { "type": "null" } ], "default": null }, "type": { "$ref": "#/$defs/ComplexOrderType", "default": "OCO" } }, "$defs": { "AdvancedInstructions": { "description": "Dataclass containing advanced order rules.", "properties": { "strict-position-effect-validation": { "default": false, "title": "Strict-Position-Effect-Validation", "type": "boolean" } }, "title": "AdvancedInstructions", "type": "object" }, "ComplexOrderType": { "description": "This is an :class:`~enum.Enum` that contains the valid complex order types.", "enum": [ "OCO", "OTOCO" ], "title": "ComplexOrderType", "type": "string" }, "FillInfo": { "description": "Dataclass that contains information about an order fill.", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Price" }, "filled-at": { "format": "date-time", "title": "Filled-At", "type": "string" }, "destination-venue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Destination-Venue" }, "ext-group-fill-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Group-Fill-Id" }, "ext-exec-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Exec-Id" } }, "required": [ "fill-id", "quantity", "fill-price", "filled-at" ], "title": "FillInfo", "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" }, "Leg": { "description": "Dataclass that represents an order leg.\n\nClasses that inherit from :class:`TradeableTastytradeData` can\ncall :meth:`build_leg` to build a leg from the dataclass.", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "action": { "$ref": "#/$defs/OrderAction" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Remaining-Quantity" }, "fills": { "anyOf": [ { "items": { "$ref": "#/$defs/FillInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Fills" } }, "required": [ "instrument-type", "symbol", "action" ], "title": "Leg", "type": "object" }, "NewOrder": { "description": "Dataclass containing information about a new order. Also used for\nmodifying existing orders.", "properties": { "time-in-force": { "$ref": "#/$defs/OrderTimeInForce" }, "order-type": { "$ref": "#/$defs/OrderType" }, "source": { "default": "tastyware/tastytrade:v11.0.5", "title": "Source", "type": "string" }, "legs": { "items": { "$ref": "#/$defs/Leg" }, "title": "Legs", "type": "array" }, "gtc-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Gtc-Date" }, "stop-trigger": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Stop-Trigger" }, "price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Price" }, "value": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "partition-key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Partition-Key" }, "preflight-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Preflight-Id" }, "rules": { "anyOf": [ { "$ref": "#/$defs/OrderRule" }, { "type": "null" } ], "default": null }, "advanced-instructions": { "anyOf": [ { "$ref": "#/$defs/AdvancedInstructions" }, { "type": "null" } ], "default": null }, "external-identifier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "External-Identifier" } }, "required": [ "time-in-force", "order-type", "legs" ], "title": "NewOrder", "type": "object" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" }, "OrderCondition": { "description": "Dataclass that represents an order condition for an order rule.", "properties": { "id": { "title": "Id", "type": "string" }, "action": { "title": "Action", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "indicator": { "title": "Indicator", "type": "string" }, "comparator": { "title": "Comparator", "type": "string" }, "threshold": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Threshold" }, "is-threshold-based-on-notional": { "title": "Is-Threshold-Based-On-Notional", "type": "boolean" }, "triggered-at": { "format": "date-time", "title": "Triggered-At", "type": "string" }, "triggered-value": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Triggered-Value" }, "price-components": { "items": { "$ref": "#/$defs/OrderConditionPriceComponent" }, "title": "Price-Components", "type": "array" } }, "required": [ "id", "action", "symbol", "instrument-type", "indicator", "comparator", "threshold", "is-threshold-based-on-notional", "triggered-at", "triggered-value", "price-components" ], "title": "OrderCondition", "type": "object" }, "OrderConditionPriceComponent": { "description": "Dataclass that represents a price component of an order condition.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-direction" ], "title": "OrderConditionPriceComponent", "type": "object" }, "OrderRule": { "description": "Dataclass that represents an order rule for a complex order.", "properties": { "route-after": { "format": "date-time", "title": "Route-After", "type": "string" }, "routed-at": { "format": "date-time", "title": "Routed-At", "type": "string" }, "cancel-at": { "format": "date-time", "title": "Cancel-At", "type": "string" }, "cancelled-at": { "format": "date-time", "title": "Cancelled-At", "type": "string" }, "order-conditions": { "items": { "$ref": "#/$defs/OrderCondition" }, "title": "Order-Conditions", "type": "array" } }, "required": [ "route-after", "routed-at", "cancel-at", "cancelled-at", "order-conditions" ], "title": "OrderRule", "type": "object" }, "OrderTimeInForce": { "description": "This is an :class:`~enum.Enum` that contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "GTC Ext", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "This is an :class:`~enum.Enum` that contains the valid types of orders.", "enum": [ "Limit", "Market", "Marketable Limit", "Stop", "Stop Limit", "Notional Market" ], "title": "OrderType", "type": "string" } }, "required": [ "orders" ] }
-
pydantic model tastytrade.order.NewOrder(*, time_in_force: OrderTimeInForce, order_type: OrderType, source: str =
'tastyware/tastytrade:v11.0.5', legs: list[Leg], gtc_date: date | None =None, stop_trigger: Decimal | None =None, price: Decimal | None =None, value: Decimal | None =None, partition_key: str | None =None, preflight_id: str | None =None, rules: OrderRule | None =None, advanced_instructions: AdvancedInstructions | None =None, external_identifier: str | None =None)¶ Bases:
TastytradeDataDataclass containing information about a new order. Also used for modifying existing orders.
Show JSON schema
{ "title": "NewOrder", "description": "Dataclass containing information about a new order. Also used for\nmodifying existing orders.", "type": "object", "properties": { "time-in-force": { "$ref": "#/$defs/OrderTimeInForce" }, "order-type": { "$ref": "#/$defs/OrderType" }, "source": { "default": "tastyware/tastytrade:v11.0.5", "title": "Source", "type": "string" }, "legs": { "items": { "$ref": "#/$defs/Leg" }, "title": "Legs", "type": "array" }, "gtc-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Gtc-Date" }, "stop-trigger": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Stop-Trigger" }, "price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Price" }, "value": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "partition-key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Partition-Key" }, "preflight-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Preflight-Id" }, "rules": { "anyOf": [ { "$ref": "#/$defs/OrderRule" }, { "type": "null" } ], "default": null }, "advanced-instructions": { "anyOf": [ { "$ref": "#/$defs/AdvancedInstructions" }, { "type": "null" } ], "default": null }, "external-identifier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "External-Identifier" } }, "$defs": { "AdvancedInstructions": { "description": "Dataclass containing advanced order rules.", "properties": { "strict-position-effect-validation": { "default": false, "title": "Strict-Position-Effect-Validation", "type": "boolean" } }, "title": "AdvancedInstructions", "type": "object" }, "FillInfo": { "description": "Dataclass that contains information about an order fill.", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Price" }, "filled-at": { "format": "date-time", "title": "Filled-At", "type": "string" }, "destination-venue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Destination-Venue" }, "ext-group-fill-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Group-Fill-Id" }, "ext-exec-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Exec-Id" } }, "required": [ "fill-id", "quantity", "fill-price", "filled-at" ], "title": "FillInfo", "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" }, "Leg": { "description": "Dataclass that represents an order leg.\n\nClasses that inherit from :class:`TradeableTastytradeData` can\ncall :meth:`build_leg` to build a leg from the dataclass.", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "action": { "$ref": "#/$defs/OrderAction" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Remaining-Quantity" }, "fills": { "anyOf": [ { "items": { "$ref": "#/$defs/FillInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Fills" } }, "required": [ "instrument-type", "symbol", "action" ], "title": "Leg", "type": "object" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" }, "OrderCondition": { "description": "Dataclass that represents an order condition for an order rule.", "properties": { "id": { "title": "Id", "type": "string" }, "action": { "title": "Action", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "indicator": { "title": "Indicator", "type": "string" }, "comparator": { "title": "Comparator", "type": "string" }, "threshold": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Threshold" }, "is-threshold-based-on-notional": { "title": "Is-Threshold-Based-On-Notional", "type": "boolean" }, "triggered-at": { "format": "date-time", "title": "Triggered-At", "type": "string" }, "triggered-value": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Triggered-Value" }, "price-components": { "items": { "$ref": "#/$defs/OrderConditionPriceComponent" }, "title": "Price-Components", "type": "array" } }, "required": [ "id", "action", "symbol", "instrument-type", "indicator", "comparator", "threshold", "is-threshold-based-on-notional", "triggered-at", "triggered-value", "price-components" ], "title": "OrderCondition", "type": "object" }, "OrderConditionPriceComponent": { "description": "Dataclass that represents a price component of an order condition.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-direction" ], "title": "OrderConditionPriceComponent", "type": "object" }, "OrderRule": { "description": "Dataclass that represents an order rule for a complex order.", "properties": { "route-after": { "format": "date-time", "title": "Route-After", "type": "string" }, "routed-at": { "format": "date-time", "title": "Routed-At", "type": "string" }, "cancel-at": { "format": "date-time", "title": "Cancel-At", "type": "string" }, "cancelled-at": { "format": "date-time", "title": "Cancelled-At", "type": "string" }, "order-conditions": { "items": { "$ref": "#/$defs/OrderCondition" }, "title": "Order-Conditions", "type": "array" } }, "required": [ "route-after", "routed-at", "cancel-at", "cancelled-at", "order-conditions" ], "title": "OrderRule", "type": "object" }, "OrderTimeInForce": { "description": "This is an :class:`~enum.Enum` that contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "GTC Ext", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "This is an :class:`~enum.Enum` that contains the valid types of orders.", "enum": [ "Limit", "Market", "Marketable Limit", "Stop", "Stop Limit", "Notional Market" ], "title": "OrderType", "type": "string" } }, "required": [ "time-in-force", "order-type", "legs" ] }-
field external_identifier : str | None =
None(alias 'external-identifier')¶ External identifier for the order, used to track orders across systems
-
field external_identifier : str | None =
- enum tastytrade.order.OrderAction(value)¶
-
This is an
Enumthat contains the valid order actions.Valid values are as follows:
-
BUY_TO_OPEN =
<OrderAction.BUY_TO_OPEN: 'Buy to Open'>¶
-
BUY_TO_CLOSE =
<OrderAction.BUY_TO_CLOSE: 'Buy to Close'>¶
-
SELL_TO_OPEN =
<OrderAction.SELL_TO_OPEN: 'Sell to Open'>¶
-
SELL_TO_CLOSE =
<OrderAction.SELL_TO_CLOSE: 'Sell to Close'>¶
-
BUY =
<OrderAction.BUY: 'Buy'>¶
-
SELL =
<OrderAction.SELL: 'Sell'>¶
-
BUY_TO_OPEN =
-
pydantic model tastytrade.order.OrderChain(*, id: int, account_number: str, description: str, underlying_symbol: str, computed_data: ComputedData, lite_nodes: list[OrderChainNode], lite_nodes_sizes: int | None =
None, updated_at: datetime | None =None, created_at: datetime | None =None)¶ Bases:
TastytradeDataDataclass containing information about an order chain: a group of orders for a specific underlying, such as total P/L, rolls, current P/L in a symbol, etc.
Show JSON schema
{ "title": "OrderChain", "description": "Dataclass containing information about an order chain: a group of orders\nfor a specific underlying, such as total P/L, rolls, current P/L in a\nsymbol, etc.", "type": "object", "properties": { "id": { "title": "Id", "type": "integer" }, "account-number": { "title": "Account-Number", "type": "string" }, "description": { "title": "Description", "type": "string" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "computed-data": { "$ref": "#/$defs/ComputedData" }, "lite-nodes": { "items": { "$ref": "#/$defs/OrderChainNode" }, "title": "Lite-Nodes", "type": "array" }, "lite-nodes-sizes": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Lite-Nodes-Sizes" }, "updated-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Updated-At" }, "created-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Created-At" } }, "$defs": { "ComputedData": { "description": "Dataclass containing computed data about an order chain.", "properties": { "open": { "title": "Open", "type": "boolean" }, "updated-at": { "format": "date-time", "title": "Updated-At", "type": "string" }, "total-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Fees" }, "total-commissions": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Commissions" }, "realized-gain": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Realized-Gain" }, "realized-gain-with-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Realized-Gain-With-Fees" }, "winner-realized-and-closed": { "title": "Winner-Realized-And-Closed", "type": "boolean" }, "winner-realized": { "title": "Winner-Realized", "type": "boolean" }, "winner-realized-with-fees": { "title": "Winner-Realized-With-Fees", "type": "boolean" }, "roll-count": { "title": "Roll-Count", "type": "integer" }, "opened-at": { "format": "date-time", "title": "Opened-At", "type": "string" }, "last-occurred-at": { "format": "date-time", "title": "Last-Occurred-At", "type": "string" }, "started-at-days-to-expiration": { "title": "Started-At-Days-To-Expiration", "type": "integer" }, "duration": { "title": "Duration", "type": "integer" }, "total-opening-cost": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Opening-Cost" }, "total-closing-cost": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Closing-Cost" }, "total-cost": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Cost" }, "gcd-open-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Gcd-Open-Quantity" }, "fees-missing": { "title": "Fees-Missing", "type": "boolean" }, "open-entries": { "items": { "$ref": "#/$defs/OrderChainEntry" }, "title": "Open-Entries", "type": "array" }, "total-cost-per-unit": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Total-Cost-Per-Unit" } }, "required": [ "open", "updated-at", "total-fees", "total-commissions", "realized-gain", "realized-gain-with-fees", "winner-realized-and-closed", "winner-realized", "winner-realized-with-fees", "roll-count", "opened-at", "last-occurred-at", "started-at-days-to-expiration", "duration", "total-opening-cost", "total-closing-cost", "total-cost", "gcd-open-quantity", "fees-missing", "open-entries" ], "title": "ComputedData", "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" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" }, "OrderChainEntry": { "description": "Dataclass containing information about a single order in an order chain.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "title": "Quantity", "type": "string" }, "quantity-type": { "title": "Quantity-Type", "type": "string" }, "quantity-numeric": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity-Numeric" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-type", "quantity-numeric" ], "title": "OrderChainEntry", "type": "object" }, "OrderChainLeg": { "description": "Dataclass containing information about a single leg in an order\nfrom an order chain.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "action": { "$ref": "#/$defs/OrderAction" }, "fill-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Quantity" }, "order-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Order-Quantity" } }, "required": [ "symbol", "instrument-type", "action", "fill-quantity", "order-quantity" ], "title": "OrderChainLeg", "type": "object" }, "OrderChainNode": { "description": "Dataclass containing information about a single node in an order chain.", "properties": { "node-type": { "title": "Node-Type", "type": "string" }, "id": { "title": "Id", "type": "string" }, "description": { "title": "Description", "type": "string" }, "occurred-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Occurred-At" }, "total-fees": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Total-Fees" }, "total-fill-cost": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Total-Fill-Cost" }, "gcd-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Gcd-Quantity" }, "fill-cost-per-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Fill-Cost-Per-Quantity" }, "order-fill-count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Order-Fill-Count" }, "roll": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Roll" }, "legs": { "anyOf": [ { "items": { "$ref": "#/$defs/OrderChainLeg" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Legs" }, "entries": { "anyOf": [ { "items": { "$ref": "#/$defs/OrderChainEntry" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Entries" } }, "required": [ "node-type", "id", "description" ], "title": "OrderChainNode", "type": "object" } }, "required": [ "id", "account-number", "description", "underlying-symbol", "computed-data", "lite-nodes" ] }
- pydantic model tastytrade.order.OrderChainEntry(*, symbol: str, instrument_type: InstrumentType, quantity: str, quantity_type: str, quantity_numeric: Decimal)¶
Bases:
TastytradeDataDataclass containing information about a single order in an order chain.
Show JSON schema
{ "title": "OrderChainEntry", "description": "Dataclass containing information about a single order in an order chain.", "type": "object", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "title": "Quantity", "type": "string" }, "quantity-type": { "title": "Quantity-Type", "type": "string" }, "quantity-numeric": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity-Numeric" } }, "$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", "quantity", "quantity-type", "quantity-numeric" ] }
- pydantic model tastytrade.order.OrderChainLeg(*, symbol: str, instrument_type: InstrumentType, action: OrderAction, fill_quantity: Decimal, order_quantity: Decimal)¶
Bases:
TastytradeDataDataclass containing information about a single leg in an order from an order chain.
Show JSON schema
{ "title": "OrderChainLeg", "description": "Dataclass containing information about a single leg in an order\nfrom an order chain.", "type": "object", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "action": { "$ref": "#/$defs/OrderAction" }, "fill-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Quantity" }, "order-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Order-Quantity" } }, "$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" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" } }, "required": [ "symbol", "instrument-type", "action", "fill-quantity", "order-quantity" ] }
-
pydantic model tastytrade.order.OrderChainNode(*, node_type: str, id: str, description: str, occurred_at: datetime | None =
None, total_fees: Decimal | None =None, total_fill_cost: Decimal | None =None, gcd_quantity: Decimal | None =None, fill_cost_per_quantity: Decimal | None =None, order_fill_count: int | None =None, roll: bool | None =None, legs: list[OrderChainLeg] | None =None, entries: list[OrderChainEntry] | None =None)¶ Bases:
TastytradeDataDataclass containing information about a single node in an order chain.
Show JSON schema
{ "title": "OrderChainNode", "description": "Dataclass containing information about a single node in an order chain.", "type": "object", "properties": { "node-type": { "title": "Node-Type", "type": "string" }, "id": { "title": "Id", "type": "string" }, "description": { "title": "Description", "type": "string" }, "occurred-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Occurred-At" }, "total-fees": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Total-Fees" }, "total-fill-cost": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Total-Fill-Cost" }, "gcd-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Gcd-Quantity" }, "fill-cost-per-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Fill-Cost-Per-Quantity" }, "order-fill-count": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Order-Fill-Count" }, "roll": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Roll" }, "legs": { "anyOf": [ { "items": { "$ref": "#/$defs/OrderChainLeg" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Legs" }, "entries": { "anyOf": [ { "items": { "$ref": "#/$defs/OrderChainEntry" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Entries" } }, "$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" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" }, "OrderChainEntry": { "description": "Dataclass containing information about a single order in an order chain.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "title": "Quantity", "type": "string" }, "quantity-type": { "title": "Quantity-Type", "type": "string" }, "quantity-numeric": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity-Numeric" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-type", "quantity-numeric" ], "title": "OrderChainEntry", "type": "object" }, "OrderChainLeg": { "description": "Dataclass containing information about a single leg in an order\nfrom an order chain.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "action": { "$ref": "#/$defs/OrderAction" }, "fill-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Quantity" }, "order-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Order-Quantity" } }, "required": [ "symbol", "instrument-type", "action", "fill-quantity", "order-quantity" ], "title": "OrderChainLeg", "type": "object" } }, "required": [ "node-type", "id", "description" ] }
- pydantic model tastytrade.order.OrderCondition(*, id: str, action: str, symbol: str, instrument_type: InstrumentType, indicator: str, comparator: str, threshold: Decimal, is_threshold_based_on_notional: bool, triggered_at: datetime, triggered_value: Decimal, price_components: list[OrderConditionPriceComponent])¶
Bases:
TastytradeDataDataclass that represents an order condition for an order rule.
Show JSON schema
{ "title": "OrderCondition", "description": "Dataclass that represents an order condition for an order rule.", "type": "object", "properties": { "id": { "title": "Id", "type": "string" }, "action": { "title": "Action", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "indicator": { "title": "Indicator", "type": "string" }, "comparator": { "title": "Comparator", "type": "string" }, "threshold": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Threshold" }, "is-threshold-based-on-notional": { "title": "Is-Threshold-Based-On-Notional", "type": "boolean" }, "triggered-at": { "format": "date-time", "title": "Triggered-At", "type": "string" }, "triggered-value": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Triggered-Value" }, "price-components": { "items": { "$ref": "#/$defs/OrderConditionPriceComponent" }, "title": "Price-Components", "type": "array" } }, "$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" }, "OrderConditionPriceComponent": { "description": "Dataclass that represents a price component of an order condition.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-direction" ], "title": "OrderConditionPriceComponent", "type": "object" } }, "required": [ "id", "action", "symbol", "instrument-type", "indicator", "comparator", "threshold", "is-threshold-based-on-notional", "triggered-at", "triggered-value", "price-components" ] }
- pydantic model tastytrade.order.OrderConditionPriceComponent(*, symbol: str, instrument_type: InstrumentType, quantity: Decimal, quantity_direction: str)¶
Bases:
TastytradeDataDataclass that represents a price component of an order condition.
Show JSON schema
{ "title": "OrderConditionPriceComponent", "description": "Dataclass that represents a price component of an order condition.", "type": "object", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "$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", "quantity", "quantity-direction" ] }
- pydantic model tastytrade.order.OrderRule(*, route_after: datetime, routed_at: datetime, cancel_at: datetime, cancelled_at: datetime, order_conditions: list[OrderCondition])¶
Bases:
TastytradeDataDataclass that represents an order rule for a complex order.
Show JSON schema
{ "title": "OrderRule", "description": "Dataclass that represents an order rule for a complex order.", "type": "object", "properties": { "route-after": { "format": "date-time", "title": "Route-After", "type": "string" }, "routed-at": { "format": "date-time", "title": "Routed-At", "type": "string" }, "cancel-at": { "format": "date-time", "title": "Cancel-At", "type": "string" }, "cancelled-at": { "format": "date-time", "title": "Cancelled-At", "type": "string" }, "order-conditions": { "items": { "$ref": "#/$defs/OrderCondition" }, "title": "Order-Conditions", "type": "array" } }, "$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" }, "OrderCondition": { "description": "Dataclass that represents an order condition for an order rule.", "properties": { "id": { "title": "Id", "type": "string" }, "action": { "title": "Action", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "indicator": { "title": "Indicator", "type": "string" }, "comparator": { "title": "Comparator", "type": "string" }, "threshold": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Threshold" }, "is-threshold-based-on-notional": { "title": "Is-Threshold-Based-On-Notional", "type": "boolean" }, "triggered-at": { "format": "date-time", "title": "Triggered-At", "type": "string" }, "triggered-value": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Triggered-Value" }, "price-components": { "items": { "$ref": "#/$defs/OrderConditionPriceComponent" }, "title": "Price-Components", "type": "array" } }, "required": [ "id", "action", "symbol", "instrument-type", "indicator", "comparator", "threshold", "is-threshold-based-on-notional", "triggered-at", "triggered-value", "price-components" ], "title": "OrderCondition", "type": "object" }, "OrderConditionPriceComponent": { "description": "Dataclass that represents a price component of an order condition.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-direction" ], "title": "OrderConditionPriceComponent", "type": "object" } }, "required": [ "route-after", "routed-at", "cancel-at", "cancelled-at", "order-conditions" ] }
- enum tastytrade.order.OrderStatus(value)¶
-
This is an
Enumthat contains different order statuses. A typical (successful) order follows a progression:RECEIVED -> LIVE -> FILLED
Valid values are as follows:
-
RECEIVED =
<OrderStatus.RECEIVED: 'Received'>¶
-
CANCELLED =
<OrderStatus.CANCELLED: 'Cancelled'>¶
-
FILLED =
<OrderStatus.FILLED: 'Filled'>¶
-
EXPIRED =
<OrderStatus.EXPIRED: 'Expired'>¶
-
LIVE =
<OrderStatus.LIVE: 'Live'>¶
-
REJECTED =
<OrderStatus.REJECTED: 'Rejected'>¶
-
CONTINGENT =
<OrderStatus.CONTINGENT: 'Contingent'>¶
-
ROUTED =
<OrderStatus.ROUTED: 'Routed'>¶
-
IN_FLIGHT =
<OrderStatus.IN_FLIGHT: 'In Flight'>¶
-
CANCEL_REQUESTED =
<OrderStatus.CANCEL_REQUESTED: 'Cancel Requested'>¶
-
REPLACE_REQUESTED =
<OrderStatus.REPLACE_REQUESTED: 'Replace Requested'>¶
-
REMOVED =
<OrderStatus.REMOVED: 'Removed'>¶
-
PARTIALLY_REMOVED =
<OrderStatus.PARTIALLY_REMOVED: 'Partially Removed'>¶
-
RECEIVED =
- enum tastytrade.order.OrderTimeInForce(value)¶
-
This is an
Enumthat contains the valid TIFs for orders.Valid values are as follows:
-
DAY =
<OrderTimeInForce.DAY: 'Day'>¶
-
GTC =
<OrderTimeInForce.GTC: 'GTC'>¶
-
GTD =
<OrderTimeInForce.GTD: 'GTD'>¶
-
EXT =
<OrderTimeInForce.EXT: 'Ext'>¶
-
GTC_EXT =
<OrderTimeInForce.GTC_EXT: 'GTC Ext'>¶
-
IOC =
<OrderTimeInForce.IOC: 'IOC'>¶
-
DAY =
- enum tastytrade.order.OrderType(value)¶
-
This is an
Enumthat contains the valid types of orders.Valid values are as follows:
-
LIMIT =
<OrderType.LIMIT: 'Limit'>¶
-
MARKET =
<OrderType.MARKET: 'Market'>¶
-
MARKETABLE_LIMIT =
<OrderType.MARKETABLE_LIMIT: 'Marketable Limit'>¶
-
STOP =
<OrderType.STOP: 'Stop'>¶
-
STOP_LIMIT =
<OrderType.STOP_LIMIT: 'Stop Limit'>¶
-
NOTIONAL_MARKET =
<OrderType.NOTIONAL_MARKET: 'Notional Market'>¶
-
LIMIT =
-
pydantic model tastytrade.order.PlacedComplexOrder(*, account_number: str, type: str, orders: list[PlacedOrder], id: int =
-1, trigger_order: PlacedOrder | None =None, terminal_at: str | None =None, ratio_price_threshold: Decimal | None =None, ratio_price_comparator: str | None =None, ratio_price_is_threshold_based_on_notional: bool | None =None, related_orders: list[dict[str, str]] | None =None)¶ Bases:
TastytradeDataDataclass containing information about an already placed complex order.
Show JSON schema
{ "title": "PlacedComplexOrder", "description": "Dataclass containing information about an already placed complex order.", "type": "object", "properties": { "account-number": { "title": "Account-Number", "type": "string" }, "type": { "title": "Type", "type": "string" }, "orders": { "items": { "$ref": "#/$defs/PlacedOrder" }, "title": "Orders", "type": "array" }, "id": { "default": -1, "title": "Id", "type": "integer" }, "trigger-order": { "anyOf": [ { "$ref": "#/$defs/PlacedOrder" }, { "type": "null" } ], "default": null }, "terminal-at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Terminal-At" }, "ratio-price-threshold": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ratio-Price-Threshold" }, "ratio-price-comparator": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ratio-Price-Comparator" }, "ratio-price-is-threshold-based-on-notional": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Ratio-Price-Is-Threshold-Based-On-Notional" }, "related-orders": { "anyOf": [ { "items": { "additionalProperties": { "type": "string" }, "type": "object" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Related-Orders" } }, "$defs": { "FillInfo": { "description": "Dataclass that contains information about an order fill.", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Price" }, "filled-at": { "format": "date-time", "title": "Filled-At", "type": "string" }, "destination-venue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Destination-Venue" }, "ext-group-fill-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Group-Fill-Id" }, "ext-exec-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Exec-Id" } }, "required": [ "fill-id", "quantity", "fill-price", "filled-at" ], "title": "FillInfo", "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" }, "Leg": { "description": "Dataclass that represents an order leg.\n\nClasses that inherit from :class:`TradeableTastytradeData` can\ncall :meth:`build_leg` to build a leg from the dataclass.", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "action": { "$ref": "#/$defs/OrderAction" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Remaining-Quantity" }, "fills": { "anyOf": [ { "items": { "$ref": "#/$defs/FillInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Fills" } }, "required": [ "instrument-type", "symbol", "action" ], "title": "Leg", "type": "object" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" }, "OrderCondition": { "description": "Dataclass that represents an order condition for an order rule.", "properties": { "id": { "title": "Id", "type": "string" }, "action": { "title": "Action", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "indicator": { "title": "Indicator", "type": "string" }, "comparator": { "title": "Comparator", "type": "string" }, "threshold": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Threshold" }, "is-threshold-based-on-notional": { "title": "Is-Threshold-Based-On-Notional", "type": "boolean" }, "triggered-at": { "format": "date-time", "title": "Triggered-At", "type": "string" }, "triggered-value": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Triggered-Value" }, "price-components": { "items": { "$ref": "#/$defs/OrderConditionPriceComponent" }, "title": "Price-Components", "type": "array" } }, "required": [ "id", "action", "symbol", "instrument-type", "indicator", "comparator", "threshold", "is-threshold-based-on-notional", "triggered-at", "triggered-value", "price-components" ], "title": "OrderCondition", "type": "object" }, "OrderConditionPriceComponent": { "description": "Dataclass that represents a price component of an order condition.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-direction" ], "title": "OrderConditionPriceComponent", "type": "object" }, "OrderRule": { "description": "Dataclass that represents an order rule for a complex order.", "properties": { "route-after": { "format": "date-time", "title": "Route-After", "type": "string" }, "routed-at": { "format": "date-time", "title": "Routed-At", "type": "string" }, "cancel-at": { "format": "date-time", "title": "Cancel-At", "type": "string" }, "cancelled-at": { "format": "date-time", "title": "Cancelled-At", "type": "string" }, "order-conditions": { "items": { "$ref": "#/$defs/OrderCondition" }, "title": "Order-Conditions", "type": "array" } }, "required": [ "route-after", "routed-at", "cancel-at", "cancelled-at", "order-conditions" ], "title": "OrderRule", "type": "object" }, "OrderStatus": { "description": "This is an :class:`~enum.Enum` that contains different order statuses.\nA typical (successful) order follows a progression:\n\nRECEIVED -> LIVE -> FILLED", "enum": [ "Received", "Cancelled", "Filled", "Expired", "Live", "Rejected", "Contingent", "Routed", "In Flight", "Cancel Requested", "Replace Requested", "Removed", "Partially Removed" ], "title": "OrderStatus", "type": "string" }, "OrderTimeInForce": { "description": "This is an :class:`~enum.Enum` that contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "GTC Ext", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "This is an :class:`~enum.Enum` that contains the valid types of orders.", "enum": [ "Limit", "Market", "Marketable Limit", "Stop", "Stop Limit", "Notional Market" ], "title": "OrderType", "type": "string" }, "PlacedOrder": { "description": "Dataclass containing information about an existing order, whether it's\nbeen filled or not.", "properties": { "account-number": { "title": "Account-Number", "type": "string" }, "time-in-force": { "$ref": "#/$defs/OrderTimeInForce" }, "order-type": { "$ref": "#/$defs/OrderType" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "underlying-instrument-type": { "$ref": "#/$defs/InstrumentType" }, "status": { "$ref": "#/$defs/OrderStatus" }, "cancellable": { "title": "Cancellable", "type": "boolean" }, "editable": { "title": "Editable", "type": "boolean" }, "edited": { "title": "Edited", "type": "boolean" }, "updated-at": { "format": "date-time", "title": "Updated-At", "type": "string" }, "legs": { "items": { "$ref": "#/$defs/Leg" }, "title": "Legs", "type": "array" }, "id": { "default": -1, "title": "Id", "type": "integer" }, "size": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Size" }, "price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Price" }, "gtc-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Gtc-Date" }, "value": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "stop-trigger": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Stop-Trigger" }, "contingent-status": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Contingent-Status" }, "confirmation-status": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Confirmation-Status" }, "cancelled-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancelled-At" }, "cancel-user-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancel-User-Id" }, "cancel-username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancel-Username" }, "replacing-order-id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Replacing-Order-Id" }, "replaces-order-id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Replaces-Order-Id" }, "in-flight-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "In-Flight-At" }, "live-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Live-At" }, "received-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Received-At" }, "reject-reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Reject-Reason" }, "user-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "User-Id" }, "username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Username" }, "terminal-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Terminal-At" }, "complex-order-id": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Complex-Order-Id" }, "complex-order-tag": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Complex-Order-Tag" }, "preflight-id": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Preflight-Id" }, "order-rule": { "anyOf": [ { "$ref": "#/$defs/OrderRule" }, { "type": "null" } ], "default": null }, "source": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Source" }, "external-identifier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "External-Identifier" } }, "required": [ "account-number", "time-in-force", "order-type", "underlying-symbol", "underlying-instrument-type", "status", "cancellable", "editable", "edited", "updated-at", "legs" ], "title": "PlacedOrder", "type": "object" } }, "required": [ "account-number", "type", "orders" ] }- Fields:¶
-
pydantic model tastytrade.order.PlacedComplexOrderResponse(*, buying_power_effect: BuyingPowerEffect, complex_order: PlacedComplexOrder, fee_calculation: FeeCalculation | None =
None, warnings: list[Message] | None =None, errors: list[Message] | None =None)¶ Bases:
TastytradeDataDataclass grouping together information about a placed complex order.
Show JSON schema
{ "title": "PlacedComplexOrderResponse", "description": "Dataclass grouping together information about a placed complex order.", "type": "object", "properties": { "buying-power-effect": { "$ref": "#/$defs/BuyingPowerEffect" }, "complex-order": { "$ref": "#/$defs/PlacedComplexOrder" }, "fee-calculation": { "anyOf": [ { "$ref": "#/$defs/FeeCalculation" }, { "type": "null" } ], "default": null }, "warnings": { "anyOf": [ { "items": { "$ref": "#/$defs/Message" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Warnings" }, "errors": { "anyOf": [ { "items": { "$ref": "#/$defs/Message" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Errors" } }, "$defs": { "BuyingPowerEffect": { "description": "Dataclass containing information about the effect of a trade on buying\npower.", "properties": { "change-in-margin-requirement": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Change-In-Margin-Requirement" }, "change-in-buying-power": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Change-In-Buying-Power" }, "current-buying-power": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Current-Buying-Power" }, "new-buying-power": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "New-Buying-Power" }, "isolated-order-margin-requirement": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Isolated-Order-Margin-Requirement" }, "is-spread": { "title": "Is-Spread", "type": "boolean" }, "impact": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Impact" }, "effect": { "$ref": "#/$defs/PriceEffect" } }, "required": [ "change-in-margin-requirement", "change-in-buying-power", "current-buying-power", "new-buying-power", "isolated-order-margin-requirement", "is-spread", "impact", "effect" ], "title": "BuyingPowerEffect", "type": "object" }, "FeeCalculation": { "description": "Dataclass containing information about the fees associated with a trade.", "properties": { "regulatory-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Regulatory-Fees" }, "clearing-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Clearing-Fees" }, "commission": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Commission" }, "proprietary-index-option-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Proprietary-Index-Option-Fees" }, "total-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Fees" } }, "required": [ "regulatory-fees", "clearing-fees", "commission", "proprietary-index-option-fees", "total-fees" ], "title": "FeeCalculation", "type": "object" }, "FillInfo": { "description": "Dataclass that contains information about an order fill.", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Price" }, "filled-at": { "format": "date-time", "title": "Filled-At", "type": "string" }, "destination-venue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Destination-Venue" }, "ext-group-fill-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Group-Fill-Id" }, "ext-exec-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Exec-Id" } }, "required": [ "fill-id", "quantity", "fill-price", "filled-at" ], "title": "FillInfo", "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" }, "Leg": { "description": "Dataclass that represents an order leg.\n\nClasses that inherit from :class:`TradeableTastytradeData` can\ncall :meth:`build_leg` to build a leg from the dataclass.", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "action": { "$ref": "#/$defs/OrderAction" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Remaining-Quantity" }, "fills": { "anyOf": [ { "items": { "$ref": "#/$defs/FillInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Fills" } }, "required": [ "instrument-type", "symbol", "action" ], "title": "Leg", "type": "object" }, "Message": { "description": "Dataclass that represents a message from the Tastytrade API, usually\na warning or an error.", "properties": { "code": { "title": "Code", "type": "string" }, "message": { "title": "Message", "type": "string" }, "preflight-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Preflight-Id" } }, "required": [ "code", "message" ], "title": "Message", "type": "object" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" }, "OrderCondition": { "description": "Dataclass that represents an order condition for an order rule.", "properties": { "id": { "title": "Id", "type": "string" }, "action": { "title": "Action", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "indicator": { "title": "Indicator", "type": "string" }, "comparator": { "title": "Comparator", "type": "string" }, "threshold": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Threshold" }, "is-threshold-based-on-notional": { "title": "Is-Threshold-Based-On-Notional", "type": "boolean" }, "triggered-at": { "format": "date-time", "title": "Triggered-At", "type": "string" }, "triggered-value": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Triggered-Value" }, "price-components": { "items": { "$ref": "#/$defs/OrderConditionPriceComponent" }, "title": "Price-Components", "type": "array" } }, "required": [ "id", "action", "symbol", "instrument-type", "indicator", "comparator", "threshold", "is-threshold-based-on-notional", "triggered-at", "triggered-value", "price-components" ], "title": "OrderCondition", "type": "object" }, "OrderConditionPriceComponent": { "description": "Dataclass that represents a price component of an order condition.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-direction" ], "title": "OrderConditionPriceComponent", "type": "object" }, "OrderRule": { "description": "Dataclass that represents an order rule for a complex order.", "properties": { "route-after": { "format": "date-time", "title": "Route-After", "type": "string" }, "routed-at": { "format": "date-time", "title": "Routed-At", "type": "string" }, "cancel-at": { "format": "date-time", "title": "Cancel-At", "type": "string" }, "cancelled-at": { "format": "date-time", "title": "Cancelled-At", "type": "string" }, "order-conditions": { "items": { "$ref": "#/$defs/OrderCondition" }, "title": "Order-Conditions", "type": "array" } }, "required": [ "route-after", "routed-at", "cancel-at", "cancelled-at", "order-conditions" ], "title": "OrderRule", "type": "object" }, "OrderStatus": { "description": "This is an :class:`~enum.Enum` that contains different order statuses.\nA typical (successful) order follows a progression:\n\nRECEIVED -> LIVE -> FILLED", "enum": [ "Received", "Cancelled", "Filled", "Expired", "Live", "Rejected", "Contingent", "Routed", "In Flight", "Cancel Requested", "Replace Requested", "Removed", "Partially Removed" ], "title": "OrderStatus", "type": "string" }, "OrderTimeInForce": { "description": "This is an :class:`~enum.Enum` that contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "GTC Ext", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "This is an :class:`~enum.Enum` that contains the valid types of orders.", "enum": [ "Limit", "Market", "Marketable Limit", "Stop", "Stop Limit", "Notional Market" ], "title": "OrderType", "type": "string" }, "PlacedComplexOrder": { "description": "Dataclass containing information about an already placed complex order.", "properties": { "account-number": { "title": "Account-Number", "type": "string" }, "type": { "title": "Type", "type": "string" }, "orders": { "items": { "$ref": "#/$defs/PlacedOrder" }, "title": "Orders", "type": "array" }, "id": { "default": -1, "title": "Id", "type": "integer" }, "trigger-order": { "anyOf": [ { "$ref": "#/$defs/PlacedOrder" }, { "type": "null" } ], "default": null }, "terminal-at": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Terminal-At" }, "ratio-price-threshold": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ratio-Price-Threshold" }, "ratio-price-comparator": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ratio-Price-Comparator" }, "ratio-price-is-threshold-based-on-notional": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Ratio-Price-Is-Threshold-Based-On-Notional" }, "related-orders": { "anyOf": [ { "items": { "additionalProperties": { "type": "string" }, "type": "object" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Related-Orders" } }, "required": [ "account-number", "type", "orders" ], "title": "PlacedComplexOrder", "type": "object" }, "PlacedOrder": { "description": "Dataclass containing information about an existing order, whether it's\nbeen filled or not.", "properties": { "account-number": { "title": "Account-Number", "type": "string" }, "time-in-force": { "$ref": "#/$defs/OrderTimeInForce" }, "order-type": { "$ref": "#/$defs/OrderType" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "underlying-instrument-type": { "$ref": "#/$defs/InstrumentType" }, "status": { "$ref": "#/$defs/OrderStatus" }, "cancellable": { "title": "Cancellable", "type": "boolean" }, "editable": { "title": "Editable", "type": "boolean" }, "edited": { "title": "Edited", "type": "boolean" }, "updated-at": { "format": "date-time", "title": "Updated-At", "type": "string" }, "legs": { "items": { "$ref": "#/$defs/Leg" }, "title": "Legs", "type": "array" }, "id": { "default": -1, "title": "Id", "type": "integer" }, "size": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Size" }, "price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Price" }, "gtc-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Gtc-Date" }, "value": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "stop-trigger": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Stop-Trigger" }, "contingent-status": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Contingent-Status" }, "confirmation-status": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Confirmation-Status" }, "cancelled-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancelled-At" }, "cancel-user-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancel-User-Id" }, "cancel-username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancel-Username" }, "replacing-order-id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Replacing-Order-Id" }, "replaces-order-id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Replaces-Order-Id" }, "in-flight-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "In-Flight-At" }, "live-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Live-At" }, "received-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Received-At" }, "reject-reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Reject-Reason" }, "user-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "User-Id" }, "username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Username" }, "terminal-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Terminal-At" }, "complex-order-id": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Complex-Order-Id" }, "complex-order-tag": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Complex-Order-Tag" }, "preflight-id": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Preflight-Id" }, "order-rule": { "anyOf": [ { "$ref": "#/$defs/OrderRule" }, { "type": "null" } ], "default": null }, "source": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Source" }, "external-identifier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "External-Identifier" } }, "required": [ "account-number", "time-in-force", "order-type", "underlying-symbol", "underlying-instrument-type", "status", "cancellable", "editable", "edited", "updated-at", "legs" ], "title": "PlacedOrder", "type": "object" }, "PriceEffect": { "description": "This is an :class:`~enum.Enum` that shows the sign of a price effect, since\nTastytrade is apparently against negative numbers.", "enum": [ "Credit", "Debit", "None" ], "title": "PriceEffect", "type": "string" } }, "required": [ "buying-power-effect", "complex-order" ] }
-
pydantic model tastytrade.order.PlacedOrder(*, account_number: str, time_in_force: OrderTimeInForce, order_type: OrderType, underlying_symbol: str, underlying_instrument_type: InstrumentType, status: OrderStatus, cancellable: bool, editable: bool, edited: bool, updated_at: datetime, legs: list[Leg], id: int =
-1, size: Decimal | None =None, price: Decimal | None =None, gtc_date: date | None =None, value: Decimal | None =None, stop_trigger: str | None =None, contingent_status: str | None =None, confirmation_status: str | None =None, cancelled_at: datetime | None =None, cancel_user_id: str | None =None, cancel_username: str | None =None, replacing_order_id: int | None =None, replaces_order_id: int | None =None, in_flight_at: datetime | None =None, live_at: datetime | None =None, received_at: datetime | None =None, reject_reason: str | None =None, user_id: str | None =None, username: str | None =None, terminal_at: datetime | None =None, complex_order_id: str | int | None =None, complex_order_tag: str | None =None, preflight_id: str | int | None =None, order_rule: OrderRule | None =None, source: str | None =None, external_identifier: str | None =None)¶ Bases:
TastytradeDataDataclass containing information about an existing order, whether it’s been filled or not.
Show JSON schema
{ "title": "PlacedOrder", "description": "Dataclass containing information about an existing order, whether it's\nbeen filled or not.", "type": "object", "properties": { "account-number": { "title": "Account-Number", "type": "string" }, "time-in-force": { "$ref": "#/$defs/OrderTimeInForce" }, "order-type": { "$ref": "#/$defs/OrderType" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "underlying-instrument-type": { "$ref": "#/$defs/InstrumentType" }, "status": { "$ref": "#/$defs/OrderStatus" }, "cancellable": { "title": "Cancellable", "type": "boolean" }, "editable": { "title": "Editable", "type": "boolean" }, "edited": { "title": "Edited", "type": "boolean" }, "updated-at": { "format": "date-time", "title": "Updated-At", "type": "string" }, "legs": { "items": { "$ref": "#/$defs/Leg" }, "title": "Legs", "type": "array" }, "id": { "default": -1, "title": "Id", "type": "integer" }, "size": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Size" }, "price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Price" }, "gtc-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Gtc-Date" }, "value": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "stop-trigger": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Stop-Trigger" }, "contingent-status": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Contingent-Status" }, "confirmation-status": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Confirmation-Status" }, "cancelled-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancelled-At" }, "cancel-user-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancel-User-Id" }, "cancel-username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancel-Username" }, "replacing-order-id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Replacing-Order-Id" }, "replaces-order-id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Replaces-Order-Id" }, "in-flight-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "In-Flight-At" }, "live-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Live-At" }, "received-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Received-At" }, "reject-reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Reject-Reason" }, "user-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "User-Id" }, "username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Username" }, "terminal-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Terminal-At" }, "complex-order-id": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Complex-Order-Id" }, "complex-order-tag": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Complex-Order-Tag" }, "preflight-id": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Preflight-Id" }, "order-rule": { "anyOf": [ { "$ref": "#/$defs/OrderRule" }, { "type": "null" } ], "default": null }, "source": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Source" }, "external-identifier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "External-Identifier" } }, "$defs": { "FillInfo": { "description": "Dataclass that contains information about an order fill.", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Price" }, "filled-at": { "format": "date-time", "title": "Filled-At", "type": "string" }, "destination-venue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Destination-Venue" }, "ext-group-fill-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Group-Fill-Id" }, "ext-exec-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Exec-Id" } }, "required": [ "fill-id", "quantity", "fill-price", "filled-at" ], "title": "FillInfo", "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" }, "Leg": { "description": "Dataclass that represents an order leg.\n\nClasses that inherit from :class:`TradeableTastytradeData` can\ncall :meth:`build_leg` to build a leg from the dataclass.", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "action": { "$ref": "#/$defs/OrderAction" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Remaining-Quantity" }, "fills": { "anyOf": [ { "items": { "$ref": "#/$defs/FillInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Fills" } }, "required": [ "instrument-type", "symbol", "action" ], "title": "Leg", "type": "object" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" }, "OrderCondition": { "description": "Dataclass that represents an order condition for an order rule.", "properties": { "id": { "title": "Id", "type": "string" }, "action": { "title": "Action", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "indicator": { "title": "Indicator", "type": "string" }, "comparator": { "title": "Comparator", "type": "string" }, "threshold": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Threshold" }, "is-threshold-based-on-notional": { "title": "Is-Threshold-Based-On-Notional", "type": "boolean" }, "triggered-at": { "format": "date-time", "title": "Triggered-At", "type": "string" }, "triggered-value": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Triggered-Value" }, "price-components": { "items": { "$ref": "#/$defs/OrderConditionPriceComponent" }, "title": "Price-Components", "type": "array" } }, "required": [ "id", "action", "symbol", "instrument-type", "indicator", "comparator", "threshold", "is-threshold-based-on-notional", "triggered-at", "triggered-value", "price-components" ], "title": "OrderCondition", "type": "object" }, "OrderConditionPriceComponent": { "description": "Dataclass that represents a price component of an order condition.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-direction" ], "title": "OrderConditionPriceComponent", "type": "object" }, "OrderRule": { "description": "Dataclass that represents an order rule for a complex order.", "properties": { "route-after": { "format": "date-time", "title": "Route-After", "type": "string" }, "routed-at": { "format": "date-time", "title": "Routed-At", "type": "string" }, "cancel-at": { "format": "date-time", "title": "Cancel-At", "type": "string" }, "cancelled-at": { "format": "date-time", "title": "Cancelled-At", "type": "string" }, "order-conditions": { "items": { "$ref": "#/$defs/OrderCondition" }, "title": "Order-Conditions", "type": "array" } }, "required": [ "route-after", "routed-at", "cancel-at", "cancelled-at", "order-conditions" ], "title": "OrderRule", "type": "object" }, "OrderStatus": { "description": "This is an :class:`~enum.Enum` that contains different order statuses.\nA typical (successful) order follows a progression:\n\nRECEIVED -> LIVE -> FILLED", "enum": [ "Received", "Cancelled", "Filled", "Expired", "Live", "Rejected", "Contingent", "Routed", "In Flight", "Cancel Requested", "Replace Requested", "Removed", "Partially Removed" ], "title": "OrderStatus", "type": "string" }, "OrderTimeInForce": { "description": "This is an :class:`~enum.Enum` that contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "GTC Ext", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "This is an :class:`~enum.Enum` that contains the valid types of orders.", "enum": [ "Limit", "Market", "Marketable Limit", "Stop", "Stop Limit", "Notional Market" ], "title": "OrderType", "type": "string" } }, "required": [ "account-number", "time-in-force", "order-type", "underlying-symbol", "underlying-instrument-type", "status", "cancellable", "editable", "edited", "updated-at", "legs" ] }- Fields:¶
- Validators:¶
validate_price_effects»all fields
-
pydantic model tastytrade.order.PlacedOrderResponse(*, buying_power_effect: BuyingPowerEffect, order: PlacedOrder, fee_calculation: FeeCalculation | None =
None, warnings: list[Message] | None =None, errors: list[Message] | None =None)¶ Bases:
TastytradeDataDataclass grouping together information about a placed order.
Show JSON schema
{ "title": "PlacedOrderResponse", "description": "Dataclass grouping together information about a placed order.", "type": "object", "properties": { "buying-power-effect": { "$ref": "#/$defs/BuyingPowerEffect" }, "order": { "$ref": "#/$defs/PlacedOrder" }, "fee-calculation": { "anyOf": [ { "$ref": "#/$defs/FeeCalculation" }, { "type": "null" } ], "default": null }, "warnings": { "anyOf": [ { "items": { "$ref": "#/$defs/Message" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Warnings" }, "errors": { "anyOf": [ { "items": { "$ref": "#/$defs/Message" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Errors" } }, "$defs": { "BuyingPowerEffect": { "description": "Dataclass containing information about the effect of a trade on buying\npower.", "properties": { "change-in-margin-requirement": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Change-In-Margin-Requirement" }, "change-in-buying-power": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Change-In-Buying-Power" }, "current-buying-power": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Current-Buying-Power" }, "new-buying-power": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "New-Buying-Power" }, "isolated-order-margin-requirement": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Isolated-Order-Margin-Requirement" }, "is-spread": { "title": "Is-Spread", "type": "boolean" }, "impact": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Impact" }, "effect": { "$ref": "#/$defs/PriceEffect" } }, "required": [ "change-in-margin-requirement", "change-in-buying-power", "current-buying-power", "new-buying-power", "isolated-order-margin-requirement", "is-spread", "impact", "effect" ], "title": "BuyingPowerEffect", "type": "object" }, "FeeCalculation": { "description": "Dataclass containing information about the fees associated with a trade.", "properties": { "regulatory-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Regulatory-Fees" }, "clearing-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Clearing-Fees" }, "commission": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Commission" }, "proprietary-index-option-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Proprietary-Index-Option-Fees" }, "total-fees": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Total-Fees" } }, "required": [ "regulatory-fees", "clearing-fees", "commission", "proprietary-index-option-fees", "total-fees" ], "title": "FeeCalculation", "type": "object" }, "FillInfo": { "description": "Dataclass that contains information about an order fill.", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Fill-Price" }, "filled-at": { "format": "date-time", "title": "Filled-At", "type": "string" }, "destination-venue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Destination-Venue" }, "ext-group-fill-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Group-Fill-Id" }, "ext-exec-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Ext-Exec-Id" } }, "required": [ "fill-id", "quantity", "fill-price", "filled-at" ], "title": "FillInfo", "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" }, "Leg": { "description": "Dataclass that represents an order leg.\n\nClasses that inherit from :class:`TradeableTastytradeData` can\ncall :meth:`build_leg` to build a leg from the dataclass.", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" }, "action": { "$ref": "#/$defs/OrderAction" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Remaining-Quantity" }, "fills": { "anyOf": [ { "items": { "$ref": "#/$defs/FillInfo" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Fills" } }, "required": [ "instrument-type", "symbol", "action" ], "title": "Leg", "type": "object" }, "Message": { "description": "Dataclass that represents a message from the Tastytrade API, usually\na warning or an error.", "properties": { "code": { "title": "Code", "type": "string" }, "message": { "title": "Message", "type": "string" }, "preflight-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Preflight-Id" } }, "required": [ "code", "message" ], "title": "Message", "type": "object" }, "OrderAction": { "description": "This is an :class:`~enum.Enum` that contains the valid order actions.", "enum": [ "Buy to Open", "Buy to Close", "Sell to Open", "Sell to Close", "Buy", "Sell" ], "title": "OrderAction", "type": "string" }, "OrderCondition": { "description": "Dataclass that represents an order condition for an order rule.", "properties": { "id": { "title": "Id", "type": "string" }, "action": { "title": "Action", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "indicator": { "title": "Indicator", "type": "string" }, "comparator": { "title": "Comparator", "type": "string" }, "threshold": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Threshold" }, "is-threshold-based-on-notional": { "title": "Is-Threshold-Based-On-Notional", "type": "boolean" }, "triggered-at": { "format": "date-time", "title": "Triggered-At", "type": "string" }, "triggered-value": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Triggered-Value" }, "price-components": { "items": { "$ref": "#/$defs/OrderConditionPriceComponent" }, "title": "Price-Components", "type": "array" } }, "required": [ "id", "action", "symbol", "instrument-type", "indicator", "comparator", "threshold", "is-threshold-based-on-notional", "triggered-at", "triggered-value", "price-components" ], "title": "OrderCondition", "type": "object" }, "OrderConditionPriceComponent": { "description": "Dataclass that represents a price component of an order condition.", "properties": { "symbol": { "title": "Symbol", "type": "string" }, "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "quantity": { "anyOf": [ { "type": "number" }, { "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-direction" ], "title": "OrderConditionPriceComponent", "type": "object" }, "OrderRule": { "description": "Dataclass that represents an order rule for a complex order.", "properties": { "route-after": { "format": "date-time", "title": "Route-After", "type": "string" }, "routed-at": { "format": "date-time", "title": "Routed-At", "type": "string" }, "cancel-at": { "format": "date-time", "title": "Cancel-At", "type": "string" }, "cancelled-at": { "format": "date-time", "title": "Cancelled-At", "type": "string" }, "order-conditions": { "items": { "$ref": "#/$defs/OrderCondition" }, "title": "Order-Conditions", "type": "array" } }, "required": [ "route-after", "routed-at", "cancel-at", "cancelled-at", "order-conditions" ], "title": "OrderRule", "type": "object" }, "OrderStatus": { "description": "This is an :class:`~enum.Enum` that contains different order statuses.\nA typical (successful) order follows a progression:\n\nRECEIVED -> LIVE -> FILLED", "enum": [ "Received", "Cancelled", "Filled", "Expired", "Live", "Rejected", "Contingent", "Routed", "In Flight", "Cancel Requested", "Replace Requested", "Removed", "Partially Removed" ], "title": "OrderStatus", "type": "string" }, "OrderTimeInForce": { "description": "This is an :class:`~enum.Enum` that contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "GTC Ext", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "This is an :class:`~enum.Enum` that contains the valid types of orders.", "enum": [ "Limit", "Market", "Marketable Limit", "Stop", "Stop Limit", "Notional Market" ], "title": "OrderType", "type": "string" }, "PlacedOrder": { "description": "Dataclass containing information about an existing order, whether it's\nbeen filled or not.", "properties": { "account-number": { "title": "Account-Number", "type": "string" }, "time-in-force": { "$ref": "#/$defs/OrderTimeInForce" }, "order-type": { "$ref": "#/$defs/OrderType" }, "underlying-symbol": { "title": "Underlying-Symbol", "type": "string" }, "underlying-instrument-type": { "$ref": "#/$defs/InstrumentType" }, "status": { "$ref": "#/$defs/OrderStatus" }, "cancellable": { "title": "Cancellable", "type": "boolean" }, "editable": { "title": "Editable", "type": "boolean" }, "edited": { "title": "Edited", "type": "boolean" }, "updated-at": { "format": "date-time", "title": "Updated-At", "type": "string" }, "legs": { "items": { "$ref": "#/$defs/Leg" }, "title": "Legs", "type": "array" }, "id": { "default": -1, "title": "Id", "type": "integer" }, "size": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Size" }, "price": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Price" }, "gtc-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Gtc-Date" }, "value": { "anyOf": [ { "type": "number" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "stop-trigger": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Stop-Trigger" }, "contingent-status": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Contingent-Status" }, "confirmation-status": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Confirmation-Status" }, "cancelled-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancelled-At" }, "cancel-user-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancel-User-Id" }, "cancel-username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Cancel-Username" }, "replacing-order-id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Replacing-Order-Id" }, "replaces-order-id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Replaces-Order-Id" }, "in-flight-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "In-Flight-At" }, "live-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Live-At" }, "received-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Received-At" }, "reject-reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Reject-Reason" }, "user-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "User-Id" }, "username": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Username" }, "terminal-at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Terminal-At" }, "complex-order-id": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Complex-Order-Id" }, "complex-order-tag": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Complex-Order-Tag" }, "preflight-id": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Preflight-Id" }, "order-rule": { "anyOf": [ { "$ref": "#/$defs/OrderRule" }, { "type": "null" } ], "default": null }, "source": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Source" }, "external-identifier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "External-Identifier" } }, "required": [ "account-number", "time-in-force", "order-type", "underlying-symbol", "underlying-instrument-type", "status", "cancellable", "editable", "edited", "updated-at", "legs" ], "title": "PlacedOrder", "type": "object" }, "PriceEffect": { "description": "This is an :class:`~enum.Enum` that shows the sign of a price effect, since\nTastytrade is apparently against negative numbers.", "enum": [ "Credit", "Debit", "None" ], "title": "PriceEffect", "type": "string" } }, "required": [ "buying-power-effect", "order" ] }
- pydantic model tastytrade.order.TradeableTastytradeData(*, instrument_type: InstrumentType, symbol: str)¶
Bases:
TastytradeDataDataclass that represents a tradeable instrument.
Classes that inherit from this class can call
build_leg()to build a leg from the dataclass.Show JSON schema
{ "title": "TradeableTastytradeData", "description": "Dataclass that represents a tradeable instrument.\n\nClasses that inherit from this class can call :meth:`build_leg` to build a\nleg from the dataclass.", "type": "object", "properties": { "instrument-type": { "$ref": "#/$defs/InstrumentType" }, "symbol": { "title": "Symbol", "type": "string" } }, "$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": [ "instrument-type", "symbol" ] }