TradeStation API

The TradeStation REST API provides brokerage and market data services for building trading applications. Covers account management, order placement and execution, real-time and historical market data, option chains, symbol information, and reference data. Supports stocks, options, futures, and cryptocurrency with OAuth2 authentication.

OpenAPI Specification

tradestation-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: TradeStation API
  description: >-
    The TradeStation API is a collection of RESTful brokerage and market data
    services used to build trading applications for stocks, options, futures,
    and cryptocurrency. The API provides endpoints for account management,
    order placement and execution, real-time and historical market data,
    option chains, and symbol information. TradeStation supports advanced
    order types including bracket, OCO, OSO, and multi-leg options orders,
    with both intelligent and direct order routing. The API uses OAuth2
    authentication and version 3 is the recommended version for new
    integrations.
  version: '3.0'
  contact:
    name: TradeStation API Support
    url: https://api.tradestation.com/docs/
  termsOfService: https://www.tradestation.com/important-information/
externalDocs:
  description: TradeStation API Documentation
  url: https://api.tradestation.com/docs/
servers:
  - url: https://api.tradestation.com
    description: Production Server
  - url: https://sim-api.tradestation.com
    description: Simulator Server (Paper Trading)
tags:
  - name: Accounts
    description: >-
      Retrieve account information including account details, balances,
      beginning-of-day balances, positions, orders, historical orders,
      and cryptocurrency wallets.
  - name: Market Data
    description: >-
      Access real-time and historical market data including quotes, bar
      charts, symbol information, symbol lists, and cryptocurrency pairs.
  - name: Options
    description: >-
      Retrieve options-related market data including expirations, strike
      prices, spread types, and risk/reward calculations.
  - name: Order Execution
    description: >-
      Place, confirm, modify, and cancel orders for stocks, options, and
      futures. Includes support for group orders such as bracket and OCO
      orders.
  - name: Reference Data
    description: >-
      Access reference data for order execution including activation
      triggers and available routing destinations.
security:
  - oauth2AuthCode: []
