Skip to main content

Download OpenAPI specification:Download

Authentication

For more information on authorization and gaining an access/refresh token, please visit: Authentication.

Bearer-Token

The TradeStation API uses bearer tokens to authenticate requests. You must provide a valid bearer token in the HTTP header for API requests.

Security Scheme Type: HTTP
HTTP Authorization Scheme: bearer

MarketData

Get Bars

Fetches marketdata bars for the given symbol, interval, and timeframe. The maximum amount of intraday bars a user can fetch is 57,600 per request. This is calculated either by the amount of barsback or bars within a timeframe requested.

path Parameters
symbol
required
string
Example: MSFT

The valid symbol string.

query Parameters
interval
string
Example: interval=1

Default: 1. Interval that each bar will consist of - for minute bars, the number of minutes aggregated in a single bar. For bar units other than minute, value must be 1. For unit Minute the max allowed Interval is 1440.

unit
string
Example: unit=Daily

Default: Daily. The unit of time for each bar interval. Valid values are: Minute, Daily, Weekly, Monthly.

barsback
string
Example: barsback=5

Default: 1. Number of bars back to fetch (or retrieve). The maximum number of intraday bars back that a user can query is 57,600. There is no limit on daily, weekly, or monthly bars. This parameter is mutually exclusive with firstdate

firstdate
string
Example: firstdate=2020-12-05T21:00:00Z

Does not have a default value. The first date formatted as YYYY-MM-DD,2020-04-20T18:00:00Z. This parameter is mutually exclusive with barsback.

lastdate
string
Example: lastdate=2020-12-05T21:00:00Z

Defaults to current timestamp. The last date formatted as YYYY-MM-DD,2020-04-20T18:00:00Z. This parameter is mutually exclusive with startdate and should be used instead of that parameter, since startdate is now deprecated.

sessiontemplate
string

United States (US) stock market session templates, that extend bars returned to include those outside of the regular trading session. Ignored for non-US equity symbols. Valid values are: USEQPre, USEQPost, USEQPreAndPost, USEQ24Hour,Default.

startdate
string
Deprecated
Example: startdate=2020-12-05T21:00:00Z

Defaults to current timestamp. The last date formatted as YYYY-MM-DD,2020-04-20T18:00:00Z. This parameter is mutually exclusive with lastdate. This parameter is deprecated; use lastdate instead of startdate.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/barcharts/MSFT' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Bars": [
    ]
}

Stream Bars

Streams marketdata bars for the given symbol, interval, and timeframe.

path Parameters
symbol
required
string
Example: MSFT

The valid symbol string.

query Parameters
interval
string
Default: "1"
Example: interval=1

Interval that each bar will consist of - for minute bars, the number of minutes aggregated in a single bar. For bar units other than minute, value must be 1.

unit
string
Default: "Daily"
Example: unit=Daily

Unit of time for each bar interval. Valid values are: minute, daily, weekly, and monthly.

barsback
string
Example: barsback=5

The bars back - the max value is 57600.

sessiontemplate
string

United States (US) stock market session templates, that extend bars returned to include those outside of the regular trading session. Ignored for non-US equity symbols. Valid values are: USEQPre, USEQPost, USEQPreAndPost, USEQ24Hour, Default.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/stream/barcharts/MSFT' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams.v2+json
Example
{
  • "High": "217.32",
  • "Low": "216.2",
  • "Open": "217.32",
  • "Close": "217",
  • "TimeStamp": "2020-11-12T17:00:00Z",
  • "TotalVolume": "807033",
  • "DownTicks": 2091,
  • "DownVolume": 396976,
  • "OpenInterest": "0",
  • "IsRealtime": false,
  • "IsEndOfHistory": false,
  • "TotalTicks": 4296,
  • "UnchangedTicks": 0,
  • "UnchangedVolume": 0,
  • "UpTicks": 2205,
  • "UpVolume": 410057,
  • "Epoch": 1605200400000,
  • "BarStatus": "Open"
}

Get Crypto Symbol Names

Fetches crypto Symbol Names for all available symbols, i.e., BTCUSD, ETHUSD, LTCUSD and BCHUSD. Note that while data can be obtained for these symbols, they cannot be traded.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/symbollists/cryptopairs/symbolnames' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "SymbolNames": [
    ]
}

Get Symbol Details

Fetches symbol details and formatting information for one or more symbols and relevant errors, if any. Use provided formatting objects to display provided prices and quantities from other API endpoints.

  • Decimal prices should be displayed as decimals. For instance, for a given price of 123.2 the price should be displayed as 123.20.

  • Fraction price display formatting should be displayed with the PriceFormat.Fraction in the denominator of the fraction part of the given number. For instance, given a price of 534.5 and a PriceFormat.Fraction of 8, the number should be shown as 534 4/8.

  • For SubFractional price display formatting, the following equations can be used to derive the display format of a'b.c for a given price. For instance, given a price of 125.92969, a PriceFormat.Fraction of 32 and a PriceFormat.Subfraction of 4, the number should be displayed as 125'29.7.

    x (Price)                   = 125.92969
    y (PriceFormat.Fraction)    = 32
    z (PriceFormat.SubFraction) = 4
    
    a = trunc(x)
    b = trunc(frac(x) * y)
    c = trunc(((frac(x) - (b/y)) * z * y) / (z/10))
    
