snaptrade-typescript-sdk 9.0.122 → 9.0.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect brokerage accounts to your app for live positions and trading
8
8
 
9
- [![npm](https://img.shields.io/badge/npm-v9.0.122-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/9.0.122)
9
+ [![npm](https://img.shields.io/badge/npm-v9.0.124-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/9.0.124)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -65,11 +65,11 @@ Connect brokerage accounts to your app for live positions and trading
65
65
  * [`snaptrade.trading.getOrderImpact`](#snaptradetradinggetorderimpact)
66
66
  * [`snaptrade.trading.getUserAccountQuotes`](#snaptradetradinggetuseraccountquotes)
67
67
  * [`snaptrade.trading.placeBracketOrder`](#snaptradetradingplacebracketorder)
68
+ * [`snaptrade.trading.placeCryptoOrder`](#snaptradetradingplacecryptoorder)
68
69
  * [`snaptrade.trading.placeForceOrder`](#snaptradetradingplaceforceorder)
69
70
  * [`snaptrade.trading.placeMlegOrder`](#snaptradetradingplacemlegorder)
70
71
  * [`snaptrade.trading.placeOrder`](#snaptradetradingplaceorder)
71
- * [`snaptrade.trading.placeSimpleOrder`](#snaptradetradingplacesimpleorder)
72
- * [`snaptrade.trading.previewSimpleOrder`](#snaptradetradingpreviewsimpleorder)
72
+ * [`snaptrade.trading.previewCryptoOrder`](#snaptradetradingpreviewcryptoorder)
73
73
  * [`snaptrade.trading.replaceOrder`](#snaptradetradingreplaceorder)
74
74
  * [`snaptrade.trading.searchCryptocurrencyPairInstruments`](#snaptradetradingsearchcryptocurrencypairinstruments)
75
75
  * [`snaptrade.transactionsAndReporting.getActivities`](#snaptradetransactionsandreportinggetactivities)
@@ -1718,7 +1718,7 @@ The search query for symbols.
1718
1718
 
1719
1719
  ### `snaptrade.trading.cancelOrder`<a id="snaptradetradingcancelorder"></a>
1720
1720
 
1721
- Cancels an order in the specified account.
1721
+ Cancels an order in the specified account. Accepts order IDs for all asset types.
1722
1722
 
1723
1723
 
1724
1724
  #### 🛠️ Usage<a id="🛠️-usage"></a>
@@ -1758,7 +1758,9 @@ Order ID returned by brokerage. This is the unique identifier for the order in t
1758
1758
 
1759
1759
 
1760
1760
  ### `snaptrade.trading.cancelUserAccountOrder`<a id="snaptradetradingcanceluseraccountorder"></a>
1761
+ ![Deprecated](https://img.shields.io/badge/deprecated-yellow)
1761
1762
 
1763
+ **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) **
1762
1764
  Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
1763
1765
 
1764
1766
 
@@ -2047,6 +2049,89 @@ Number of shares for the order. This can be a decimal for fractional orders. Mus
2047
2049
  ---
2048
2050
 
2049
2051
 
2052
+ ### `snaptrade.trading.placeCryptoOrder`<a id="snaptradetradingplacecryptoorder"></a>
2053
+
2054
+ Places an order in the specified account.
2055
+ This endpoint does not compute the impact to the account balance from the order before submitting the order.
2056
+
2057
+
2058
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
2059
+
2060
+ ```typescript
2061
+ const placeCryptoOrderResponse = await snaptrade.trading.placeCryptoOrder({
2062
+ userId: "snaptrade-user-123",
2063
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2064
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2065
+ instrument: {
2066
+ symbol: "BTC",
2067
+ type: "CRYPTOCURRENCY",
2068
+ },
2069
+ side: "BUY",
2070
+ type: "MARKET",
2071
+ time_in_force: "GTC",
2072
+ amount: "123.45",
2073
+ limit_price: "123.45",
2074
+ stop_price: "123.45",
2075
+ post_only: false,
2076
+ expiration_date: "2024-01-01T00:00:00Z",
2077
+ });
2078
+ ```
2079
+
2080
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2081
+
2082
+ ##### instrument: [`CryptoTradingInstrument`](./models/crypto-trading-instrument.ts)<a id="instrument-cryptotradinginstrumentmodelscrypto-trading-instrumentts"></a>
2083
+
2084
+ ##### side: [`ActionStrict`](./models/action-strict.ts)<a id="side-actionstrictmodelsaction-strictts"></a>
2085
+
2086
+ The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
2087
+
2088
+ ##### type: `string`<a id="type-string"></a>
2089
+
2090
+ The type of order to place.
2091
+
2092
+ ##### time_in_force: `string`<a id="time_in_force-string"></a>
2093
+
2094
+ The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `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.
2095
+
2096
+ ##### amount: `string`<a id="amount-string"></a>
2097
+
2098
+ The amount of the base currency to buy or sell.
2099
+
2100
+ ##### userId: `string`<a id="userid-string"></a>
2101
+
2102
+ ##### userSecret: `string`<a id="usersecret-string"></a>
2103
+
2104
+ ##### accountId: `string`<a id="accountid-string"></a>
2105
+
2106
+ ##### limit_price: `string`<a id="limit_price-string"></a>
2107
+
2108
+ The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
2109
+
2110
+ ##### stop_price: `string`<a id="stop_price-string"></a>
2111
+
2112
+ The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
2113
+
2114
+ ##### post_only: `boolean`<a id="post_only-boolean"></a>
2115
+
2116
+ Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
2117
+
2118
+ ##### expiration_date: `string`<a id="expiration_date-string"></a>
2119
+
2120
+ The expiration date of the order. Required if the time_in_force is GTD.
2121
+
2122
+ #### 🔄 Return<a id="🔄-return"></a>
2123
+
2124
+ [OrderUpdatedResponse](./models/order-updated-response.ts)
2125
+
2126
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2127
+
2128
+ `/accounts/{accountId}/trading/crypto` `POST`
2129
+
2130
+ [🔙 **Back to Table of Contents**](#table-of-contents)
2131
+
2132
+ ---
2133
+
2134
+
2050
2135
  ### `snaptrade.trading.placeForceOrder`<a id="snaptradetradingplaceforceorder"></a>
2051
2136
 
2052
2137
  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.
@@ -2065,7 +2150,7 @@ const placeForceOrderResponse = await snaptrade.trading.placeForceOrder({
2065
2150
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2066
2151
  action: "BUY",
2067
2152
  universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
2068
- symbol: "AAPL 131124C00240000",
2153
+ symbol: "AAPL",
2069
2154
  order_type: "Market",
2070
2155
  time_in_force: "Day",
2071
2156
  price: 31.33,
@@ -2102,7 +2187,7 @@ The universal symbol ID of the security to trade. Must be \\\'null\\\' if `symbo
2102
2187
 
2103
2188
  ##### symbol: `string`<a id="symbol-string"></a>
2104
2189
 
2105
- The security\\\'s trading ticker symbol. This currently supports stock symbols and 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](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If \\\'symbol\\\' is provided, then \\\'universal_symbol_id\\\' must be \\\'null\\\'.
2190
+ The security\\\'s trading ticker symbol. If \\\'symbol\\\' is provided, then \\\'universal_symbol_id\\\' must be \\\'null\\\'.
2106
2191
 
2107
2192
  ##### price: `number`<a id="price-number"></a>
2108
2193
 
@@ -2247,90 +2332,7 @@ Optional, defaults to true. Determines if a wait is performed to check on order
2247
2332
  ---
2248
2333
 
2249
2334
 
2250
- ### `snaptrade.trading.placeSimpleOrder`<a id="snaptradetradingplacesimpleorder"></a>
2251
-
2252
- Places an order in the specified account.
2253
- This endpoint does not compute the impact to the account balance from the order before submitting the order.
2254
-
2255
-
2256
- #### 🛠️ Usage<a id="🛠️-usage"></a>
2257
-
2258
- ```typescript
2259
- const placeSimpleOrderResponse = await snaptrade.trading.placeSimpleOrder({
2260
- userId: "snaptrade-user-123",
2261
- userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2262
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2263
- instrument: {
2264
- symbol: "AAPL",
2265
- type: "EQUITY",
2266
- },
2267
- side: "BUY",
2268
- type: "MARKET",
2269
- time_in_force: "GTC",
2270
- amount: "123.45",
2271
- limit_price: "123.45",
2272
- stop_price: "123.45",
2273
- post_only: false,
2274
- expiration_date: "2024-01-01T00:00:00Z",
2275
- });
2276
- ```
2277
-
2278
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2279
-
2280
- ##### instrument: [`TradingInstrument`](./models/trading-instrument.ts)<a id="instrument-tradinginstrumentmodelstrading-instrumentts"></a>
2281
-
2282
- ##### side: [`ActionStrict`](./models/action-strict.ts)<a id="side-actionstrictmodelsaction-strictts"></a>
2283
-
2284
- The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
2285
-
2286
- ##### type: `string`<a id="type-string"></a>
2287
-
2288
- The type of order to place.
2289
-
2290
- ##### time_in_force: `string`<a id="time_in_force-string"></a>
2291
-
2292
- The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `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.
2293
-
2294
- ##### amount: `string`<a id="amount-string"></a>
2295
-
2296
- The amount of the base currency to buy or sell.
2297
-
2298
- ##### userId: `string`<a id="userid-string"></a>
2299
-
2300
- ##### userSecret: `string`<a id="usersecret-string"></a>
2301
-
2302
- ##### accountId: `string`<a id="accountid-string"></a>
2303
-
2304
- ##### limit_price: `string`<a id="limit_price-string"></a>
2305
-
2306
- The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
2307
-
2308
- ##### stop_price: `string`<a id="stop_price-string"></a>
2309
-
2310
- The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
2311
-
2312
- ##### post_only: `boolean`<a id="post_only-boolean"></a>
2313
-
2314
- Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
2315
-
2316
- ##### expiration_date: `string`<a id="expiration_date-string"></a>
2317
-
2318
- The expiration date of the order. Required if the time_in_force is GTD.
2319
-
2320
- #### 🔄 Return<a id="🔄-return"></a>
2321
-
2322
- [OrderUpdatedResponse](./models/order-updated-response.ts)
2323
-
2324
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2325
-
2326
- `/accounts/{accountId}/trading/simple` `POST`
2327
-
2328
- [🔙 **Back to Table of Contents**](#table-of-contents)
2329
-
2330
- ---
2331
-
2332
-
2333
- ### `snaptrade.trading.previewSimpleOrder`<a id="snaptradetradingpreviewsimpleorder"></a>
2335
+ ### `snaptrade.trading.previewCryptoOrder`<a id="snaptradetradingpreviewcryptoorder"></a>
2334
2336
 
2335
2337
  Previews an order using the specified account.
2336
2338
 
@@ -2338,13 +2340,13 @@ Previews an order using the specified account.
2338
2340
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2339
2341
 
2340
2342
  ```typescript
2341
- const previewSimpleOrderResponse = await snaptrade.trading.previewSimpleOrder({
2343
+ const previewCryptoOrderResponse = await snaptrade.trading.previewCryptoOrder({
2342
2344
  userId: "snaptrade-user-123",
2343
2345
  userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2344
2346
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2345
2347
  instrument: {
2346
- symbol: "AAPL",
2347
- type: "EQUITY",
2348
+ symbol: "BTC",
2349
+ type: "CRYPTOCURRENCY",
2348
2350
  },
2349
2351
  side: "BUY",
2350
2352
  type: "MARKET",
@@ -2359,7 +2361,7 @@ const previewSimpleOrderResponse = await snaptrade.trading.previewSimpleOrder({
2359
2361
 
2360
2362
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2361
2363
 
2362
- ##### instrument: [`TradingInstrument`](./models/trading-instrument.ts)<a id="instrument-tradinginstrumentmodelstrading-instrumentts"></a>
2364
+ ##### instrument: [`CryptoTradingInstrument`](./models/crypto-trading-instrument.ts)<a id="instrument-cryptotradinginstrumentmodelscrypto-trading-instrumentts"></a>
2363
2365
 
2364
2366
  ##### side: [`ActionStrict`](./models/action-strict.ts)<a id="side-actionstrictmodelsaction-strictts"></a>
2365
2367
 
@@ -2401,11 +2403,11 @@ The expiration date of the order. Required if the time_in_force is GTD.
2401
2403
 
2402
2404
  #### 🔄 Return<a id="🔄-return"></a>
2403
2405
 
2404
- [SimpleOrderPreview](./models/simple-order-preview.ts)
2406
+ [CryptoOrderPreview](./models/crypto-order-preview.ts)
2405
2407
 
2406
2408
  #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2407
2409
 
2408
- `/accounts/{accountId}/trading/simple/preview` `POST`
2410
+ `/accounts/{accountId}/trading/crypto/preview` `POST`
2409
2411
 
2410
2412
  [🔙 **Back to Table of Contents**](#table-of-contents)
2411
2413
 
@@ -2424,9 +2426,9 @@ returned in the response going forward. Only supported on some brokerages
2424
2426
  ```typescript
2425
2427
  const replaceOrderResponse = await snaptrade.trading.replaceOrder({
2426
2428
  accountId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
2427
- brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
2428
2429
  userId: "snaptrade-user-123",
2429
2430
  userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2431
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
2430
2432
  action: "BUY",
2431
2433
  order_type: "Market",
2432
2434
  time_in_force: "Day",
@@ -2439,6 +2441,10 @@ const replaceOrderResponse = await snaptrade.trading.replaceOrder({
2439
2441
 
2440
2442
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2441
2443
 
2444
+ ##### brokerage_order_id: `string`<a id="brokerage_order_id-string"></a>
2445
+
2446
+ Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
2447
+
2442
2448
  ##### action: [`ActionStrict`](./models/action-strict.ts)<a id="action-actionstrictmodelsaction-strictts"></a>
2443
2449
 
2444
2450
  The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
@@ -2455,10 +2461,6 @@ The Time in Force type for the order. This field indicates how long the order wi
2455
2461
 
2456
2462
  The ID of the account to execute the trade on.
2457
2463
 
2458
- ##### brokerageOrderId: `string`<a id="brokerageorderid-string"></a>
2459
-
2460
- The Brokerage Order ID of the order to replace.
2461
-
2462
2464
  ##### userId: `string`<a id="userid-string"></a>
2463
2465
 
2464
2466
  ##### userSecret: `string`<a id="usersecret-string"></a>
@@ -2483,7 +2485,7 @@ The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
2483
2485
 
2484
2486
  #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2485
2487
 
2486
- `/accounts/{accountId}/trading/simple/{brokerageOrderId}/replace` `PATCH`
2488
+ `/accounts/{accountId}/trading/replace` `POST`
2487
2489
 
2488
2490
  [🔙 **Back to Table of Contents**](#table-of-contents)
2489
2491