Trading

Place order

post
https://api.snaptrade.com/api/v1/trade/place

Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds.

This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the check order impact endpoint.

It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the manual refresh endpoint for this.

Execute an API Request

Query
userIdstringrequired

SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.

userSecretstringrequired

SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the rotate user secret endpoint.

Request Body
account_idstring (format: uuid)required

Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.

actionstringrequired

The action describes the intent or side of a trade. This is either BUY or SELL for Equity symbols or BUY_TO_OPEN, BUY_TO_CLOSE, SELL_TO_OPEN or SELL_TO_CLOSE for Options.

universal_symbol_idstring (format: uuid) or null

The universal symbol ID of the security to trade. Must be 'null' if symbol is provided, otherwise must be provided.

symbolstring or null

The security's trading ticker symbol. This currently only support Options symbols in the 21 character OCC format. For example "AAPL 131124C00240000" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see here. If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.

order_typestringrequired

The type of order to place.

  • For Limit and StopLimit orders, the price field is required.
  • For Stop and StopLimit orders, the stop field is required.
time_in_forcestringrequired

The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values:

  • Day - Day. The order is valid only for the trading day on which it is placed.
  • GTC - Good Til Canceled. The order is valid until it is executed or canceled.
  • FOK - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
pricenumber or null

The limit price for Limit and StopLimit orders.

stopnumber or null

The price at which a stop order is triggered for Stop and StopLimit orders.

unitsnumber or null

For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be null if notional_value is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).

notional_value or null

Total notional amount for the order. Must be null if units is provided. Can only work with Market for order_type and Day for time_in_force. This is only available for certain brokerages. Please check the integrations doc for more information.

Authorization
Request
Installation
$
npm install snaptrade-typescript-sdk
1
Loading...

Response fields

object

Describes a single recent order in an account. Each record here represents a single order leg. For multi-leg orders, there will be multiple records.

brokerage_order_idstring

Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.

statusstring

Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum.

universal_symbolobject

Contains information about the security that the order is for. This field is only present for stock/ETF/crypto/mutual fund orders. For option orders, this field will be null and the option_symbol field will be populated.

option_symbolobject

Contains information about the option contract that the order is for. This field is only present for option orders. For stock/ETF/crypto/mutual fund orders, this field will be null and the universal_symbol field will be populated.

actionstring

The action describes the intent or side of a trade. This is usually BUY or SELL but can include other potential values like the following depending on the specific brokerage.

  • BUY
  • SELL
  • BUY_COVER
  • SELL_SHORT
  • BUY_OPEN
  • BUY_CLOSE
  • SELL_OPEN
  • SELL_CLOSE
total_quantitynumber or null

The total number of shares or contracts of the order. This should be the sum of the filled, canceled, and open quantities. Can be a decimal number for fractional shares.

open_quantitynumber or null

The number of shares or contracts that are still open (waiting for execution). Can be a decimal number for fractional shares.

canceled_quantitynumber or null

The number of shares or contracts that have been canceled. Can be a decimal number for fractional shares.

filled_quantitynumber or null

The number of shares or contracts that have been filled. Can be a decimal number for fractional shares.

execution_pricenumber or null

The price at which the order was executed.

limit_pricenumber or null

The limit price is maximum price one is willing to pay for a buy order or the minimum price one is willing to accept for a sell order. Should only apply to Limit and StopLimit orders.

stop_pricenumber or null

The stop price is the price at which a stop order is triggered. Should only apply to Stop and StopLimit orders.

order_typestring or null

The type of order placed. The most common values are Market, Limit, Stop, and StopLimit. We try our best to map brokerage order types to these values. When mapping fails, we will return the brokerage's order type value.

time_in_forcestring

The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. We try our best to map brokerage time in force values to the following. When mapping fails, we will return the brokerage's time in force value.

  • Day - Day. The order is valid only for the trading day on which it is placed.
  • GTC - Good Til Canceled. The order is valid until it is executed or canceled.
  • FOK - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
  • IOC - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
  • GTD - Good Til Date. The order is valid until the specified date.
  • MOO - Market On Open. The order is to be executed at the day's opening price.
  • EHP - Extended Hours P.M. The order is to be placed during extended hour trading, after markets close.