path Parameters
symbols
required
string
Example: MSFT,BTCUSD

List of valid symbols in comma separated format; for example "MSFT,BTCUSD", no more than 50 symbols per request.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/symbols/MSFT,BTCUSD' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Symbols": [
    ],
  • "Errors": [ ]
}

Get Option Expirations

Get the available option contract expiration dates for the underlying symbol.

path Parameters
underlying
required
string
Example: AAPL

The symbol for the underlying security on which the option contracts are based. The underlying symbol must be an equity or index.

query Parameters
strikePrice
number <double>

Strike price. If provided, only expirations for that strike price will be returned.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/options/expirations/AAPL' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Expirations": [
    ]
}

Get Option Risk Reward

Analyze the risk vs. reward of a potential option trade. This endpoint is not applicable for option spread types with different expirations, such as Calendar and Diagonal.

Request Body schema: application/json
SpreadPrice
number <double>

The quoted price for the option spread trade.

Array of objects (RiskRewardAnalysisInputLeg)

The legs of the option spread trade. If more than one leg is specified, the expiration dates must all be the same. In addition, leg symbols must be of type stock, stock option, or index option.

Responses

Request samples

Content type
application/json
{
  • "SpreadPrice": 0.24,
  • "Legs": [
    ]
}

Response samples

Content type
application/json
{
  • "MaxGainIsInfinite": false,
  • "AdjustedMaxGain": "482",
  • "MaxLossIsInfinite": false,
  • "AdjustedMaxLoss": "-18",
  • "BreakevenPoints": [
    ]
}

Get Option Spread Types

Get the available spread types for option chains.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/options/spreadtypes' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "SpreadTypes": [
    ]
}

Get Option Strikes

Get the available strike prices for a spread type and expiration date.

path Parameters
underlying
required
string
Example: AAPL

The symbol for the underlying security on which the option contracts are based. The underlying symbol must be an equity or index.

query Parameters
spreadType
string
Default: "Single"
Example: spreadType=Butterfly

The name of the spread type to get the strikes for. This value can be obtained from the Get Option Spread Types endpoint.

strikeInterval
integer <int32>
Default: 1

Specifies the desired interval between the strike prices in a spread. It must be greater than or equal to 1. A value of 1 uses consecutive strikes; a value of 2 skips one between strikes; and so on.

expiration
string <date-time>
Example: expiration=12-17-2021

Date on which the option contract expires; must be a valid expiration date. Defaults to the next contract expiration date.

expiration2
string <date-time>
Example: expiration2=12-18-2021

Second contract expiration date required for Calendar and Diagonal spreads.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/options/strikes/AAPL' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "SpreadType": "Butterfly",
  • "Strikes": [
    ]
}

Stream Option Chain

Stream a chain of option spreads for a given underlying symbol, spread type, and expiration. A maximum of 10 concurrent streams is allowed.

For options calculations, the WebAPI uses the following:

  • 90 days for historical volatility of the underlying
  • Bjerksund and Stensland option pricing model
  • Ask price for price of the option
path Parameters
underlying
required
string
Example: AAPL

The symbol for the underlying security on which the option contracts are based.

query Parameters
expiration
string <date-time>
Example: expiration=12-17-2021

Date on which the option contract expires; must be a valid expiration date. Defaults to the next contract expiration date.

expiration2
string <date-time>
Example: expiration2=12-17-2021

Second contract expiration date required for Calendar and Diagonal spreads.

strikeProximity
integer <int32>
Default: 5

Specifies the number of spreads to display above and below the priceCenter.

spreadType
string
Default: "Single"
Example: spreadType=Butterfly

Specifies the name of the spread type to use.

riskFreeRate
number <double>

The theoretical rate of return of an investment with zero risk. Defaults to the current quote for $IRX.X. The percentage rate should be specified as a decimal value. For example, to use 2% for the rate, pass in 0.02.

priceCenter
number <double>

Specifies the strike price center. Defaults to the last quoted price for the underlying security.

strikeInterval
integer <int32>
Default: 1

Specifies the desired interval between the strike prices in a spread. It must be greater than or equal to 1. A value of 1 uses consecutive strikes; a value of 2 skips one between strikes; and so on.

enableGreeks
boolean
Default: true

Specifies whether or not greeks properties are returned.

strikeRange
string
Default: "All"
  • If the filter is ITM (in-the-money), the chain includes only spreads that have an intrinsic value greater than zero.
  • If the filter is OTM (out-of-the-money), the chain includes only spreads that have an intrinsic value equal to zero.
optionType
string
Default: "All"