paths:
  /v3/brokerage/accounts:
    get:
      operationId: getAccounts
      summary: Get accounts
      description: >-
        Retrieves all brokerage accounts associated with the authenticated
        user. Returns account identifiers, account types, and other account
        metadata needed for subsequent API calls.
      tags:
        - Accounts
      responses:
        '200':
          description: Successfully retrieved accounts
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountsResponse'
        '401':
          description: Unauthorized - invalid or expired access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/brokerage/accounts/{accountIds}/balances:
    get:
      operationId: getBalances
      summary: Get account balances
      description: >-
        Retrieves the current real-time balances for one or more brokerage
        accounts. Includes cash balance, equity, market value, buying power,
        and margin-related balance information.
      tags:
        - Accounts
      parameters:
        - $ref: '#/components/parameters/AccountIds'
      responses:
        '200':
          description: Successfully retrieved balances
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BalancesResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/brokerage/accounts/{accountIds}/bodbalances:
    get:
      operationId: getBalancesBOD
      summary: Get beginning-of-day balances
      description: >-
        Retrieves the beginning-of-day balances for one or more brokerage
        accounts. These balances reflect account state at the start of the
        current trading session.
      tags:
        - Accounts
      parameters:
        - $ref: '#/components/parameters/AccountIds'
      responses:
        '200':
          description: Successfully retrieved beginning-of-day balances
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BalancesResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/brokerage/accounts/{accountIds}/positions:
    get:
      operationId: getPositions
      summary: Get account positions
      description: >-
        Retrieves the current positions for one or more brokerage accounts.
        Returns information about each open position including symbol,
        quantity, average price, market value, and unrealized profit/loss.
      tags:
        - Accounts
      parameters:
        - $ref: '#/components/parameters/AccountIds'
      responses:
        '200':
          description: Successfully retrieved positions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/brokerage/accounts/{accountIds}/orders:
    get:
      operationId: getOrders
      summary: Get account orders
      description: >-
        Retrieves the current active orders for one or more brokerage
        accounts. Returns information about each order including status,
        order type, symbol, quantity, and price.
      tags:
        - Accounts
      parameters:
        - $ref: '#/components/parameters/AccountIds'
      responses:
        '200':
          description: Successfully retrieved orders
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrdersResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/brokerage/accounts/{accountIds}/historicalorders:
    get:
      operationId: getHistoricalOrders
      summary: Get historical orders
      description: >-
        Retrieves historical orders for one or more brokerage accounts.
        Returns past orders including filled, cancelled, and rejected
        orders up to 90 days in the past.
      tags:
        - Accounts
      parameters:
        - $ref: '#/components/parameters/AccountIds'
        - name: since
          in: query
          description: >-
            Filter orders since this date. Format is MM-DD-YYYY.
          required: false
          schema:
            type: string
            pattern: '^\d{2}-\d{2}-\d{4}$'
        - name: pageSize
          in: query
          description: >-
            Number of orders per page.
          required: false
          schema:
            type: integer
            minimum: 1
        - name: pageNum
          in: query
          description: >-
            Page number for pagination.
          required: false
          schema:
            type: integer
            minimum: 1
      responses:
        '200':
          description: Successfully retrieved historical orders
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrdersResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/brokerage/accounts/{accountId}/wallets:
    get:
      operationId: getWallets
      summary: Get cryptocurrency wallets
      description: >-
        Retrieves cryptocurrency wallet information for a specific brokerage
        account. Returns wallet balances and cryptocurrency holdings.
      tags:
        - Accounts
      parameters:
        - name: accountId
          in: path
          required: true
          description: >-
            The account identifier for wallet retrieval.
          schema:
            type: string
      responses:
        '200':
          description: Successfully retrieved wallets
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/marketdata/quotes/{symbols}:
    get:
      operationId: getQuotes
      summary: Get quotes
      description: >-
        Retrieves real-time quote snapshots for one or more symbols. Returns
        current bid, ask, last price, volume, and other quote data fields.
        Supports stocks, options, futures, and cryptocurrency symbols.
      tags:
        - Market Data
      parameters:
        - $ref: '#/components/parameters/Symbols'
      responses:
        '200':
          description: Successfully retrieved quotes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuotesResponse'
        '400':
          description: Invalid symbol format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/marketdata/barcharts/{symbol}:
    get:
      operationId: getBars
      summary: Get bar chart data
      description: >-
        Retrieves historical bar chart data (OHLC) for a given symbol.
        Supports multiple intervals and units including minute, daily,
        weekly, and monthly bars. Returns open, high, low, close prices
        along with volume and timestamp information.
      tags:
        - Market Data
      parameters:
        - name: symbol
          in: path
          required: true
          description: >-
            The symbol to retrieve bar chart data for.
          schema:
            type: string
        - name: interval
          in: query
          description: >-
            The interval for each bar. For minute bars, valid values are
            1-1440. For daily, weekly, and monthly bars, use 1.
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 1440
        - name: unit
          in: query
          description: >-
            The unit of time for the bar interval.
          required: false
          schema:
            type: string
            enum:
              - Minute
              - Daily
              - Weekly
              - Monthly
        - name: barsBack
          in: query
          description: >-
            Number of bars to retrieve going back from the last date.
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 57600
        - name: firstDate
          in: query
          description: >-
            The start date for bar data retrieval.
          required: false
          schema:
            type: string
            format: date-time
        - name: lastDate
          in: query
          description: >-
            The end date for bar data retrieval.
          required: false
          schema:
            type: string
            format: date-time
        - name: sessionTemplate
          in: query
          description: >-
            The session template to use for filtering bar data. Controls
            which trading session data to include.
          required: false
          schema:
            type: string
            enum:
              - USEQPre
              - USEQPost
              - USEQPreAndPost
              - Default
      responses:
        '200':
          description: Successfully retrieved bar chart data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BarsResponse'
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Symbol not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/marketdata/symbols/{symbols}:
    get:
      operationId: getSymbols
      summary: Get symbol details
      description: >-
        Retrieves detailed symbol information for one or more symbols.
        Returns symbol metadata including description, exchange, category,
        currency, point value, and contract specifications.
      tags:
        - Market Data
      parameters:
        - $ref: '#/components/parameters/Symbols'
      responses:
        '200':
          description: Successfully retrieved symbol details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SymbolsResponse'
        '400':
          description: Invalid symbol format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/marketdata/symbollists/cryptopairs/symbolnames:
    get:
      operationId: getCryptoPairs
      summary: Get cryptocurrency pairs
      description: >-
        Retrieves the list of available cryptocurrency trading pairs.
        Returns symbol names for all supported crypto pairs on the
        TradeStation platform.
      tags:
        - Market Data
      responses:
        '200':
          description: Successfully retrieved cryptocurrency pairs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CryptoPairsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/marketdata/options/expirations/{underlying}:
    get:
      operationId: getOptionExpirations
      summary: Get option expirations
      description: >-
        Retrieves available option expiration dates for a given underlying
        symbol. Returns expiration dates along with expiration type
        information such as monthly, weekly, or quarterly.
      tags:
        - Options
      parameters:
        - $ref: '#/components/parameters/Underlying'
      responses:
        '200':
          description: Successfully retrieved option expirations
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OptionExpirationsResponse'
        '400':
          description: Invalid underlying symbol
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/marketdata/options/strikes/{underlying}:
    get:
      operationId: getOptionStrikes
      summary: Get option strikes
      description: >-
        Retrieves available strike prices for options on a given underlying
        symbol. Returns the list of strike prices available for trading.
      tags:
        - Options
      parameters:
        - $ref: '#/components/parameters/Underlying'
      responses:
        '200':
          description: Successfully retrieved option strikes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OptionStrikesResponse'
        '400':
          description: Invalid underlying symbol
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/marketdata/options/spreadtypes:
    get:
      operationId: getOptionSpreadTypes
      summary: Get option spread types
      description: >-
        Retrieves the list of available option spread types supported by
        TradeStation. Returns spread type names and identifiers for use
        in multi-leg option order construction.
      tags:
        - Options
      responses:
        '200':
          description: Successfully retrieved option spread types
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OptionSpreadTypesResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/marketdata/options/riskreward:
    post:
      operationId: calculateOptionRiskReward
      summary: Calculate option risk/reward
      description: >-
        Calculates the risk and reward profile for one or more option
        positions. Returns theoretical profit/loss values at various
        price levels for the specified option strategy.
      tags:
        - Options
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RiskRewardRequest'
      responses:
        '200':
          description: Successfully calculated risk/reward
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RiskRewardResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/orderexecution/orders:
    post:
      operationId: placeOrder
      summary: Place an order
      description: >-
        Submits a new order for execution. Supports market, limit, stop
        market, stop limit, and trailing stop order types for stocks,
        options, and futures. Includes support for time-in-force settings
        such as day, GTC, GTD, and IOC.
      tags:
        - Order Execution
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderRequest'
      responses:
        '200':
          description: Order successfully submitted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '400':
          description: Invalid order parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/orderexecution/orders/{orderId}:
    put:
      operationId: replaceOrder
      summary: Replace an order
      description: >-
        Modifies an existing open order. Allows changing price, quantity,
        and other order parameters. The original order is cancelled and
        replaced with the updated order parameters.
      tags:
        - Order Execution
      parameters:
        - $ref: '#/components/parameters/OrderId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderRequest'
      responses:
        '200':
          description: Order successfully replaced
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '400':
          description: Invalid order parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Order not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: cancelOrder
      summary: Cancel an order
      description: >-
        Cancels an existing open order. The order must be in a cancellable
        state. Returns the updated order status after cancellation.
      tags:
        - Order Execution
      parameters:
        - $ref: '#/components/parameters/OrderId'
      responses:
        '200':
          description: Order successfully cancelled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Order not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/orderexecution/orderconfirm:
    post:
      operationId: confirmOrder
      summary: Confirm an order
      description: >-
        Validates an order and returns estimated costs, commissions, and
        margin requirements without actually submitting the order for
        execution. Use this endpoint to preview order details before
        placing.
      tags:
        - Order Execution
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderRequest'
      responses:
        '200':
          description: Order confirmation details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderConfirmResponse'
        '400':
          description: Invalid order parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/orderexecution/ordergroups:
    post:
      operationId: placeOrderGroup
      summary: Place a group order
      description: >-
        Submits a group of related orders for execution. Supports bracket
        orders (OCO - One Cancels Other), OSO (Order Sends Order), and
        other multi-order strategies. When one order in the group is
        filled or cancelled, related orders are automatically managed.
      tags:
        - Order Execution
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GroupOrderRequest'
      responses:
        '200':
          description: Group order successfully submitted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupOrderResponse'
        '400':
          description: Invalid group order parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/orderexecution/ordergroupconfirm:
    post:
      operationId: confirmOrderGroup
      summary: Confirm a group order
      description: >-
        Validates a group of related orders and returns estimated costs,
        commissions, and margin requirements without submitting for
        execution. Use this endpoint to preview group order details
        before placing.
      tags:
        - Order Execution
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GroupOrderRequest'
      responses:
        '200':
          description: Group order confirmation details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupOrderConfirmResponse'
        '400':
          description: Invalid group order parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/orderexecution/activationtriggers:
    get:
      operationId: getActivationTriggers
      summary: Get activation triggers
      description: >-
        Retrieves the list of available activation trigger methods for
        conditional orders. Returns trigger types and their identifiers
        that can be used when placing orders with activation conditions.
      tags:
        - Reference Data
      responses:
        '200':
          description: Successfully retrieved activation triggers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivationTriggersResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/orderexecution/routes:
    get:
      operationId: getRoutes
      summary: Get execution routes
      description: >-
        Retrieves the list of available order routing destinations.
        Returns route identifiers and names for use when specifying
        a routing preference on order submission.
      tags:
        - Reference Data
      responses:
        '200':
          description: Successfully retrieved routes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutesResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  securitySchemes:
    oauth2AuthCode:
      type: oauth2
      description: >-
        OAuth 2.0 authorization code flow for accessing TradeStation API
        resources. Requires user authorization and supports token refresh.
      flows:
        authorizationCode:
          authorizationUrl: https://signin.tradestation.com/authorize
          tokenUrl: https://signin.tradestation.com/oauth/token
          scopes:
            marketdata: Access to market data endpoints
            readaccount: Read access to account information
            trade: Access to order placement and management
  parameters:
    AccountIds:
      name: accountIds
      in: path
      required: true
      description: >-
        One or more account identifiers, comma-separated. Maximum of
        25 accounts per request.
      schema:
        type: string
    Symbols:
      name: symbols
      in: path
      required: true
      description: >-
        One or more symbol identifiers, comma-separated.
      schema:
        type: string
    Underlying:
      name: underlying
      in: path
      required: true
      description: >-
        The underlying symbol for options data retrieval.
      schema:
        type: string
    OrderId:
      name: orderId
      in: path
      required: true
      description: >-
        The unique identifier of the order.
      schema:
        type: string
  schemas:
    Error:
      type: object
      description: >-
        Standard error response returned by the TradeStation API.
      properties:
        StatusCode:
          type: integer
          description: >-
            HTTP status code of the error.
        Message:
          type: string
          description: >-
            Human-readable description of the error.
        TraceId:
          type: string
          format: uuid
          description: >-
            Unique trace identifier for debugging and support purposes.
    Account:
      type: object
      description: >-
        Represents a brokerage account with its identifiers and metadata.
      properties:
        AccountID:
          type: string
          description: >-
            The unique account identifier.
        AccountType:
          type: string
          description: >-
            The type of account such as Cash, Margin, Futures, or Crypto.
          enum:
            - Cash
            - Margin
            - Futures
            - DVP
            - Crypto
        Status:
          type: string
          description: >-
            The current status of the account.
          enum:
            - Active
            - Closed
        StatusDescription:
          type: string
          description: >-
            Human-readable description of the account status.
    AccountsResponse:
      type: object
      description: >-
        Response containing a list of brokerage accounts.
      properties:
        Accounts:
          type: array
          description: >-
            List of brokerage accounts.
          items:
            $ref: '#/components/schemas/Account'
    Balance:
      type: object
      description: >-
        Account balance information including cash, equity, and margin details.
      properties:
        AccountID:
          type: string
          description: >-
            The account identifier.
        AccountType:
          type: string
          description: >-
            The type of account.
        CashBalance:
          type: number
          format: double
          description: >-
            Current cash balance in the account.
        Equity:
          type: number
          format: double
          description: >-
            Total equity value of the account.
        MarketValue:
          type: number
          format: double
          description: >-
            Total market value of all positions.
        BuyingPower:
          type: number
          format: double
          description: >-
            Available buying power for new positions.
        RealizedProfitLoss:
          type: number
          format: double
          description: >-
            Total realized profit or loss for the current session.
        UnrealizedProfitLoss:
          type: number
          format: double
          description: >-
            Total unrealized profit or loss on open positions.
    BalancesResponse:
      type: object
      description: >-
        Response containing balance information for one or more accounts.
      properties:
        Balances:
          type: array
          description: >-
            List of account balances.
    

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