time_placedstring (format: date-time)

The time the order was placed. This is the time the order was submitted to the brokerage.

time_updatedstring (format: date-time) or null

The time the order was last updated in the brokerage system. This value is not always available from the brokerage.

time_executedstring (format: date-time) or null

The time the order was executed in the brokerage system. This value is not always available from the brokerage.

expiry_datestring (format: date-time) or null

The time the order expires. This value is not always available from the brokerage.

symbolstring (format: uuid)

A unique ID for the security within SnapTrade, scoped to the brokerage account that the security belongs to. This is a legacy field and should not be used. Do not rely on this being a stable ID as it can change.

1
{
2
"brokerage_order_id": "66a033fa-da74-4fcf-b527-feefdec9257e",
3
"status": "NONE",
4
"universal_symbol": {
5
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
6
"symbol": "VAB.TO",
7
"raw_symbol": "VAB",
8
"description": "VANGUARD CDN AGGREGATE BOND INDEX ETF",
9
"currency": {
10
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
11
"code": "USD",
12
"name": "US Dollar"
13
},
14
"exchange": {
15
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
16
"code": "TSX",
17
"mic_code": "XTSE",
18
"name": "Toronto Stock Exchange",
19
"timezone": "America/New_York",
20
"start_time": "09:30:00",
21
"close_time": "16:00:00",
22
"suffix": ".TO"
23
},
24
"type": {
25
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
26
"code": "cs",
27
"description": "Common Stock",
28
"is_supported": true
29
},
30
"figi_code": "BBG000B9XRY4",
31
"figi_instrument": {
32
"figi_code": "BBG000B9Y5X2",
33
"figi_share_class": "BBG001S5N8V8"
34
},
35
"currencies": [
36
{
37
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
38
"code": "USD",
39
"name": "US Dollar"
40
}
41
]
42
},
43
"option_symbol": {
44
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
45
"ticker": "AAPL 261218C00240000",
46
"option_type": "CALL",
47
"strike_price": 240,
48
"expiration_date": "2026-12-18",
49
"is_mini_option": false,
50
"underlying_symbol": {
51
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
52
"symbol": "SPY",
53
"raw_symbol": "VAB",
54
"description": "SPDR S&P 500 ETF Trust",
55
"currency": {
56
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
57
"code": "USD",
58
"name": "US Dollar"
59
},
60
"exchange": {
61
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
62
"code": "ARCX",
63
"mic_code": "ARCA",
64
"name": "NYSE ARCA",
65
"timezone": "America/New_York",
66
"start_time": "09:30:00",
67
"close_time": "16:00:00",
68
"suffix": "None",
69
"allows_cryptocurrency_symbols": false
70
},
71
"type": {
72
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
73
"code": "cs",
74
"description": "Common Stock",
75
"is_supported": true
76
},
77
"figi_code": "BBG000B9XRY4",
78
"figi_instrument": {
79
"figi_code": "BBG000B9Y5X2",
80
"figi_share_class": "BBG001S5N8V8"
81
},
82
"currencies": [
83
{
84
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
85
"code": "USD",
86
"name": "US Dollar"
87
}
88
]
89
}
90
},
91
"action": "string",
92
"total_quantity": 100,
93
"open_quantity": 10,
94
"canceled_quantity": 10,
95
"filled_quantity": 80,
96
"execution_price": 12.34,
97
"limit_price": 12.34,
98
"stop_price": 12.5,
99
"order_type": "Market",
100
"time_in_force": "string",
101
"time_placed": "2024-07-30T22:51:49.746Z",
102
"time_updated": "2024-08-05T00:05:57.409Z",
103
"time_executed": "2024-08-05T00:05:57.409Z",
104
"expiry_date": "2024-08-05T00:05:57.409Z",
105
"symbol": "2bcd7cc3-e922-4976-bce1-9858296801c3"
106
}