Filters the spreads by a specific option type. Valid values are All, Call, and Put.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/stream/options/chains/AAPL' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams.v2+json
{
  • "Delta": "0.0497",
  • "Theta": "-0.0049",
  • "Gamma": "-0.0004",
  • "Rho": "0.0005",
  • "Vega": "-0.0001",
  • "ImpliedVolatility": "0.3118",
  • "IntrinsicValue": "0",
  • "ExtrinsicValue": "0.3",
  • "TheoreticalValue": "0.2816",
  • "ProbabilityITM": "0.05",
  • "ProbabilityOTM": "0.95",
  • "ProbabilityBE": "0.0479",
  • "ProbabilityITM_IV": "0.0984",
  • "ProbabilityOTM_IV": "0.9016",
  • "ProbabilityBE_IV": "0.0956",
  • "TheoreticalValue_IV": "0.3",
  • "StandardDeviation": "0.0245",
  • "DailyOpenInterest": 1996,
  • "Ask": "0.7",
  • "Bid": "-0.1",
  • "Mid": "0.3",
  • "AskSize": 13,
  • "BidSize": 9,
  • "Close": "-0.44",
  • "High": "-0.19",
  • "Last": "-0.44",
  • "Low": "1.05",
  • "NetChange": "-1.01",
  • "NetChangePct": "-1.7719",
  • "Open": "0.46",
  • "PreviousClose": "0.57",
  • "Volume": 144,
  • "Side": "Put",
  • "Strikes": [
    ],
  • "Legs": [
    ]
}

Stream Option Quotes

Stream price quotes and greeks for the specified option spread. A maximum of 10 concurrent streams is allowed. Leg indexes are expected to be sequential starting at zero. For example, if there are three legs, the legs in the request should contain Legs[0], Legs[1], and Legs[2]. Note that there is no required order for the Legs in the query parameters. For example, if there are 2 legs, Legs[0].Symbol, Legs[0].Ratio, Legs[1].Symbol, and Legs[1].Ratio can be in any order in the query parameters.

For options calculations, the WebAPI uses the following:

  • 90 days for historical volatility of the underlying
  • Bjerksund and Stensland option pricing model
  • Ask price for price of the option
query Parameters
legs[0].Symbol
required
string
Example: legs[0].Symbol=MSFT 220916C305
  • legs: Individual components of a multi-part trade.
  • [0]: Represents the position in the legs array.
  • Symbol: Option contract symbol or underlying symbol to be traded for this leg. In some cases, the space in an option symbol may need to be explicitly URI encoded as %20, such as MSFT%20220916C305.
legs[0].Ratio
number
Default: 1
  • legs: Individual components of a multi-part trade.
  • [0]: Represents the position in the legs array.
  • Ratio: The number of option contracts or underlying shares for this leg, relative to the other legs. Use a positive number to represent a buy trade and a negative number to represent a sell trade. For example, a quote for a Butterfly spread can be requested using ratios of 1, -2, and 1: buy 1 contract of the first leg, sell 2 contracts of the second leg, and buy 1 contract of the third leg.
riskFreeRate
number <double>

The theoretical rate of return of an investment with zero risk. Defaults to the current quote for $IRX.X. The percentage rate should be specified as a decimal value. For example, to use 2% for the rate, pass in 0.02.

enableGreeks
boolean
Default: true

Specifies whether or not greeks properties are returned.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/stream/options/quotes?legs%5B0%5D.Symbol=MSFT%20220916C305' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams.v2+json
{
  • "Delta": "0.0497",
  • "Theta": "-0.0049",
  • "Gamma": "-0.0004",
  • "Rho": "0.0005",
  • "Vega": "-0.0001",
  • "ImpliedVolatility": "0.3118",
  • "IntrinsicValue": "0",
  • "ExtrinsicValue": "0.3",
  • "TheoreticalValue": "0.2816",
  • "ProbabilityITM": "0.05",
  • "ProbabilityOTM": "0.95",
  • "ProbabilityBE": "0.0479",
  • "ProbabilityITM_IV": "0.0984",
  • "ProbabilityOTM_IV": "0.9016",
  • "ProbabilityBE_IV": "0.0956",
  • "TheoreticalValue_IV": "0.3",
  • "StandardDeviation": "0.0245",
  • "DailyOpenInterest": 1996,
  • "Ask": "0.7",
  • "Bid": "-0.1",
  • "Mid": "0.3",
  • "AskSize": 13,
  • "BidSize": 9,
  • "Close": "-0.44",
  • "High": "-0.19",
  • "Last": "-0.44",
  • "Low": "1.05",
  • "NetChange": "-1.01",
  • "NetChangePct": "-1.7719",
  • "Open": "0.46",
  • "PreviousClose": "0.57",
  • "Volume": 144,
  • "Side": "Put",
  • "Strikes": [
    ],
  • "Legs": [
    ]
}

Get Quote Snapshots

Fetches a full snapshot of the latest Quote for the given Symbols. For realtime Quote updates, users should use the Quote Stream endpoint.

path Parameters
symbols
required
string
Example: MSFT,BTCUSD

List of valid symbols in comma separated format; for example "MSFT,BTCUSD". No more than 100 symbols per request.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/quotes/MSFT,BTCUSD' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
Example
{
  • "Quotes": [
    ]
}

Stream Quotes

Streams Quote changes for one or more symbols.

path Parameters
symbols
required
string
Example: MSFT,BTCUSD

