For AI agents: the complete documentation index is available at https://docs.snaptrade.com/llms.txt, and the full documentation text is available at https://docs.snaptrade.com/llms-full.txt. Markdown versions of documentation pages are available by appending .md to the URL path.
View as Markdown
Trading

Place option order

post
https://api.snaptrade.com/accounts/{accountId}/trading/options

Places a multi-leg option order. Only supported on certain option trading brokerages. https://support.snaptrade.com/brokerages has information on brokerage trading support

Execute an API Request

Authentication Method

Use commercial authentication when acting on behalf of your application and passing end-user credentials with requests that require them.

Credentials
Path
accountIdstring (format: uuid)required

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

Request Body
order_typestringrequired

The type of order to place.

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.
  • IOC - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
limit_pricestring (format: decimal) or null

The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.

stop_pricestring (format: decimal) or null

The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.

price_effectstring or null

The desired price_effect for LIMIT and STOP_LOSS_LIMIT orders. Values are CREDIT, DEBIT, EVEN

legsarray of objectsrequired
Request
Installation
$
npm install snaptrade-typescript-sdk
1
import {
2
Snaptrade,
3
SnaptradeAuth,
4
} from "snaptrade-typescript-sdk";
5
6
const snaptrade = new Snaptrade({
7
auth: SnaptradeAuth.commercialApiKey({
8
consumerKey: "CONSUMER_KEY",
9
clientId: "CLIENT_ID",
10
}),
11
});
12
13
const response =
14
await snaptrade.trading.placeMlegOrder({
15
accountId:
16
"917c8734-8470-4a3e-a18f-57c3f2ee6631",
17
userId: "USER_ID",
18
userSecret: "USER_SECRET",
19
order_type: "MARKET",
20
time_in_force: "Day",
21
price_effect: "DEBIT",
22
legs: [
23
{
24
instrument: {
25
symbol: "PBI 250718C00006000",
26
instrument_type: "INSTRUMENT_TYPE",
27
},
28
action: "BUY_TO_OPEN",
29
units: 1,
30
},
31
],
32
});
33
console.log(response.data);

Response fields

object

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

ordersarray of objects
1
{
2
"brokerage_order_id": "66a033fa-da74-4fcf-b527-feefdec9257e",
3
"orders": [
4
{
5
"brokerage_order_id": "66a033fa-da74-4fcf-b527-feefdec9257e",
6
"brokerage_group_order_id": "1234567890",
7
"order_role": "TRIGGER",
8
"status": "NONE",
9
"universal_symbol": {
10
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
11
"symbol": "VAB.TO",
12
"raw_symbol": "VAB",
13
"description": "VANGUARD CDN AGGREGATE BOND INDEX ETF",
14
"currency": {
15
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
16
"code": "USD",
17
"name": "US Dollar"
18
},
19
"exchange": {
20
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
21
"code": "TSX",
22
"mic_code": "XTSE",
23
"name": "Toronto Stock Exchange",
24
"timezone": "America/New_York",
25
"start_time": "09:30:00",
26
"close_time": "16:00:00",
27
"suffix": ".TO"
28
},
29
"type": {
30
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
31
"code": "cs",
32
"description": "Common Stock",
33
"is_supported": true
34
},
35
"figi_code": "BBG000B9XRY4",
36
"figi_instrument": {
37
"figi_code": "BBG000B9Y5X2",
38
"figi_share_class": "BBG001S5N8V8"
39
},
40
"currencies": [
41
{
42
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
43
"code": "USD",
44
"name": "US Dollar"
45
}
46
]
47
},
48
"option_symbol": {
49
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
50
"ticker": "AAPL 261218C00240000",
51
"option_type": "CALL",
52
"strike_price": 240,
53
"expiration_date": "2026-12-18T00:00:00.000Z",
54
"is_mini_option": false,
55
"underlying_symbol": {
56
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
57
"symbol": "SPY",
58
"raw_symbol": "VAB",
59
"description": "SPDR S&P 500 ETF Trust",
60
"currency": {
61
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
62
"code": "USD",
63
"name": "US Dollar"
64
},
65
"exchange": {
66
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
67
"code": "ARCX",
68
"mic_code": "ARCA",
69
"name": "NYSE ARCA",
70
"timezone": "America/New_York",
71
"start_time": "09:30:00",
72
"close_time": "16:00:00",
73
"suffix": "None",
74
"allows_cryptocurrency_symbols": false
75
},
76
"type": {
77
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
78
"code": "cs",
79
"description": "Common Stock",
80
"is_supported": true
81
},
82
"figi_code": "BBG000B9XRY4",
83
"figi_instrument": {
84
"figi_code": "BBG000B9Y5X2",
85
"figi_share_class": "BBG001S5N8V8"
86
},
87
"currencies": [
88
{
89
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
90
"code": "USD",
91
"name": "US Dollar"
92
}
93
]
94
}
95
},
96
"quote_universal_symbol": {
97
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
98
"symbol": "VAB.TO",
99
"raw_symbol": "VAB",
100
"description": "VANGUARD CDN AGGREGATE BOND INDEX ETF",
101
"currency": {
102
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
103
"code": "USD",
104
"name": "US Dollar"
105
},
106
"exchange": {
107
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
108
"code": "TSX",
109
"mic_code": "XTSE",
110
"name": "Toronto Stock Exchange",
111
"timezone": "America/New_York",
112
"start_time": "09:30:00",
113
"close_time": "16:00:00",
114
"suffix": ".TO"
115
},
116
"type": {
117
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
118
"code": "cs",
119
"description": "Common Stock",
120
"is_supported": true
121
},
122
"figi_code": "BBG000B9XRY4",
123
"figi_instrument": {
124
"figi_code": "BBG000B9Y5X2",
125
"figi_share_class": "BBG001S5N8V8"
126
},
127
"currencies": [
128
{
129
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
130
"code": "USD",
131
"name": "US Dollar"
132
}
133
]
134
},
135
"quote_currency": {
136
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
137
"code": "USD",
138
"name": "US Dollar"
139
},
140
"action": "string",
141
"total_quantity": "100",
142
"open_quantity": "10",
143
"canceled_quantity": "10",
144
"filled_quantity": "80",
145
"execution_price": "12.34",
146
"limit_price": "12.34",
147
"stop_price": "12.50",
148
"trailing_stop": {
149
"amount": "0.60",
150
"type": "DOLLAR"
151
},
152
"order_type": "Market",
153
"time_in_force": "string",
154
"time_placed": "2024-07-30T22:51:49.746Z",
155
"time_updated": "2024-08-05T00:05:57.409Z",
156
"time_executed": "2024-08-05T00:05:57.409Z",
157
"expiry_date": "2024-08-05T00:05:57.409Z",
158
"symbol": "2bcd7cc3-e922-4976-bce1-9858296801c3",
159
"child_brokerage_order_ids": {
160
"take_profit_order_id": "12345678",
161
"stop_loss_order_id": "12345678"
162
}
163
}
164
]
165
}