tastytrade complex-orders API

Allows an API client to retreive information about complex orders on a per account basis.

OpenAPI Specification

tastytrade-complex-orders-api-openapi.yml Raw ↑
swagger: '2.0'
info:
  title: Account Status accounts complex-orders API
  version: 7.1.0
  description: Operations about accounts
host: api.tastyworks.com
produces:
- application/json
tags:
- name: complex-orders
  description: Allows an API client to retreive information about complex orders on a per account basis.
paths:
  /accounts/{account_number}/complex-orders:
    get:
      description: Returns a paginated list of all Complex Orders
      produces:
      - application/json
      parameters:
      - in: path
        name: account_number
        type: integer
        format: int32
        required: true
      - in: query
        name: page-offset
        type: integer
        format: int32
        default: 0
        required: false
      - in: query
        name: per-page
        type: integer
        format: int32
        default: 10
        minimum: 1
        maximum: 200
        required: false
      responses:
        '200':
          description: Returns a paginated list of all Complex Orders
          schema:
            type: array
            items:
              $ref: '#/definitions/ComplexOrder'
      tags:
      - complex-orders
      operationId: getAccountsAccountNumberComplexOrders
    post:
      description: Creates a new Complex Order from supplied params
      produces:
      - application/json
      consumes:
      - application/json
      parameters:
      - in: path
        name: account_number
        type: integer
        format: int32
        required: true
      - name: postAccountsAccountNumberComplexOrders
        in: body
        required: true
        schema:
          $ref: '#/definitions/postAccountsAccountNumberComplexOrders'
      responses:
        '201':
          description: Creates a new Complex Order from supplied params
          schema:
            $ref: '#/definitions/PlacedOrderResponse'
      tags:
      - complex-orders
      operationId: postAccountsAccountNumberComplexOrders
  /accounts/{account_number}/complex-orders/dry-run:
    post:
      description: Performs a dry-run for a new ComplexOrder from supplied params. Allows validation of potential orders.
      produces:
      - application/json
      consumes:
      - application/json
      parameters:
      - in: path
        name: account_number
        type: integer
        format: int32
        required: true
      - name: postAccountsAccountNumberComplexOrdersDryRun
        in: body
        required: true
        schema:
          $ref: '#/definitions/postAccountsAccountNumberComplexOrdersDryRun'
      responses:
        '201':
          description: Performs a dry-run for a new ComplexOrder from supplied params. Allows validation of potential orders.
          schema:
            $ref: '#/definitions/PlacedOrderResponse'
      tags:
      - complex-orders
      operationId: postAccountsAccountNumberComplexOrdersDryRun
  /accounts/{account_number}/complex-orders/live:
    get:
      description: Returns all Complex Orders where a compenent order was placed today
      produces:
      - application/json
      parameters:
      - in: path
        name: account_number
        type: integer
        format: int32
        required: true
      responses:
        '200':
          description: Returns all Complex Orders where a compenent order was placed today
          schema:
            type: array
            items:
              $ref: '#/definitions/ComplexOrder'
      tags:
      - complex-orders
      operationId: getAccountsAccountNumberComplexOrdersLive
  /accounts/{account_number}/complex-orders/{id}:
    get:
      description: Returns a full representation of a Complex Order
      produces:
      - application/json
      parameters:
      - in: path
        name: account_number
        type: integer
        format: int32
        required: true
      - in: path
        name: id
        type: integer
        format: int32
        required: true
      responses:
        '200':
          description: Returns a full representation of a Complex Order
          schema:
            $ref: '#/definitions/ComplexOrder'
      tags:
      - complex-orders
      operationId: getAccountsAccountNumberComplexOrdersId
    patch:
      description: Edit threshold-price of a PAIRS trade.
      produces:
      - application/json
      consumes:
      - application/json
      parameters:
      - in: path
        name: account_number
        type: integer
        format: int32
        required: true
      - in: path
        name: id
        type: integer
        format: int32
        required: true
      - name: patchAccountsAccountNumberComplexOrdersId
        in: body
        required: true
        schema:
          $ref: '#/definitions/patchAccountsAccountNumberComplexOrdersId'
      responses:
        '200':
          description: Edit threshold-price of a PAIRS trade.
          schema:
            $ref: '#/definitions/PlacedOrderResponse'
      tags:
      - complex-orders
      operationId: patchAccountsAccountNumberComplexOrdersId
    delete:
      description: Request cancellation for all non terminal components of a Complex Order
      produces:
      - application/json
      parameters:
      - in: path
        name: account_number
        type: integer
        format: int32
        required: true
      - in: path
        name: id
        type: integer
        format: int32
        required: true
      responses:
        '200':
          description: Request cancellation for all non terminal components of a Complex Order
          schema:
            $ref: '#/definitions/ComplexOrder'
      tags:
      - complex-orders
      operationId: deleteAccountsAccountNumberComplexOrdersId
  /accounts/{account_number}/complex-orders/{id}/dry-run:
    post:
      description: Performs a dry-run for editing a ComplexOrder from supplied params.
      produces:
      - application/json
      consumes:
      - application/json
      parameters:
      - in: path
        name: account_number
        type: integer
        format: int32
        required: true
      - in: path
        name: id
        type: integer
        format: int32
        required: true
      - name: postAccountsAccountNumberComplexOrdersIdDryRun
        in: body
        required: true
        schema:
          $ref: '#/definitions/postAccountsAccountNumberComplexOrdersIdDryRun'
      responses:
        '201':
          description: Performs a dry-run for editing a ComplexOrder from supplied params.
          schema:
            $ref: '#/definitions/PlacedOrderResponse'
      tags:
      - complex-orders
      operationId: postAccountsAccountNumberComplexOrdersIdDryRun