List of valid symbols in comma separated format; for example "MSFT,BTCUSD". No more than 100 symbols per request.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/stream/quotes/MSFT,BTCUSD' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams.v2+json
Example
{
  • "Symbol": "MSFT",
  • "Open": "213.65",
  • "PreviousClose": "214.46",
  • "Last": "212.85",
  • "Ask": "212.87",
  • "AskSize": "300",
  • "Bid": "212.85",
  • "BidSize": "200",
  • "NetChange": "-1.61",
  • "NetChangePct": "0.035",
  • "High52Week": "232.86",
  • "High52WeekTimestamp": "2020-09-02T00:00:00Z",
  • "Low52Week": "132.52",
  • "Low52WeekTimestamp": "2020-03-23T00:00:00Z",
  • "Volume": "5852511",
  • "PreviousVolume": "24154112",
  • "Close": "212.85",
  • "DailyOpenInterest": "0",
  • "TradeTime": "2020-11-18T15:19:14Z",
  • "TickSizeTier": "0",
  • "MarketFlags": {
    }
}

Stream Market Depth Quotes

Stream market depth quotes for equities, futures and stock options. A separate quote is returned for each price, side, and participant.

path Parameters
symbol
required
string
Example: MSFT

A valid symbol for the security.

query Parameters
maxlevels
integer <int32>
Default: 20

The maximum number of market depth levels to return. Must be a positive integer. If omitted it defaults to 20.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/stream/marketdepth/quotes/MSFT' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams.v2+json
Example
{
  • "Bids": [
    ],
  • "Asks": [
    ]
}

Stream Market Depth Aggregates

Stream aggregate market depth quotes for equities, futures and stock options. A separate quote is returned for each price and side, using aggregated data from the participants.

path Parameters
symbol
required
string
Example: MSFT

A valid symbol for the security.

query Parameters
maxlevels
integer <int32>
Default: 20

The maximum number of market depth levels to return. Must be a positive integer. If omitted it defaults to 20.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/marketdata/stream/marketdepth/aggregates/MSFT' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams.v2+json
Example
{
  • "Bids": [
    ],
  • "Asks": [
    ]
}

Brokerage

Get Accounts

Fetches the list of Brokerage Accounts available for the current user.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/accounts' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Accounts": [
    ]
}

Get Balances

Fetches the brokerage account Balances for one or more given accounts. Request valid for Cash, Margin, Futures, and DVP account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 Account IDs can be specified, comma separated. Recommended batch size is 10.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/accounts/61999124,68910124/balances' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Balances": [
    ],
  • "Errors": [
    ]
}

Get Balances BOD

Fetches the Beginning of Day Balances for the given Accounts. Request valid for Cash, Margin, Futures, and DVP account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 Account IDs can be specified, comma separated. Recommended batch size is 10.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/accounts/61999124,68910124/bodbalances' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "BODBalances": [
    ],
  • "Errors": [
    ]
}

Get Historical Orders

Fetches Historical Orders for the given Accounts except open orders, sorted in descending order of time closed. Request valid for all account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 Account IDs can be specified, comma separated. Recommended batch size is 10.

query Parameters
since
required
string
Example: since=2006-01-13

Historical orders since date. For example "2006-01-13","01-13-2006","2006/01/13","01/13/2006". Limited to 90 days prior to the current date.

pageSize
integer [ 1 .. 600 ]
Default: 600
Example: pageSize=600

The number of requests returned per page when paginating responses. If not provided, results will not be paginated and a maximum of 600 orders is returned.

nextToken
string
Example: nextToken=eyJ0aW1lc3RhbXAiOjE2NT...NTMwMDB9

An encrypted token with a lifetime of 1 hour for use with paginated order responses. This is returned with paginated results, and used in only the subsequent request which will return a new nextToken until there are fewer returned orders than the requested pageSize. If the number of returned orders equals the pageSize, and there are no additional orders, the nextToken will not be generated.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/accounts/61999124,68910124/historicalorders?since=2006-01-13' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Orders": [
    ],
  • "Errors": [ ],
  • "NextToken": "eyJ0aW1lc3RhbXAiOjE2NTY1NjI2MDQwMDEs>LTM3QzAtNEIxOS04OTU4LUExQ0YwQjYwRDM3NSIsImV4cGlyYXRpb25UaW1lc3RhbXAiOjE2NTY2OTM3NTMwMDB9"
}

Get Historical Orders By Order ID

Fetches Historical Orders for the given Accounts except open orders, filtered by given Order IDs prior to current date, sorted in descending order of time closed. Request valid for all account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 Account IDs can be specified, comma separated. Recommended batch size is 10.

orderIds
required
string
Example: 123456789,286179863

List of valid Order IDs for the authenticated user for given accounts in comma separated format; for example "123456789,286179863". 1 to 50 Order IDs can be specified, comma separated.

query Parameters
since
required
string
Example: since=2006-01-13

Historical orders since date. For example "2006-01-13","01-13-2006","2006/01/13","01/13/2006". Limited to 90 days prior to the current date.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/accounts/61999124,68910124/historicalorders/123456789,286179863?since=2006-01-13' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Orders": [
    ],
  • "Errors": [ ]
}

