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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Change-In-Margin-Requirement" }, "change-in-buying-power": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Change-In-Buying-Power" }, "current-buying-power": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Current-Buying-Power" }, "new-buying-power": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "New-Buying-Power" }, "isolated-order-margin-requirement": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Isolated-Order-Margin-Requirement" }, "is-spread": { "title": "Is-Spread", "type": "boolean" }, "impact": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Impact" }, "effect": { "$ref": "#/$defs/PriceEffect" } }, "$defs": { "PriceEffect": { "description": "Shows the sign of a price effect, since the API doesn't use 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" ] }- Fields:¶
- Validators:¶
validate_price_effects»all fields
- field change_in_margin_requirement : Decimal [Required] (alias 'change-in-margin-requirement')¶
- Validated by:¶
- field effect : PriceEffect [Required]¶
- Validated by:¶
- field isolated_order_margin_requirement : Decimal [Required] (alias 'isolated-order-margin-requirement')¶
- Validated by:¶
- validator validate_price_effects » all fields¶
- class tastytrade.order.ComplexOrderType(value)¶
Bases:
StrEnumContains the valid complex order types.
-
OCO =
'OCO'¶
-
OTO =
'OTO'¶
-
OTOCO =
'OTOCO'¶
-
PAIRS =
'PAIRS'¶
-
OCO =
- 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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Regulatory-Fees" }, "clearing-fees": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Clearing-Fees" }, "commission": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Commission" }, "proprietary-index-option-fees": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Proprietary-Index-Option-Fees" }, "total-fees": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Total-Fees" } }, "required": [ "regulatory-fees", "clearing-fees", "commission", "proprietary-index-option-fees", "total-fees" ] }- Fields:¶
- Validators:¶
validate_price_effects»all fields
- field proprietary_index_option_fees : Decimal [Required] (alias 'proprietary-index-option-fees')¶
- Validated by:¶
- validator validate_price_effects » all fields¶
- class tastytrade.order.FillBehavior(value)¶
Bases:
StrEnumValid fill behaviors in the paper environment.
-
DELAYED =
'delayed'¶ fill after
NewOrder.delayseconds
-
IMMEDIATE =
'immediate'¶ fill immediately
-
NEVER =
'never'¶ never fill
-
PARTIAL =
'partial'¶ fill half immediately, the other half after 1 second
-
REJECT =
'reject'¶ reject order immediately
-
SCHEDULED =
'scheduled'¶ fill at given
NewOrder.schedule
-
DELAYED =
-
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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" ] }- Fields:¶
- class tastytrade.order.InstrumentType(value)¶
Bases:
StrEnumContains the valid types of instruments and their representation in the API.
-
BOND =
'Bond'¶
-
CRYPTOCURRENCY =
'Cryptocurrency'¶
-
CURRENCY_PAIR =
'Currency Pair'¶
-
EQUITY =
'Equity'¶
-
EQUITY_OFFERING =
'Equity Offering'¶
-
EQUITY_OPTION =
'Equity Option'¶
-
FIXED_INCOME =
'Fixed Income Security'¶
-
FUTURE =
'Future'¶
-
FUTURE_OPTION =
'Future Option'¶
-
INDEX =
'Index'¶
-
LIQUIDITY_POOL =
'Liquidity Pool'¶
-
UNKNOWN =
'Unknown'¶
-
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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" }, "OrderAction": { "description": "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" ] }- Fields:¶
- field action : OrderAction [Required]¶
- field instrument_type : InstrumentType [Required] (alias 'instrument-type')¶
-
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:v12.4.2', 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:v12.4.2", "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": "Contains the valid complex order types.", "enum": [ "OCO", "OTOCO", "OTO", "PAIRS" ], "title": "ComplexOrderType", "type": "string" }, "FillBehavior": { "description": "Valid fill behaviors in the paper environment.", "enum": [ "delayed", "immediate", "never", "scheduled", "reject", "partial" ], "title": "FillBehavior", "type": "string" }, "FillInfo": { "description": "Dataclass that contains information about an order fill.", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" }, "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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", "default": "Day" }, "order-type": { "$ref": "#/$defs/OrderType" }, "source": { "default": "tastyware/tastytrade:v12.4.2", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Stop-Trigger" }, "price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Price" }, "value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, "behavior": { "$ref": "#/$defs/FillBehavior", "default": "immediate" }, "schedule": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Schedule" }, "delay": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Delay" } }, "required": [ "order-type", "legs" ], "title": "NewOrder", "type": "object" }, "OrderAction": { "description": "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "Ext Overnight", "GTC Ext", "GTC Ext Overnight", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "Contains the valid types of orders.", "enum": [ "Limit", "Market", "Marketable Limit", "Stop", "Stop Limit", "Notional Market" ], "title": "OrderType", "type": "string" } }, "required": [ "orders" ] }- Fields:¶
-
field type : ComplexOrderType =
ComplexOrderType.OCO¶
-
pydantic model tastytrade.order.NewOrder(*, time_in_force: OrderTimeInForce =
OrderTimeInForce.DAY, order_type: OrderType, source: str ='tastyware/tastytrade:v12.4.2', 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, behavior: FillBehavior =FillBehavior.IMMEDIATE, schedule: datetime | None =None, delay: timedelta | int | 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", "default": "Day" }, "order-type": { "$ref": "#/$defs/OrderType" }, "source": { "default": "tastyware/tastytrade:v12.4.2", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Stop-Trigger" }, "price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Price" }, "value": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, "behavior": { "$ref": "#/$defs/FillBehavior", "default": "immediate" }, "schedule": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Schedule" }, "delay": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Delay" } }, "$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" }, "FillBehavior": { "description": "Valid fill behaviors in the paper environment.", "enum": [ "delayed", "immediate", "never", "scheduled", "reject", "partial" ], "title": "FillBehavior", "type": "string" }, "FillInfo": { "description": "Dataclass that contains information about an order fill.", "properties": { "fill-id": { "title": "Fill-Id", "type": "string" }, "quantity": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" }, "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "Ext Overnight", "GTC Ext", "GTC Ext Overnight", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "Contains the valid types of orders.", "enum": [ "Limit", "Market", "Marketable Limit", "Stop", "Stop Limit", "Notional Market" ], "title": "OrderType", "type": "string" } }, "required": [ "order-type", "legs" ] }-
field advanced_instructions : AdvancedInstructions | None =
None(alias 'advanced-instructions')¶
-
field behavior : FillBehavior =
FillBehavior.IMMEDIATE¶ controls when/if/how fill happens on the paper API
-
field external_identifier : str | None =
None(alias 'external-identifier')¶ External identifier for the order, used to track orders across systems
-
field stop_trigger : Decimal | None =
None(alias 'stop-trigger')¶ For a stop/stop limit order. If the latter, use price for the limit price
-
field time_in_force : OrderTimeInForce =
OrderTimeInForce.DAY(alias 'time-in-force')¶
-
field value : Decimal | None =
None¶ The actual notional value of the order. Only for notional market orders!
- property price_effect : PriceEffect | None¶
- property value_effect : PriceEffect | None¶
-
field advanced_instructions : AdvancedInstructions | None =
- class tastytrade.order.OrderAction(value)¶
Bases:
StrEnumContains the valid order actions.
-
BUY =
'Buy'¶ for futures only
-
BUY_TO_CLOSE =
'Buy to Close'¶
-
BUY_TO_OPEN =
'Buy to Open'¶
-
SELL =
'Sell'¶ for futures only
-
SELL_TO_CLOSE =
'Sell to Close'¶
-
SELL_TO_OPEN =
'Sell to Open'¶
-
BUY =
- 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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Triggered-Value" }, "price-components": { "items": { "$ref": "#/$defs/OrderConditionPriceComponent" }, "title": "Price-Components", "type": "array" } }, "$defs": { "InstrumentType": { "description": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" }, "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" ] }- field instrument_type : InstrumentType [Required] (alias 'instrument-type')¶
- field price_components : list[OrderConditionPriceComponent] [Required] (alias '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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Quantity" }, "quantity-direction": { "title": "Quantity-Direction", "type": "string" } }, "$defs": { "InstrumentType": { "description": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" } }, "required": [ "symbol", "instrument-type", "quantity", "quantity-direction" ] }- Fields:¶
- field instrument_type : InstrumentType [Required] (alias 'instrument-type')¶
- 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": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" }, "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" ] }- Fields:¶
- field order_conditions : list[OrderCondition] [Required] (alias 'order-conditions')¶
- class tastytrade.order.OrderStatus(value)¶
Bases:
StrEnumContains different order statuses. A typical (successful) order follows a progression:
RECEIVED -> LIVE -> FILLED
-
CANCELLED =
'Cancelled'¶
-
CANCEL_REQUESTED =
'Cancel Requested'¶
-
CONTINGENT =
'Contingent'¶
-
EXPIRED =
'Expired'¶
-
FILLED =
'Filled'¶
-
IN_FLIGHT =
'In Flight'¶
-
LIVE =
'Live'¶
-
PARTIALLY_REMOVED =
'Partially Removed'¶
-
RECEIVED =
'Received'¶
-
REJECTED =
'Rejected'¶
-
REMOVED =
'Removed'¶
-
REPLACE_REQUESTED =
'Replace Requested'¶
-
ROUTED =
'Routed'¶
-
CANCELLED =
- class tastytrade.order.OrderTimeInForce(value)¶
Bases:
StrEnumContains the valid TIFs for orders.
-
DAY =
'Day'¶
-
EXT =
'Ext'¶
-
GTC =
'GTC'¶
-
GTC_EXT =
'GTC Ext'¶
-
GTC_OVERNIGHT =
'GTC Ext Overnight'¶
-
GTD =
'GTD'¶
-
IOC =
'IOC'¶
-
OVERNIGHT =
'Ext Overnight'¶
-
DAY =
- class tastytrade.order.OrderType(value)¶
Bases:
StrEnumContains the valid types of orders.
-
LIMIT =
'Limit'¶
-
MARKET =
'Market'¶
-
MARKETABLE_LIMIT =
'Marketable Limit'¶
-
NOTIONAL_MARKET =
'Notional Market'¶
-
STOP =
'Stop'¶
-
STOP_LIMIT =
'Stop Limit'¶
-
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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" }, "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "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": "Contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "Ext Overnight", "GTC Ext", "GTC Ext Overnight", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Size" }, "price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "stop-trigger": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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:¶
- field orders : list[PlacedOrder] [Required]¶
-
field ratio_price_is_threshold_based_on_notional : bool | None =
None(alias 'ratio-price-is-threshold-based-on-notional')¶
-
field trigger_order : PlacedOrder | None =
None(alias 'trigger-order')¶
-
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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Change-In-Margin-Requirement" }, "change-in-buying-power": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Change-In-Buying-Power" }, "current-buying-power": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Current-Buying-Power" }, "new-buying-power": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "New-Buying-Power" }, "isolated-order-margin-requirement": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Isolated-Order-Margin-Requirement" }, "is-spread": { "title": "Is-Spread", "type": "boolean" }, "impact": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Regulatory-Fees" }, "clearing-fees": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Clearing-Fees" }, "commission": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Commission" }, "proprietary-index-option-fees": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Proprietary-Index-Option-Fees" }, "total-fees": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" }, "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "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": "Contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "Ext Overnight", "GTC Ext", "GTC Ext Overnight", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Size" }, "price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "stop-trigger": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Shows the sign of a price effect, since the API doesn't use negative numbers.", "enum": [ "Credit", "Debit", "None" ], "title": "PriceEffect", "type": "string" } }, "required": [ "buying-power-effect", "complex-order" ] }- Fields:¶
- field buying_power_effect : BuyingPowerEffect [Required] (alias 'buying-power-effect')¶
- field complex_order : PlacedComplexOrder [Required] (alias 'complex-order')¶
-
field fee_calculation : FeeCalculation | None =
None(alias 'fee-calculation')¶
-
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: Decimal | 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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Size" }, "price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "stop-trigger": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" }, "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "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": "Contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "Ext Overnight", "GTC Ext", "GTC Ext Overnight", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "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
-
field external_identifier : str | None =
None(alias 'external-identifier')¶ External identifier for the order, used to track orders across systems
- Validated by:¶
-
field id : int =
-1¶ the ID of the order; test orders placed with dry_run don’t have an ID
- Validated by:¶
- field status : OrderStatus [Required]¶
- Validated by:¶
- field time_in_force : OrderTimeInForce [Required] (alias 'time-in-force')¶
- Validated by:¶
- field underlying_instrument_type : InstrumentType [Required] (alias 'underlying-instrument-type')¶
- Validated by:¶
- validator 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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Change-In-Margin-Requirement" }, "change-in-buying-power": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Change-In-Buying-Power" }, "current-buying-power": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Current-Buying-Power" }, "new-buying-power": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "New-Buying-Power" }, "isolated-order-margin-requirement": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Isolated-Order-Margin-Requirement" }, "is-spread": { "title": "Is-Spread", "type": "boolean" }, "impact": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Regulatory-Fees" }, "clearing-fees": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Clearing-Fees" }, "commission": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Commission" }, "proprietary-index-option-fees": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Proprietary-Index-Option-Fees" }, "total-fees": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" } ], "title": "Quantity" }, "fill-price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" }, "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Quantity" }, "remaining-quantity": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "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": "Contains the valid TIFs for orders.", "enum": [ "Day", "GTC", "GTD", "Ext", "Ext Overnight", "GTC Ext", "GTC Ext Overnight", "IOC" ], "title": "OrderTimeInForce", "type": "string" }, "OrderType": { "description": "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Size" }, "price": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Value" }, "stop-trigger": { "anyOf": [ { "type": "number" }, { "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$", "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": "Shows the sign of a price effect, since the API doesn't use negative numbers.", "enum": [ "Credit", "Debit", "None" ], "title": "PriceEffect", "type": "string" } }, "required": [ "buying-power-effect", "order" ] }- Fields:¶
- field buying_power_effect : BuyingPowerEffect [Required] (alias 'buying-power-effect')¶
-
field fee_calculation : FeeCalculation | None =
None(alias 'fee-calculation')¶
- field order : PlacedOrder [Required]¶
- 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": "Contains the valid types of instruments and their representation in the API.", "enum": [ "Bond", "Cryptocurrency", "Currency Pair", "Equity", "Equity Offering", "Equity Option", "Fixed Income Security", "Future", "Future Option", "Index", "Liquidity Pool", "Unknown", "Warrant" ], "title": "InstrumentType", "type": "string" } }, "required": [ "instrument-type", "symbol" ] }- field instrument_type : InstrumentType [Required] (alias 'instrument-type')¶