tastytrade.order

pydantic model tastytrade.order.AdvancedInstructions(*, strict_position_effect_validation: bool = False)

Bases: TastytradeData

Dataclass 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"
      }
   }
}

Fields:
field strict_position_effect_validation : bool = False (alias 'strict-position-effect-validation')

By default, if a position meant to be closed by a closing order is no longer open, the API will turn it into an opening order. With this flag, the API would instead discard the closing order.

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: TastytradeData

Dataclass 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:
field change_in_buying_power : Decimal [Required] (alias 'change-in-buying-power')
Validated by:
field change_in_margin_requirement : Decimal [Required] (alias 'change-in-margin-requirement')
Validated by:
field current_buying_power : Decimal [Required] (alias 'current-buying-power')
Validated by:
field effect : PriceEffect [Required]
Validated by:
field impact : Decimal [Required]
Validated by:
field is_spread : bool [Required] (alias 'is-spread')
Validated by:
field isolated_order_margin_requirement : Decimal [Required] (alias 'isolated-order-margin-requirement')
Validated by:
field new_buying_power : Decimal [Required] (alias 'new-buying-power')
Validated by:
validator validate_price_effects  »  all fields
class tastytrade.order.ComplexOrderType(value)

Bases: StrEnum

Contains the valid complex order types.

OCO = 'OCO'
OTO = 'OTO'
OTOCO = 'OTOCO'
PAIRS = 'PAIRS'
pydantic model tastytrade.order.FeeCalculation(*, regulatory_fees: Decimal, clearing_fees: Decimal, commission: Decimal, proprietary_index_option_fees: Decimal, total_fees: Decimal)

Bases: TastytradeData

Dataclass 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:
field clearing_fees : Decimal [Required] (alias 'clearing-fees')
Validated by:
field commission : Decimal [Required]
Validated by:
field proprietary_index_option_fees : Decimal [Required] (alias 'proprietary-index-option-fees')
Validated by:
field regulatory_fees : Decimal [Required] (alias 'regulatory-fees')
Validated by:
field total_fees : Decimal [Required] (alias 'total-fees')
Validated by:
validator validate_price_effects  »  all fields
class tastytrade.order.FillBehavior(value)

Bases: StrEnum

Valid fill behaviors in the paper environment.

DELAYED = 'delayed'

fill after NewOrder.delay seconds

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

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: TastytradeData

Dataclass 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:
field destination_venue : str | None = None (alias 'destination-venue')
field ext_exec_id : str | None = None (alias 'ext-exec-id')
field ext_group_fill_id : str | None = None (alias 'ext-group-fill-id')
field fill_id : str [Required] (alias 'fill-id')
field fill_price : Decimal [Required] (alias 'fill-price')
field filled_at : datetime [Required] (alias 'filled-at')
field quantity : Decimal [Required]
class tastytrade.order.InstrumentType(value)

Bases: StrEnum

Contains 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'
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: TastytradeData

Dataclass that represents an order leg.

Classes that inherit from TradeableTastytradeData can call build_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 fills : list[FillInfo] | None = None
field instrument_type : InstrumentType [Required] (alias 'instrument-type')
field quantity : Decimal | int | None = None
field remaining_quantity : Decimal | None = None (alias 'remaining-quantity')
field symbol : str [Required]
property multiplier : Decimal | int
pydantic model tastytrade.order.Message(*, code: str, message: str, preflight_id: str | None = None)

Bases: TastytradeData

Dataclass 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"
   ]
}

Fields:
field code : str [Required]
field message : str [Required]
field preflight_id : str | None = None (alias 'preflight-id')
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: TastytradeData

Dataclass 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 orders : list[NewOrder] [Required]
field source : str = 'tastyware/tastytrade:v12.4.2'
field trigger_order : NewOrder | None = None (alias 'trigger-order')
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: TastytradeData

Dataclass 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"
   ]
}

Fields:
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 delay : timedelta | int | None = None

delay before the 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 gtc_date : date | None = None (alias 'gtc-date')
field legs : list[Leg] [Required]
field order_type : OrderType [Required] (alias 'order-type')
field partition_key : str | None = None (alias 'partition-key')
field preflight_id : str | None = None (alias 'preflight-id')
field price : Decimal | None = None

The price of the order; negative = debit, positive = credit

field rules : OrderRule | None = None
field schedule : datetime | None = None

specific time the fill should occur on the paper API

field source : str = 'tastyware/tastytrade:v12.4.2'
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!

serialize_fields(field: Decimal | None) Decimal | None
property price_effect : PriceEffect | None
property value_effect : PriceEffect | None
class tastytrade.order.OrderAction(value)

Bases: StrEnum

Contains 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'
property multiplier : int
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: TastytradeData

Dataclass 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"
   ]
}

Fields:
field action : str [Required]
field comparator : str [Required]
field id : str [Required]
field indicator : str [Required]
field instrument_type : InstrumentType [Required] (alias 'instrument-type')
field is_threshold_based_on_notional : bool [Required] (alias 'is-threshold-based-on-notional')
field price_components : list[OrderConditionPriceComponent] [Required] (alias 'price-components')
field symbol : str [Required]
field threshold : Decimal [Required]
field triggered_at : datetime [Required] (alias 'triggered-at')
field triggered_value : Decimal [Required] (alias 'triggered-value')
pydantic model tastytrade.order.OrderConditionPriceComponent(*, symbol: str, instrument_type: InstrumentType, quantity: Decimal, quantity_direction: str)

Bases: TastytradeData