Get Orders

Fetches today's orders and open orders for the given Accounts, sorted in descending order of time placed for open and time executed for closed. Request valid for all account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 Account IDs can be specified, comma separated. Recommended batch size is 10.

query Parameters
pageSize
integer [ 1 .. 600 ]
Default: 600
Example: pageSize=600

The number of requests returned per page when paginating responses. If not provided, results will not be paginated and a maximum of 600 orders is returned.

nextToken
string
Example: nextToken=eyJ0aW1lc3RhbXAiOjE2NT...NTMwMDB9

An encrypted token with a lifetime of 1 hour for use with paginated order responses. This is returned with paginated results, and used in only the subsequent request which will return a new nextToken until there are fewer returned orders than the requested pageSize. If the number of returned orders equals the pageSize, and there are no additional orders, the nextToken will not be generated.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/accounts/61999124,68910124/orders' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Orders": [
    ],
  • "Errors": [ ],
  • "NextToken": "eyJ0aW1lc3RhbXAiOjE2NTY1NjI2MDQwMDEs>LTM3QzAtNEIxOS04OTU4LUExQ0YwQjYwRDM3NSIsImV4cGlyYXRpb25UaW1lc3RhbXAiOjE2NTY2OTM3NTMwMDB9"
}

Get Orders By Order ID

Fetches today's orders and open orders for the given Accounts, filtered by given Order IDs, sorted in descending order of time placed for open and time executed for closed. Request valid for all account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 Account IDs can be specified, comma separated. Recommended batch size is 10.

orderIds
required
string
Example: 123456789,286179863

List of valid Order IDs for the authenticated user for given accounts in comma separated format; for example "123456789,286179863". 1 to 50 Order IDs can be specified, comma separated.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/accounts/61999124,68910124/orders/123456789,286179863' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Orders": [
    ],
  • "Errors": [ ]
}

Get Positions

Fetches positions for the given Accounts. Request valid for Cash, Margin, Futures, and DVP account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 Account IDs can be specified, comma separated. Recommended batch size is 10.

query Parameters
symbol
string
Example: symbol=MSFT,MSFT *,AAPL

List of valid symbols in comma separated format; for example MSFT,MSFT *,AAPL. You can use an * as wildcard to make more complex filters.

Examples of the wildcard being used:

  • Get all options for MSFT: symbol=MSFT *
  • Get MSFT and all its options: symbol=MSFT,MSFT *
  • Get all MSFT options expiring in 2023: symbol=MSFT 23*
  • Get all MSFT options expiring in March 2023: symbol=MSFT 2303*
  • Get all options expiring in March 2023: symbol=* 2303*
  • Get all call options expiring in March 2023: symbol=* 2303*C*
  • Get BHM*: symbol=BHM**

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/accounts/61999124,68910124/positions' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Positions": [
    ],
  • "Errors": [
    ]
}

Stream Orders

Stream orders for the given accounts. Request valid for Cash, Margin, Futures, and DVP account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 Account IDs can be specified, comma separated.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/stream/accounts/61999124,68910124/orders' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams.v3+json
Example
[
  • {
    },
  • {
    },
  • {
    }
]

Stream Orders by Order Id

Stream orders for the given accounts and orders. Request valid for Cash, Margin, Futures, and DVP account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 account IDs can be specified, comma separated.

ordersIds
required
string
Example: 812767578,812941051

List of valid Order IDs for the account IDs in comma separated format; for example "812767578,812941051". 1 to 50 order IDs can be specified, comma separated.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/stream/accounts/61999124,68910124/orders/812767578,812941051' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams.v3+json
Example
[
  • {
    },
  • {
    },
  • {
    }
]

Stream Positions

Stream positions for the given accounts. Request valid for Cash, Margin, Futures, and DVP account types.

path Parameters
accounts
required
string
Example: 61999124,68910124

List of valid Account IDs for the authenticated user in comma separated format; for example "61999124,68910124". 1 to 25 Account IDs can be specified, comma separated.

query Parameters
changes
boolean
Default: false
Example: changes=true

A boolean value that specifies whether or not position updates are streamed as changes. When a stream is first opened with "changes=true", streaming positions will return the full snapshot first for all positions, and then any changes after that. When "changes=true", the PositionID field is returned with each change, along with the fields that changed.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/brokerage/stream/accounts/61999124,68910124/positions' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams.v3+json
Example
{
  • "AccountID": "123456782",
  • "AveragePrice": "216.68",
  • "AssetType": "STOCK",
  • "Last": "216.63",
  • "Bid": "216.62",
  • "Ask": "216.64",
  • "ConversionRate": "1",
  • "DayTradeRequirement": "0",
  • "InitialRequirement": "0",
  • "MaintenanceMargin": "0",
  • "PositionID": "64630792",
  • "LongShort": "Long",
  • "Quantity": "10",
  • "Symbol": "MSFT",
  • "Timestamp": "2020-11-16T16:53:37Z",
  • "TodaysProfitLoss": "-0.5",
  • "TotalCost": "2166.8",
  • "MarketValue": "2166.3",
  • "MarkToMarketPrice": "216.68",
  • "UnrealizedProfitLoss": "-0.5",
  • "UnrealizedProfitLossPercent": "-0.023",
  • "UnrealizedProfitLossQty": "-0.05"
}