definitions:
  ComplexOrder:
    type: object
    properties:
      id:
        description: ''
        type: string
      account-number:
        description: ''
        type: string
      ratio-price-comparator:
        description: ''
        type: string
      ratio-price-is-threshold-based-on-notional:
        description: ''
        type: boolean
      ratio-price-threshold:
        description: ''
        type: number
        format: double
      terminal-at:
        description: ''
        type: string
      type:
        description: ''
        type: string
      related-orders:
        type: array
        items:
          type: object
          properties:
            id:
              description: ''
              type: string
            complex-order-id:
              description: ''
              type: string
            complex-order-tag:
              description: ''
              type: string
            replaces-order-id:
              description: ''
              type: string
            replacing-order-id:
              description: ''
              type: string
            status:
              description: ''
              type: string
          description: Non-current orders. This includes replaced orders, unfilled orders, and terminal orders.
      orders:
        type: array
        items:
          type: object
          properties:
            id:
              description: ''
              type: string
            account-number:
              description: ''
              type: string
            cancel-user-id:
              description: ''
              type: string
            cancel-username:
              description: ''
              type: string
            cancellable:
              description: ''
              type: boolean
            cancelled-at:
              description: ''
              type: string
              format: date-time
            cancelled-size:
              description: ''
              type: number
              format: double
            complex-order-id:
              description: ''
              type: string
            complex-order-tag:
              description: ''
              type: string
            contingent-status:
              description: ''
              type: string
            editable:
              description: ''
              type: boolean
            edited:
              description: ''
              type: boolean
            external-identifier:
              description: ''
              type: string
            global-request-id:
              description: ''
              type: string
            gtc-date:
              description: ''
              type: string
              format: date
            in-flight-at:
              description: ''
              type: string
              format: date-time
            leg-count:
              description: ''
              type: string
            live-at:
              description: ''
              type: string
              format: date-time
            order-type:
              description: ''
              type: string
            preflight-id:
              description: ''
              type: string
            price:
              description: ''
              type: number
              format: double
            price-effect:
              description: ''
              type: string
            received-at:
              description: ''
              type: string
              format: date-time
            reject-reason:
              description: ''
              type: string
            replaces-order-id:
              description: ''
              type: string
            replacing-order-id:
              description: ''
              type: string
            size:
              description: ''
              type: string
            source:
              description: ''
              type: string
            status:
              description: ''
              type: string
            stop-trigger:
              description: ''
              type: string
            terminal-at:
              description: ''
              type: string
              format: date-time
            time-in-force:
              description: ''
              type: string
            underlying-instrument-type:
              description: ''
              type: string
            underlying-symbol:
              description: ''
              type: string
            updated-at:
              description: ''
              type: string
            user-id:
              description: ''
              type: string
            username:
              description: ''
              type: string
            value:
              description: ''
              type: number
              format: double
            value-effect:
              description: ''
              type: string
            legs:
              type: array
              items:
                type: object
                properties:
                  action:
                    description: ''
                    type: string
                  instrument-type:
                    description: ''
                    type: string
                  quantity:
                    description: ''
                    type: string
                  remaining-quantity:
                    description: ''
                    type: string
                  symbol:
                    description: ''
                    type: string
                  fills:
                    type: array
                    items:
                      type: object
                      properties:
                        destination-venue:
                          description: ''
                          type: string
                        ext-exec-id:
                          description: ''
                          type: string
                        ext-group-fill-id:
                          description: ''
                          type: string
                        fill-id:
                          description: ''
                          type: string
                        fill-price:
                          description: ''
                          type: number
                          format: double
                        filled-at:
                          description: ''
                          type: string
                          format: date-time
                        quantity:
                          description: ''
                          type: string
                      description: ''
                description: ''
            order-rule:
              type: object
              properties:
                cancel-at:
                  description: ''
                  type: string
                  format: date-time
                cancelled-at:
                  description: ''
                  type: string
                  format: date-time
                route-after:
                  description: ''
                  type: string
                  format: date-time
                routed-at:
                  description: ''
                  type: string
                  format: date-time
                order-conditions:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        description: ''
                        type: string
                      action:
                        description: ''
                        type: string
                      comparator:
                        description: ''
                        type: string
                      indicator:
                        description: ''
                        type: string
                      instrument-type:
                        description: ''
                        type: string
                      is-threshold-based-on-notional:
                        description: ''
                        type: boolean
                      symbol:
                        description: ''
                        type: string
                      threshold:
                        description: ''
                        type: number
                        format: double
                      triggered-at:
                        description: ''
                        type: string
                        format: date-time
                      triggered-value:
                        description: ''
                        type: number
                        format: double
                      price-components:
                        type: array
                        items:
                          type: object
                          properties:
                            instrument-type:
                              description: ''
                              type: string
                            quantity:
                              description: ''
                              type: string
                            quantity-direction:
                              description: ''
                              type: string
                            symbol:
                              description: ''
                              type: string
                          description: ''
                    description: ''
              description: ''
          description: 'Orders with complex-order-tag: ''<type>::order''. For example, ''OTO::order'' for OTO complex orders.'
      trigger-order:
        type: object
        properties:
          id:
            description: ''
            type: string
          account-number:
            description: ''
            type: string
          cancel-user-id:
            description: ''
            type: string
          cancel-username:
            description: ''
            type: string
          cancellable:
            description: ''
            type: boolean
          cancelled-at:
            description: ''
            type: string
            format: date-time
          cancelled-size:
            description: ''
            type: number
            format: double
          complex-order-id:
            description: ''
            type: string
          complex-order-tag:
            description: ''
            type: string
          contingent-status:
            description: ''
            type: string
          editable:
            description: ''
            type: boolean
          edited:
            description: ''
            type: boolean
          external-identifier:
            description: ''
            type: string
          global-request-id:
            description: ''
            type: string
          gtc-date:
            description: ''
            type: string
            format: date
          in-flight-at:
            description: ''
            type: string
            format: date-time
          leg-count:
            description: ''
            type: string
          live-at:
            description: ''
            type: string
            format: date-time
          order-type:
            description: ''
            type: string
          preflight-id:
            description: ''
            type: string
          price:
            description: ''
            type: number
            format: double
          price-effect:
            description: ''
            type: string
          received-at:
            description: ''
            type: string
            format: date-time
          reject-reason:
            description: ''
            type: string
          replaces-order-id:
            description: ''
            type: string
          replacing-order-id:
            description: ''
            type: string
          size:
            description: ''
            type: string
          source:
            description: ''
            type: string
          status:
            description: ''
            type: string
          stop-trigger:
            description: ''
            type: string
          terminal-at:
            description: ''
            type: string
            format: date-time
          time-in-force:
            description: ''
            type: string
          underlying-instrument-type:
            description: ''
            type: string
          underlying-symbol:
            description: ''
            type: string
          updated-at:
            description: ''
            type: string
          user-id:
            description: ''
            type: string
          username:
            description: ''
            type: string
          value:
            description: ''
            type: number
            format: double
          value-effect:
            description: ''
            type: string
          legs:
            type: array
            items:
              type: object
              properties:
                action:
                  description: ''
                  type: string
                instrument-type:
                  description: ''
                  type: string
                quantity:
                  description: ''
                  type: string
                remaining-quantity:
                  description: ''
                  type: string
                symbol:
                  description: ''
                  type: string
                fills:
                  type: array
                  items:
                    type: object
                    properties:
                      destination-venue:
                        description: ''
                        type: string
                      ext-exec-id:
                        description: ''
                        type: string
                      ext-group-fill-id:
                        description: ''
                        type: string
                      fill-id:
                        description: ''
                        type: string
                      fill-price:
                        description: ''
                        type: number
                        format: double
                      filled-at:
                        description: ''
                        type: string
                        format: date-time
                      quantity:
                        description: ''
                        type: string
                    description: ''
              description: ''
          order-rule:
            type: object
            properties:
              cancel-at:
                description: ''
                type: string
                format: date-time
              cancelled-at:
                description: ''
                type: string
                format: date-time
              route-after:
                description: ''
                type: string
                format: date-time
              routed-at:
                description: ''
                type: string
                format: date-time
              order-conditions:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      description: ''
                      type: string
                    action:
                      description: ''
                      type: string
                    comparator:
                      description: ''
                      type: string
                    indicator:
                      description: ''
                      type: string
                    instrument-type:
                      description: ''
                      type: string
                    is-threshold-based-on-notional:
                      description: ''
                      type: boolean
                    symbol:
                      description: ''
                      type: string
                    threshold:
                      description: ''
                      type: number
                      format: double
                    triggered-at:
                      description: ''
                      type: string
                      format: date-time
                    triggered-value:
                      description: ''
                      type: number
                      format: double
                    price-components:
                      type: array
                      items:
                        type: object
                        properties:
                          instrument-type:
                            description: ''
                            type: string
                          quantity:
                            description: ''
                            type: string
                          quantity-direction:
                            description: ''
                            type: string
                          symbol:
                            description: ''
                            type: string
                        description: ''
                  description: ''
            description: ''
        description: 'Order with complex-order-tag: ''<type>::trigger-order''. For example, ''OTO::trigger-order for OTO complex orders.'
    description: ComplexOrder model
  postAccountsAccountNumberComplexOrders:
    type: object
    properties:
      orders:
        type: array
        description: Array of orders for OCO/BLAST orders
        items:
          type: object
          properties:
            gtc-date:
              type: string
              format: date
              description: The date in which a GTD order will expire. Can only be provided if time-in-force is GTD.
            order-type:
              type: string
              description: "The type of order in regards to the price. i.e.\n                                    `Limit`, `Market`, `Marketable Limit`, `Notional Market`, `Stop` or `Stop Limit`"
              enum:
              - Limit
              - Market
              - Marketable Limit
              - Notional Market
              - Stop
              - Stop Limit
            stop-trigger:
              type: number
              format: double
              description: The price trigger at which a stop or stop-limit order becomes valid.
            time-in-force:
              type: string
              description: "The length in time before the order expires. i.e.\n                                       `Day`, `Ext`, `Ext Overnight`, `GTC`, `GTC Ext`, `GTC Ext Overnight`, `GTD` or `IOC`"
              enum:
              - Day
              - Ext
              - Ext Overnight
              - GTC
              - GTC Ext
              - GTC Ext Overnight
              - GTD
              - IOC
            price:
              type: number
              format: double
              description: The price of the Order. Required for limit and stop-limit orders.
            price-effect:
              type: string
              description: If pay or receive payment for placing the order. i.e. `Credit` or `Debit`
              enum:
              - Credit
              - Debit
            value:
              type: number
              format: double
              description: The notional value of the Order, required for notional market orders.
            value-effect:
              type: string
              description: If pay or receive payment for placing the notional market order. i.e. `Credit` or `Debit`
              enum:
              - Credit
              - Debit
            automated-source:
              type: boolean
              description: If the order was placed from an automated source
              default: false
            external-identifier:
              type: string
              description: External identifier for the order
            partition-key:
              type: string
              description: Account partition key
            preflight-id:
              type: string
              description: Transient order identifier used for matching preflight errors to an individual order
            source:
              type: string
              description: The source the order is coming from
            legs:
              type: array
              items:
                type: object
                properties:
                  action:
                    type: string
                    description: "The directional action of the leg. i.e.\n                                  `Allocate`, `Buy`, `Buy to Close`, `Buy to Open`, `Sell`, `Sell to Close` or `Sell to Open`.\n                                  Note: `Buy` and `Sell` are only applicable to Futures orders."
                    enum:
                    - Allocate
                    - Buy
                    - Buy to Close
                    - Buy to Open
                    - Sell
                    - Sell to Close
                    - Sell to Open
                  instrument-type:
                    type: string
                    description: "The type of Instrument. i.e.\n                                           `Cryptocurrency`, `Equity`, `Equity Option`, `Event Contract`, `Fixed Income Security`, `Future`, `Future Option` or `Liquidity Pool`"
                    enum:
                    - Cryptocurrency
                    - Equity
                    - Equity Option
                    - Event Contract
                    - Fixed Income Security
                    - Future
                    - Future Option
                    - Liquidity Pool
                  quantity:
                    type: number
                    format: double
                    description: The size of the contract. Required for all orders but notional market.
                  symbol:
                    type: string
                    description: "The Stock Ticker Symbol `AAPL`, OCC Option Symbol `AAPL  191004P00275000`, \\\n                                    TW Future Symbol `/ESZ9`, or TW Future Option Symbol `./ESZ9 EW4U9 190927P2975`"
                required:
                - action
                - instrument-type
                - symbol
            rules:
              type: object
              properties:
                cancel-at:
                  type: string
                  format: date-time
                  description: Latest time an order should be canceled at
                conditions:
                  type: array
                  items:
                    type: object
                    properties:
                      action:
                        type: string
                        description: "The action in which the trigger is enacted. i.e.\n                                    `cancel` and `route`"
                        enum:
                        - cancel
                        - route
                      instrument-type:
                        type: string
                        description: "The instrument's type in relation to the condition. e.g. \\\n                                              `Equity` or `Future`"
                        enum:
                        - Bond
                        - Cryptocurrency
                        - Currency Pair
                        - Equity
                        - Equity Offering
                        - Equity Option
                        - Event Contract
                        - Fixed Income Security
                        - Future
                        - Future Option
                        - Index
                        - Liquidity Pool
                        - Unknown
                        - Warrant
                      symbol:
                        type: string
                        description: "The symbol to apply the condition to. \\\n                                      e.g Stock Ticker Symbol `AAPL` or the TW Future Symbol `/ESZ9`"
                      comparator:
                        type: string
                        description: "How to compare against the threshold. \\\n                                        Currently Supports `gte` (Greater than or Equal To) or `lte` (Less than or Equal to)"
                        enum:
                        - gte
                        - lte
                      indicator:
                        type: string
                        description: The indicator for the trigger, currently only supports `last`
                        enum:
                        - last
                        - nat
                      threshold:
                        type: number
                        format: double
                        description: The price at which the condition triggers.
                      price-components:
                        type: array
                        items:
                          type: object
                          properties:
                            instrument-type:
                              type: string
                              description: The instrument's type in relation to the symbol.
                              enum:
                              - Bond
                              - Cryptocurrency
                              - Currency Pair
                              - Equity
                              - Equity Offering
                              - Equity Option
                              - Event Contract
                              - Fixed Income Security
                              - Future
                              - Future Option
                              - Index
                              - Liquidity Pool
                              - Unknown
                              - Warrant
                            quantity:
                              type: number
                              format: double
                              description: The Ratio quantity in relation to the symbol
                            quantity-direction:
                    

# --- truncated at 32 KB (93 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/tastytrade/refs/heads/main/openapi/tastytrade-complex-orders-api-openapi.yml