Dataclass 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')
field quantity : Decimal [Required]
field quantity_direction : str [Required] (alias 'quantity-direction')
field symbol : str [Required]
pydantic model tastytrade.order.OrderRule(*, route_after: datetime, routed_at: datetime, cancel_at: datetime, cancelled_at: datetime, order_conditions: list[OrderCondition])

Bases: TastytradeData

Dataclass 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 cancel_at : datetime [Required] (alias 'cancel-at')
field cancelled_at : datetime [Required] (alias 'cancelled-at')
field order_conditions : list[OrderCondition] [Required] (alias 'order-conditions')
field route_after : datetime [Required] (alias 'route-after')
field routed_at : datetime [Required] (alias 'routed-at')
class tastytrade.order.OrderStatus(value)

Bases: StrEnum

Contains 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'
class tastytrade.order.OrderTimeInForce(value)

Bases: StrEnum

Contains 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'
class tastytrade.order.OrderType(value)

Bases: StrEnum

Contains the valid types of orders.

LIMIT = 'Limit'
MARKET = 'Market'
MARKETABLE_LIMIT = 'Marketable Limit'
NOTIONAL_MARKET = 'Notional Market'
STOP = 'Stop'
STOP_LIMIT = 'Stop 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: TastytradeData

Dataclass 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 account_number : str [Required] (alias 'account-number')
field id : int = -1

the ID of the order; test orders placed with dry_run don’t have an ID

field orders : list[PlacedOrder] [Required]
field ratio_price_comparator : str | None = None (alias 'ratio-price-comparator')
field ratio_price_is_threshold_based_on_notional : bool | None = None (alias 'ratio-price-is-threshold-based-on-notional')
field ratio_price_threshold : Decimal | None = None (alias 'ratio-price-threshold')
field related_orders : list[dict[str, str]] | None = None (alias 'related-orders')
field terminal_at : str | None = None (alias 'terminal-at')
field trigger_order : PlacedOrder | None = None (alias 'trigger-order')
field type : str [Required]
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: TastytradeData

Dataclass 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 errors : list[Message] | None = None
field fee_calculation : FeeCalculation | None = None (alias 'fee-calculation')
field warnings : list[Message] | None = None
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: TastytradeData

Dataclass 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:
field account_number : str [Required] (alias 'account-number')
Validated by:
field cancel_user_id : str | None = None (alias 'cancel-user-id')
Validated by:
field cancel_username : str | None = None (alias 'cancel-username')
Validated by:
field cancellable : bool [Required]
Validated by:
field cancelled_at : datetime | None = None (alias 'cancelled-at')
Validated by:
field complex_order_id : str | int | None = None (alias 'complex-order-id')
Validated by:
field complex_order_tag : str | None = None (alias 'complex-order-tag')
Validated by:
field confirmation_status : str | None = None (alias 'confirmation-status')
Validated by:
field contingent_status : str | None = None (alias 'contingent-status')
Validated by:
field editable : bool [Required]
Validated by:
field edited : bool [Required]
Validated by:
field external_identifier : str | None = None (alias 'external-identifier')

External identifier for the order, used to track orders across systems

Validated by:
field gtc_date : date | None = None (alias 'gtc-date')
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 in_flight_at : datetime | None = None (alias 'in-flight-at')
Validated by:
field legs : list[Leg] [Required]
Validated by:
field live_at : datetime | None = None (alias 'live-at')
Validated by:
field order_rule : OrderRule | None = None (alias 'order-rule')
Validated by:
field order_type : OrderType [Required] (alias 'order-type')
Validated by:
field preflight_id : str | int | None = None (alias 'preflight-id')
Validated by:
field price : Decimal | None = None
Validated by:
field received_at : datetime | None = None (alias 'received-at')
Validated by:
field reject_reason : str | None = None (alias 'reject-reason')
Validated by:
field replaces_order_id : int | None = None (alias 'replaces-order-id')
Validated by:
field replacing_order_id : int | None = None (alias 'replacing-order-id')
Validated by:
field size : Decimal | None = None
Validated by:
field source : str | None = None
Validated by:
field status : OrderStatus [Required]
Validated by:
field stop_trigger : Decimal | None = None (alias 'stop-trigger')
Validated by:
field terminal_at : datetime | None = None (alias 'terminal-at')
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:
field underlying_symbol : str [Required] (alias 'underlying-symbol')
Validated by:
field updated_at : datetime [Required] (alias 'updated-at')
Validated by:
field user_id : str | None = None (alias 'user-id')
Validated by:
field username : str | None = None
Validated by:
field value : Decimal | None = None
Validated by:
validator validate_price_effects  »  all fields
average_fill_price() Decimal
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: TastytradeData

Dataclass 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 errors : list[Message] | None = None
field fee_calculation : FeeCalculation | None = None (alias 'fee-calculation')
field order : PlacedOrder [Required]
field warnings : list[Message] | None = None
pydantic model tastytrade.order.TradeableTastytradeData(*, instrument_type: InstrumentType, symbol: str)

Bases: TastytradeData

Dataclass 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"
   ]
}

Fields:
field instrument_type : InstrumentType [Required] (alias 'instrument-type')
field symbol : str [Required]
build_leg(quantity: Decimal | int | None, action: OrderAction) Leg

Builds an order Leg from the dataclass.

Parameters:
quantity: Decimal | int | None

the quantity of the symbol to trade, set this as None for notional orders

action: OrderAction

OrderAction to perform, e.g. BUY_TO_OPEN