Order Execution

Confirm Order

Returns estimated cost and commission information for an order without the order actually being placed. Request valid for Market, Limit, Stop Market, Stop Limit, Options, and Order Sends Order (OSO) order types. The fields that are returned in the response depend on the order type. The following shows the different fields that will be returned.

Base Confirmation (All confirmations will have these fields)

  • Route
  • Duration
  • Account
  • SummaryMessage

Equity Confirmation (Base Confirmation fields + the following)

  • EstimatedPrice
  • EstimatedPriceDisplay
  • EstimatedCost
  • EstimatedCostDisplay
  • EstimatedCommission
  • EstimatedCommissionDisplay
  • DebitCreditEstimatedCost
  • DebitCreditEstimatedCostDisplay
  • OrderConfirmId

Futures Confirmation (Base Confirmation fields + the following)

  • ProductCurrency
  • AccountCurrency
  • EstimatedCost
  • EstimatedPrice
  • EstimatedPriceDisplay
  • InitialMarginDisplay
  • EstimatedCommission
  • EstimatedCommissionDisplay
  • OrderConfirmId
Request Body schema: application/json

Order Confirmation request.

AccountID
required
string (AccountID)

TradeStation Account ID.

object (AdvancedOptions)
BuyingPowerWarning
string

For internal use only. For TradeStation Margin accounts enrolled in the Reg-T program, clients should send confirmation that the customer has been shown appropriate buying power warnings in advance of placing an order that could potentially violate the account's buying power. Valid values are: Enforce, Preconfirmed, and Confirmed.

Array of objects (OrderRequestLegs)
LimitPrice
string

The limit price for this order.

Array of objects (OrderRequestOSO)
OrderConfirmID
string [ 1 .. 22 ] characters

A unique identifier regarding an order used to prevent duplicates. Must be unique per API key, per order, per user.

OrderType
required
string (OrderType)
Enum: "Limit" "StopMarket" "Market" "StopLimit"

The order type of the order.

Quantity
required
string

The quantity of the order.

Route
string

The route of the order. For Stocks and Options, Route value will default to Intelligent if no value is set. Routes can be obtained from Get Routes.

StopPrice
string

The stop price for this order. If a TrailingStop amount or percent is passed in with the request (in the AdvancedOptions), and a StopPrice value is also passed in, the StopPrice value is ignored.

Symbol
required
string

The symbol used for this order.

required
object (TimeInForceRequest)

TimeInForce defines the duration and expiration timestamp.

TradeAction
required
string (TradeAction)

TradeAction represents the different trade actions that can be sent to or received from WebAPI. Conveys the intent of the trade:

  • BUY - equities and futures
  • SELL - equities and futures
  • BUYTOCOVER - equities
  • SELLSHORT - equities
  • BUYTOOPEN - options
  • BUYTOCLOSE - options
  • SELLTOOPEN - options
  • SELLTOCLOSE - options

Responses

Request samples

Content type
application/json
Example
{
  • "AccountID": "123456782",
  • "Symbol": "MSFT",
  • "Quantity": "10",
  • "OrderType": "Market",
  • "TradeAction": "BUY",
  • "TimeInForce": {
    },
  • "Route": "Intelligent"
}

Response samples

Content type
application/json
{
  • "Confirmations": [
    ]
}

Confirm Group Order

Creates an Order Confirmation for a group order. Request valid for all account types. Request valid for Order Cancels Order (OCO) and Bracket (BRK) order types as well as grouped orders of other types (NORMAL).

Order Cancels Order (OCO)

An OCO order is a group of orders whereby if one of the orders is filled or partially-filled, then all of the other orders in the group are cancelled.

Bracket OCO Orders

A bracket order is a special instance of an OCO (Order Cancel Order). Bracket orders are used to exit an existing position. They are designed to limit loss and lock in profit by “bracketing” an order with a simultaneous stop and limit order.

Bracket orders are limited so that the orders are all for the same symbol and are on the same side of the market (either all to sell or all to cover), and they are restricted to closing transactions.

The reason that they follow these rules is because the orders need to be able to auto decrement when a partial fill occurs with one of the orders. For example, if the customer has a sell limit order for 1000 shares and a sell stop order for 1000 shares, and the limit order is partially filled for 500 shares, then the customer would want the stop to remain open, but it should automatically decrement the order to 500 shares to match the remaining open position.

Note

When a group order is submitted, the order execution system treats each sibling order as an individual order. Thus, the system does not validate that each order has the same Quantity, and currently it is not able to update a bracket order as one transaction, instead you must update each order within a bracket.

Request Body schema: application/json

Order request

required
Array of objects (OrderRequest)
Type
required
string

The group order type. Valid values are: BRK, OCO, and NORMAL.

Responses

Request samples

Content type
application/json
Example
{
  • "Type": "OCO",
  • "Orders": [
    ]
}

Response samples

Content type
application/json
[
  • {
    }
]

Place Group Order

