logo
Trading

Cancel open order in account

post
https://api.snaptrade.com/api/v1/accounts/{accountId}/orders/cancel

Sends a signal to the brokerage to cancel the specified order. This will only work if the order has not yet been executed.

Execute an API Request

Path
accountIdstring (format: uuid)required

The ID of the account to cancel the order in.

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 (generated when registering user)

Request Body
brokerage_order_idstring (format: uuid)
Authorization
Request
Installation
$
npm install snaptrade-typescript-sdk
1
Loading...

Response fields

object

Record of order in brokerageaccount

brokerage_order_idstring

Order id returned by brokerage

statusstring
symbolstring (format: uuid)
universal_symbolobject

Universal symbol

option_symbolobject

Options Symbol

actionstring

Trade Action potential values include (but are not limited to) - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - SELL_CLOSE

total_quantitynumber or null

Trade Units. Cannot work with notional value.

open_quantitynumber or null

Trade Units

canceled_quantitynumber or null

Trade Units

filled_quantitynumber or null

Trade Units

execution_pricenumber or null

Trade Price if limit or stop limit order

limit_pricenumber or null

Trade Price if limit or stop limit order

stop_pricenumber or null

Stop Price. If stop loss or stop limit order, the price to trigger the stop

order_typestring or null

Order Type potential values include (but are not limited to) - Limit - Market - StopLimit - StopLoss

time_in_forcestring

Trade time in force examples:

  • FOK - Fill Or Kill
  • Day - Day
  • GTC - Good Til Canceled
  • GTD - Good Til Date
time_placedstring

Time

time_updatedstring or null

Time

time_executedstring or null

Time

expiry_datestring

Time

1
{
2
"brokerage_order_id": "string",
3
"status": "NONE",
4
"symbol": "2bcd7cc3-e922-4976-bce1-9858296801c3",
5
"universal_symbol": {
6
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
7
"symbol": "VAB.TO",
8
"raw_symbol": "VAB",
9
"description": "VANGUARD CDN AGGREGATE BOND INDEX ETF",
10
"currency": {
11
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
12
"code": "USD",
13
"name": "US Dollar"
14
},
15
"exchange": {
16
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
17
"code": "TSX",
18
"mic_code": "XTSE",
19
"name": "Toronto Stock Exchange",
20
"timezone": "America/New_York",
21
"start_time": "09:30:00",
22
"close_time": "16:00:00",
23
"suffix": ".TO"
24
},
25
"type": {
26
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
27
"code": "cs",
28
"description": "Common Stock",
29
"is_supported": true
30
},
31
"currencies": [
32
{
33
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
34
"code": "USD",
35
"name": "US Dollar"
36
}
37
],
38
"figi_code": "BBG000B9XRY4",
39
"figi_instrument": {
40
"figi_code": "BBG000B9Y5X2",
41
"figi_share_class": "BBG001S5N8V8"
42
}
43
},
44
"option_symbol": {
45
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
46
"ticker": "SPY 220819P00200000",
47
"option_type": "CALL",
48
"strike_price": 200,
49
"expiration_date": "2017-07-17T15:13:07.177712+00:00",
50
"is_mini_option": false,
51
"underlying_symbol": {
52
"id": "2bcd7cc3-e922-4976-bce1-9858296801c3",
53
"symbol": "SPY",
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
"currencies": [
78
{
79
"id": "87b24961-b51e-4db8-9226-f198f6518a89",
80
"code": "USD",
81
"name": "US Dollar"
82
}
83
],
84
"figi_code": "BBG000B9XRY4",
85
"figi_instrument": {
86
"figi_code": "BBG000B9Y5X2",
87
"figi_share_class": "BBG001S5N8V8"
88
}
89
},
90
"local_id": "40817960",
91
"exchange_id": "6e73ee7b-fdf3-44c2-947d-260c3ee72506"
92
},
93
"action": "string",
94
"total_quantity": 0,
95
"open_quantity": 0,
96
"canceled_quantity": 0,
97
"filled_quantity": 0,
98
"execution_price": 31.33,
99
"limit_price": 31.33,
100
"stop_price": 31.33,
101
"order_type": "string",
102
"time_in_force": "string",
103
"time_placed": "2022-01-21T20:11:19.217Z",
104
"time_updated": "2022-01-21T20:11:19.217Z",
105
"time_executed": "2022-01-21T20:11:19.217Z",
106
"expiry_date": "2022-01-21T20:11:19.217Z"
107
}