Submits a group order. Request valid for all account types. Request valid for Order Cancels Order (OCO) and Bracket (BRK) order types as well as grouped orders of other types (NORMAL).

Order Cancels Order (OCO)

An OCO order is a group of orders whereby if one of the orders is filled or partially-filled, then all of the other orders in the group are cancelled.

Bracket OCO Orders

A bracket order is a special instance of an OCO (Order Cancel Order). Bracket orders are used to exit an existing position. They are designed to limit loss and lock in profit by “bracketing” an order with a simultaneous stop and limit order.

Bracket orders are limited so that the orders are all for the same symbol and are on the same side of the market (either all to sell or all to cover), and they are restricted to closing transactions.

The reason that they follow these rules is because the orders need to be able to auto decrement when a partial fill occurs with one of the orders. For example, if the customer has a sell limit order for 1000 shares and a sell stop order for 1000 shares, and the limit order is partially filled for 500 shares, then the customer would want the stop to remain open, but it should automatically decrement the order to 500 shares to match the remaining open position.

Note

When a group order is submitted, the order execution system treats each sibling order as an individual order. Thus, the system does not validate that each order has the same Quantity, and currently it is not able to update a bracket order as one transaction, instead you must update each order within a bracket.

Request Body schema: application/json

Order request to place.

required
Array of objects (OrderRequest)
Type
required
string

The group order type. Valid values are: BRK, OCO, and NORMAL.

Responses

Request samples

Content type
application/json
Example
{
  • "Type": "OCO",
  • "Orders": [
    ]
}

Response samples

Content type
application/json
{
  • "Orders": [
    ],
  • "Errors": [
    ]
}

Place Order

Creates a new brokerage order. Request valid for all account types. Request valid for Market, Limit, Stop Market, Stop Limit, Options and Order Sends Order (OSO) order types.

Request Body schema: application/json

Order to place.

AccountID
required
string (AccountID)

TradeStation Account ID.

object (AdvancedOptions)
BuyingPowerWarning
string

For internal use only. For TradeStation Margin accounts enrolled in the Reg-T program, clients should send confirmation that the customer has been shown appropriate buying power warnings in advance of placing an order that could potentially violate the account's buying power. Valid values are: Enforce, Preconfirmed, and Confirmed.

Array of objects (OrderRequestLegs)
LimitPrice
string

The limit price for this order.

Array of objects (OrderRequestOSO)
OrderConfirmID
string [ 1 .. 22 ] characters

A unique identifier regarding an order used to prevent duplicates. Must be unique per API key, per order, per user.

OrderType
required
string (OrderType)
Enum: "Limit" "StopMarket" "Market" "StopLimit"

The order type of the order.

Quantity
required
string

The quantity of the order.

Route
string

The route of the order. For Stocks and Options, Route value will default to Intelligent if no value is set. Routes can be obtained from Get Routes.

StopPrice
string

The stop price for this order. If a TrailingStop amount or percent is passed in with the request (in the AdvancedOptions), and a StopPrice value is also passed in, the StopPrice value is ignored.

Symbol
required
string

The symbol used for this order.

required
object (TimeInForceRequest)

TimeInForce defines the duration and expiration timestamp.

TradeAction
required
string (TradeAction)

TradeAction represents the different trade actions that can be sent to or received from WebAPI. Conveys the intent of the trade:

  • BUY - equities and futures
  • SELL - equities and futures
  • BUYTOCOVER - equities
  • SELLSHORT - equities
  • BUYTOOPEN - options
  • BUYTOCLOSE - options
  • SELLTOOPEN - options
  • SELLTOCLOSE - options

Responses

Request samples

Content type
application/json
Example
{
  • "AccountID": "123456782",
  • "Symbol": "MSFT",
  • "Quantity": "10",
  • "OrderType": "Market",
  • "TradeAction": "BUY",
  • "TimeInForce": {
    },
  • "Route": "Intelligent"
}

Response samples

Content type
application/json
{
  • "Orders": [
    ],
  • "Errors": [
    ]
}

Replace Order

Replaces an active order with a modified version of that order. You cannot update an order that has been filled. Request valid for Cash, Margin, Futures, and DVP account types.

path Parameters
orderID
required
string
Example: 123456789

OrderID for order to replace. Equity, option or future orderIDs should not include dashes (E.g. 1-2345-6789). Valid format orderId=123456789

Request Body schema: application/json

Order to replace.

LimitPrice
string

The limit price for this order.

StopPrice
string

The stop price for this order. If a TrailingStop amount or percent is passed in with the request (in the AdvancedOptions), and a StopPrice value is also passed in, the StopPrice value is ignored.

OrderType
string

The order type of this order. Order type can only be updated to Market.

Quantity
string

The quantity of this order.

object (AdvancedOptionsReplace)

Responses

Request samples

Content type
application/json
Example
{
  • "Quantity": "10",
  • "LimitPrice": "132.52"
}

Response samples

Content type
application/json
{
  • "Message": "Cancel/Replace order sent.",
  • "OrderID": "123456789"
}

Cancel Order

Sends a cancellation request to the relevant exchange. Request valid for all account types.

path Parameters
orderID
required
string
Example: 123456789

Order ID for cancellation request. Equity, option or future orderIDs should not include dashes (E.g. 1-2345-6789). Valid format orderId=123456789

Responses

Request samples

curl --request DELETE \
  --url 'https://api.tradestation.com/v3/orderexecution/orders/123456789' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Message": "Cancel request sent",
  • "OrderID": "123456789"
}

Get Activation Triggers

To place orders with activation triggers, a valid TriggerKey must be sent with the order. This resource provides the available trigger methods with their corresponding key.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/orderexecution/activationtriggers' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "ActivationTriggers": [
    ]
}

Get Routes

Returns a list of valid routes that a client can specify when posting an order.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v3/orderexecution/routes' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json
{
  • "Routes": [
    ]
}

marketdata

Snapshots and live streams of market data from supported exchanges.

Suggest Symbols

Suggests symbols semantically based upon partial input of symbol name, company name, or description. Does not return Options symbols.

path Parameters
text
required
string

Symbol text for suggestion. Partial input of a symbol name, company name, or description.

query Parameters
$top
integer

The top number of results to return.

$filter
string

An OData filter to apply to the results. Supports the eq and neq filter opeators. E.g. AAP?$filter=Category%20neq%20%27Stock%27. Valid values are: Category (Stock, Index, Future, Forex), Country (E.g. United States, GB) Currency (E.g. USD, AUD), and Exchange (E.g. NYSE).

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v2/data/symbols/suggest/{text}' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json; charset=utf-8
[
  • {
    }
]

Search for Symbols

Searches symbols based upon input criteria including Name, Category and Country.

path Parameters
criteria
required
string

Criteria are represented as Key/value pairs (& separated):

N: Name of Symbol. (Optional)

C: Asset categories. (Optional) Possible values:

  • Future or FU
  • FutureOption or FO
  • Stock or S (Default)
  • StockOption or SO (If root is specified, default category)
  • Index or IDX
  • CurrencyOption or CO
  • MutualFund or MF
  • MoneyMarketFund or MMF
  • IndexOption or IO
  • Bond or B
  • Forex or FX

Cnt: Country where the symbol is traded in. (Optional) Possible values:

  • ALL if not specified (Default)
  • US
  • DE
  • CA

For Equities Lookups:

N: partial/full symbol name, will return all symbols that contain the provided name value

Desc: Name of the company

Flg: indicates whether symbols no longer trading should be included in the results returned. (Optional) This criteria is not returned in the symbol data. Possible values:

  • true
  • false (Default)

Cnt: Country where the symbol is traded in. (Optional) Possible values:

  • ALL if not specified (Default)
  • US
  • DE
  • CA

For Options Lookups:

(Category=StockOption, IndexOption, FutureOption or CurrencyOption)

R: Symbol root. Required field, the symbol the option is a derivative of, this search will not return options based on a partial root.

Stk: Number of strikes prices above and below the underlying price

  • Default value 3

Spl: Strike price low

Sph: Strike price high

Exd: Number of expiration dates.

  • Default value 3

Edl: Expiration date low, ex: 01-05-2011

Edh: Expiration date high, ex: 01-20-2011

OT: Option type. Possible values:

  • Both (Default)
  • Call
  • Put

FT: Future type for FutureOptions. Possible values:

  • Electronic (Default)
  • Pit

ST: Symbol type: Possible values:

  • Both
  • Composite (Default)
  • Regional

For Futures Lookups:

(Category = Future)

Desc: Description of symbol traded

R: Symbol root future trades

FT: Futures type. Possible values:

  • None
  • PIT
  • Electronic (Default)
  • Combined

Cur: Currency. Possible values:

  • All
  • USD (Default)
  • AUD
  • CAD
  • CHF
  • DKK
  • EUR
  • DBP
  • HKD
  • JPY
  • NOK
  • NZD
  • SEK
  • SGD

Exp: whether to include expired contracts

  • false (Default)
  • true

Cnt: Country where the symbol is traded in. (Optional) Possible values:

  • ALL if not specified (Default)
  • US
  • DE
  • CA

For Forex Lookups:

N: partial/full symbol name. Use all or null for a list of all forex symbols

Desc: Description

Note:

  • The exchange returned for all forex searches will be FX
  • The country returned for all forex searches will be FOREX

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v2/data/symbols/search/{criteria}' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/json; charset=utf-8
[
  • {
    }
]

Stream Tick Bars

Streams tick bars data for the regular session from a number of bars back, each bar returned separated by interval number of ticks.

path Parameters
symbol
required
string

A Symbol Name

interval
required
integer [ 1 .. 64999 ]

Interval for each bar returned (in ticks).

barsBack
required
integer [ 1 .. 10 ]

The number of bars to stream, going back from current time.

Responses

Request samples

curl --request GET \
  --url 'https://api.tradestation.com/v2/stream/tickbars/{symbol}/{interval}/{barsBack}' \
  --header 'Authorization: Bearer TOKEN'

Response samples

Content type
application/vnd.tradestation.streams+json
{
  • "Close": 0,
  • "Status": {
    },
  • "TimeStamp": "string",
  • "TotalVolume": 0
}