snaptrade-typescript-sdk 13.1.15 → 13.2.1

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
@@ -63,7 +63,7 @@ backoff with jitter rather than from the headers.
63
63
  See https://docs.snaptrade.com/docs/ratelimiting.
64
64
 
65
65
 
66
- [![npm](https://img.shields.io/badge/npm-v13.1.15-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.1.15)
66
+ [![npm](https://img.shields.io/badge/npm-v13.2.1-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.2.1)
67
67
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
68
68
 
69
69
  </div>
@@ -76,6 +76,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
76
76
  - [Authentication](#authentication)
77
77
  * [Commercial API Key Auth authentication](#commercial-api-key-auth-authentication)
78
78
  * [Personal API Key Auth authentication](#personal-api-key-auth-authentication)
79
+ * [OAuth Auth authentication](#oauth-auth-authentication)
79
80
  - [Getting Started](#getting-started)
80
81
  - [Reference](#reference)
81
82
  * [`snaptrade.accountInformation.getAccountActivities`](#snaptradeaccountinformationgetaccountactivities)
@@ -141,6 +142,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
141
142
  * [`snaptrade.trading.previewCryptoOrder`](#snaptradetradingpreviewcryptoorder)
142
143
  * [`snaptrade.trading.replaceOrder`](#snaptradetradingreplaceorder)
143
144
  * [`snaptrade.trading.searchCryptocurrencyPairInstruments`](#snaptradetradingsearchcryptocurrencypairinstruments)
145
+ * [Device authorization](#device-authorization)
144
146
 
145
147
  <!-- tocstop -->
146
148
 
@@ -208,6 +210,19 @@ const personalApiKeyClient = new Snaptrade({
208
210
  });
209
211
  ```
210
212
 
213
+ ### OAuth Auth authentication<a id="oauth-auth-authentication"></a>
214
+ Supply an existing access token. Your application handles token storage, refresh and callback validation.
215
+
216
+ ```typescript
217
+ import { Snaptrade, SnaptradeAuth } from "snaptrade-typescript-sdk";
218
+
219
+ const oauthClient = new Snaptrade({
220
+ auth: SnaptradeAuth.oauth({
221
+ accessToken: "ACCESS_TOKEN",
222
+ }),
223
+ });
224
+ ```
225
+
211
226
  ## Getting Started<a id="getting-started"></a>
212
227
 
213
228
  ```typescript
@@ -358,6 +373,22 @@ const getAccountActivitiesResponse =
358
373
 
359
374
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
360
375
 
376
+ ##### OAuth Auth<a id="oauth-auth"></a>
377
+
378
+ ```typescript
379
+ const getAccountActivitiesResponse =
380
+ await oauthClient.accountInformation.getAccountActivities({
381
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
382
+ startDate: "2022-01-24T00:00:00.000Z",
383
+ endDate: "2022-01-24T00:00:00.000Z",
384
+ offset: 0,
385
+ limit: 1,
386
+ type: "BUY,SELL,DIVIDEND",
387
+ });
388
+ ```
389
+
390
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
391
+
361
392
 
362
393
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
363
394
 
@@ -433,6 +464,17 @@ const getAccountBalanceHistoryResponse =
433
464
 
434
465
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
435
466
 
467
+ ##### OAuth Auth<a id="oauth-auth"></a>
468
+
469
+ ```typescript
470
+ const getAccountBalanceHistoryResponse =
471
+ await oauthClient.accountInformation.getAccountBalanceHistory({
472
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
473
+ });
474
+ ```
475
+
476
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
477
+
436
478
 
437
479
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
438
480
 
@@ -557,6 +599,17 @@ const getAccountDetailsResponse =
557
599
 
558
600
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
559
601
 
602
+ ##### OAuth Auth<a id="oauth-auth"></a>
603
+
604
+ ```typescript
605
+ const getAccountDetailsResponse =
606
+ await oauthClient.accountInformation.getAccountDetails({
607
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
608
+ });
609
+ ```
610
+
611
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
612
+
560
613
 
561
614
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
562
615
 
@@ -618,6 +671,17 @@ const getAllAccountPositionsResponse =
618
671
 
619
672
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
620
673
 
674
+ ##### OAuth Auth<a id="oauth-auth"></a>
675
+
676
+ ```typescript
677
+ const getAllAccountPositionsResponse =
678
+ await oauthClient.accountInformation.getAllAccountPositions({
679
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
680
+ });
681
+ ```
682
+
683
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
684
+
621
685
 
622
686
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
623
687
 
@@ -677,6 +741,17 @@ const getUserAccountBalanceResponse =
677
741
 
678
742
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
679
743
 
744
+ ##### OAuth Auth<a id="oauth-auth"></a>
745
+
746
+ ```typescript
747
+ const getUserAccountBalanceResponse =
748
+ await oauthClient.accountInformation.getUserAccountBalance({
749
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
750
+ });
751
+ ```
752
+
753
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
754
+
680
755
 
681
756
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
682
757
 
@@ -739,6 +814,17 @@ const getUserAccountDetailsResponse =
739
814
 
740
815
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
741
816
 
817
+ ##### OAuth Auth<a id="oauth-auth"></a>
818
+
819
+ ```typescript
820
+ const getUserAccountDetailsResponse =
821
+ await oauthClient.accountInformation.getUserAccountDetails({
822
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
823
+ });
824
+ ```
825
+
826
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
827
+
742
828
 
743
829
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
744
830
 
@@ -800,6 +886,18 @@ const getUserAccountOrderDetailResponse =
800
886
 
801
887
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
802
888
 
889
+ ##### OAuth Auth<a id="oauth-auth"></a>
890
+
891
+ ```typescript
892
+ const getUserAccountOrderDetailResponse =
893
+ await oauthClient.accountInformation.getUserAccountOrderDetail({
894
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
895
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
896
+ });
897
+ ```
898
+
899
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
900
+
803
901
 
804
902
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
805
903
 
@@ -867,6 +965,19 @@ const getUserAccountOrdersResponse =
867
965
 
868
966
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
869
967
 
968
+ ##### OAuth Auth<a id="oauth-auth"></a>
969
+
970
+ ```typescript
971
+ const getUserAccountOrdersResponse =
972
+ await oauthClient.accountInformation.getUserAccountOrders({
973
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
974
+ state: "all",
975
+ days: 30,
976
+ });
977
+ ```
978
+
979
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
980
+
870
981
 
871
982
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
872
983
 
@@ -933,6 +1044,18 @@ const getUserAccountRecentOrdersResponse =
933
1044
 
934
1045
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
935
1046
 
1047
+ ##### OAuth Auth<a id="oauth-auth"></a>
1048
+
1049
+ ```typescript
1050
+ const getUserAccountRecentOrdersResponse =
1051
+ await oauthClient.accountInformation.getUserAccountRecentOrders({
1052
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1053
+ onlyExecuted: true,
1054
+ });
1055
+ ```
1056
+
1057
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1058
+
936
1059
 
937
1060
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
938
1061
 
@@ -1062,6 +1185,17 @@ const getUserHoldingsResponse =
1062
1185
 
1063
1186
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1064
1187
 
1188
+ ##### OAuth Auth<a id="oauth-auth"></a>
1189
+
1190
+ ```typescript
1191
+ const getUserHoldingsResponse =
1192
+ await oauthClient.accountInformation.getUserHoldings({
1193
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1194
+ });
1195
+ ```
1196
+
1197
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1198
+
1065
1199
 
1066
1200
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1067
1201
 
@@ -1116,6 +1250,15 @@ const listAllUserAccountsResponse =
1116
1250
 
1117
1251
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1118
1252
 
1253
+ ##### OAuth Auth<a id="oauth-auth"></a>
1254
+
1255
+ ```typescript
1256
+ const listAllUserAccountsResponse =
1257
+ await oauthClient.accountInformation.listAllUserAccounts();
1258
+ ```
1259
+
1260
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1261
+
1119
1262
 
1120
1263
  #### 🔄 Return<a id="🔄-return"></a>
1121
1264
 
@@ -1167,6 +1310,15 @@ const listUserAccountsResponse =
1167
1310
 
1168
1311
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1169
1312
 
1313
+ ##### OAuth Auth<a id="oauth-auth"></a>
1314
+
1315
+ ```typescript
1316
+ const listUserAccountsResponse =
1317
+ await oauthClient.accountInformation.listUserAccounts();
1318
+ ```
1319
+
1320
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1321
+
1170
1322
 
1171
1323
  #### 🔄 Return<a id="🔄-return"></a>
1172
1324
 
@@ -1215,6 +1367,17 @@ const updateUserAccountResponse =
1215
1367
 
1216
1368
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1217
1369
 
1370
+ ##### OAuth Auth<a id="oauth-auth"></a>
1371
+
1372
+ ```typescript
1373
+ const updateUserAccountResponse =
1374
+ await oauthClient.accountInformation.updateUserAccount({
1375
+ accountId: "accountId_example",
1376
+ });
1377
+ ```
1378
+
1379
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1380
+
1218
1381
 
1219
1382
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1220
1383
 
@@ -1369,6 +1532,25 @@ const loginSnapTradeUserResponse =
1369
1532
 
1370
1533
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1371
1534
 
1535
+ ##### OAuth Auth<a id="oauth-auth"></a>
1536
+
1537
+ ```typescript
1538
+ const loginSnapTradeUserResponse =
1539
+ await oauthClient.authentication.loginSnapTradeUser({
1540
+ broker: "ALPACA",
1541
+ immediateRedirect: true,
1542
+ customRedirect: "https://snaptrade.com",
1543
+ reconnect: "8b5f262d-4bb9-365d-888a-202bd3b15fa1",
1544
+ connectionType: "read",
1545
+ showCloseButton: true,
1546
+ darkMode: true,
1547
+ locale: "pt-BR",
1548
+ connectionPortalVersion: "v4",
1549
+ });
1550
+ ```
1551
+
1552
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1553
+
1372
1554
 
1373
1555
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1374
1556
 
@@ -1587,6 +1769,17 @@ const detailBrokerageAuthorizationResponse =
1587
1769
 
1588
1770
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1589
1771
 
1772
+ ##### OAuth Auth<a id="oauth-auth"></a>
1773
+
1774
+ ```typescript
1775
+ const detailBrokerageAuthorizationResponse =
1776
+ await oauthClient.connections.detailBrokerageAuthorization({
1777
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1778
+ });
1779
+ ```
1780
+
1781
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1782
+
1590
1783
 
1591
1784
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1592
1785
 
@@ -1643,6 +1836,17 @@ const disableBrokerageAuthorizationResponse =
1643
1836
 
1644
1837
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1645
1838
 
1839
+ ##### OAuth Auth<a id="oauth-auth"></a>
1840
+
1841
+ ```typescript
1842
+ const disableBrokerageAuthorizationResponse =
1843
+ await oauthClient.connections.disableBrokerageAuthorization({
1844
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1845
+ });
1846
+ ```
1847
+
1848
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1849
+
1646
1850
 
1647
1851
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1648
1852
 
@@ -1702,6 +1906,17 @@ const listBrokerageAuthorizationAccountsResponse =
1702
1906
 
1703
1907
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1704
1908
 
1909
+ ##### OAuth Auth<a id="oauth-auth"></a>
1910
+
1911
+ ```typescript
1912
+ const listBrokerageAuthorizationAccountsResponse =
1913
+ await oauthClient.connections.listBrokerageAuthorizationAccounts({
1914
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1915
+ });
1916
+ ```
1917
+
1918
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1919
+
1705
1920
 
1706
1921
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1707
1922
 
@@ -1756,6 +1971,15 @@ const listBrokerageAuthorizationsResponse =
1756
1971
 
1757
1972
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1758
1973
 
1974
+ ##### OAuth Auth<a id="oauth-auth"></a>
1975
+
1976
+ ```typescript
1977
+ const listBrokerageAuthorizationsResponse =
1978
+ await oauthClient.connections.listBrokerageAuthorizations();
1979
+ ```
1980
+
1981
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1982
+
1759
1983
 
1760
1984
  #### 🔄 Return<a id="🔄-return"></a>
1761
1985
 
@@ -1813,6 +2037,17 @@ const listConnectionAccountsResponse =
1813
2037
 
1814
2038
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1815
2039
 
2040
+ ##### OAuth Auth<a id="oauth-auth"></a>
2041
+
2042
+ ```typescript
2043
+ const listConnectionAccountsResponse =
2044
+ await oauthClient.connections.listConnectionAccounts({
2045
+ connectionId: "87b24961-b51e-4db8-9226-f198f6518a89",
2046
+ });
2047
+ ```
2048
+
2049
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2050
+
1816
2051
 
1817
2052
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1818
2053
 
@@ -1870,6 +2105,17 @@ const refreshBrokerageAuthorizationResponse =
1870
2105
 
1871
2106
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1872
2107
 
2108
+ ##### OAuth Auth<a id="oauth-auth"></a>
2109
+
2110
+ ```typescript
2111
+ const refreshBrokerageAuthorizationResponse =
2112
+ await oauthClient.connections.refreshBrokerageAuthorization({
2113
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
2114
+ });
2115
+ ```
2116
+
2117
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2118
+
1873
2119
 
1874
2120
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1875
2121
 
@@ -1985,6 +2231,17 @@ const syncBrokerageAuthorizationTransactionsResponse =
1985
2231
 
1986
2232
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1987
2233
 
2234
+ ##### OAuth Auth<a id="oauth-auth"></a>
2235
+
2236
+ ```typescript
2237
+ const syncBrokerageAuthorizationTransactionsResponse =
2238
+ await oauthClient.connections.syncBrokerageAuthorizationTransactions({
2239
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
2240
+ });
2241
+ ```
2242
+
2243
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2244
+
1988
2245
 
1989
2246
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1990
2247
 
@@ -2230,6 +2487,18 @@ const getUserAccountOrderDetailV2Response =
2230
2487
 
2231
2488
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2232
2489
 
2490
+ ##### OAuth Auth<a id="oauth-auth"></a>
2491
+
2492
+ ```typescript
2493
+ const getUserAccountOrderDetailV2Response =
2494
+ await oauthClient.experimentalEndpoints.getUserAccountOrderDetailV2({
2495
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2496
+ brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
2497
+ });
2498
+ ```
2499
+
2500
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2501
+
2233
2502
 
2234
2503
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2235
2504
 
@@ -2293,6 +2562,19 @@ const getUserAccountOrdersV2Response =
2293
2562
 
2294
2563
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2295
2564
 
2565
+ ##### OAuth Auth<a id="oauth-auth"></a>
2566
+
2567
+ ```typescript
2568
+ const getUserAccountOrdersV2Response =
2569
+ await oauthClient.experimentalEndpoints.getUserAccountOrdersV2({
2570
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2571
+ state: "all",
2572
+ days: 30,
2573
+ });
2574
+ ```
2575
+
2576
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2577
+
2296
2578
 
2297
2579
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2298
2580
 
@@ -2364,6 +2646,18 @@ const getUserAccountRecentOrdersV2Response =
2364
2646
 
2365
2647
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2366
2648
 
2649
+ ##### OAuth Auth<a id="oauth-auth"></a>
2650
+
2651
+ ```typescript
2652
+ const getUserAccountRecentOrdersV2Response =
2653
+ await oauthClient.experimentalEndpoints.getUserAccountRecentOrdersV2({
2654
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2655
+ onlyExecuted: true,
2656
+ });
2657
+ ```
2658
+
2659
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2660
+
2367
2661
 
2368
2662
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2369
2663
 
@@ -2424,13 +2718,15 @@ const listSubscriptionsResponse =
2424
2718
 
2425
2719
  **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase.
2426
2720
 
2427
- Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade and Webull US; future options are supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages).
2721
+ Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages).
2428
2722
 
2429
2723
  An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders.
2430
2724
 
2431
2725
  Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments.
2432
2726
 
2433
- All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order.
2727
+ TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route's supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments.
2728
+
2729
+ All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade's local instrument catalog to submit an order.
2434
2730
 
2435
2731
  A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
2436
2732
 
@@ -2503,6 +2799,36 @@ const placeSimpleOrderResponse =
2503
2799
 
2504
2800
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2505
2801
 
2802
+ ##### OAuth Auth<a id="oauth-auth"></a>
2803
+
2804
+ ```typescript
2805
+ const placeSimpleOrderResponse =
2806
+ await oauthClient.experimentalEndpoints.placeSimpleOrder({
2807
+ order_type: "stop_limit",
2808
+ time_in_force: "day",
2809
+ legs: [
2810
+ {
2811
+ instrument: {
2812
+ kind: "future",
2813
+ symbol: "/ESZ6",
2814
+ },
2815
+ action: "buy",
2816
+ units: "1.25",
2817
+ },
2818
+ ],
2819
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2820
+ limit_price: "1.25",
2821
+ stop_price: "1.25",
2822
+ price_effect: "debit",
2823
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
2824
+ expiry_date: "2026-12-18T20:00:00.000Z",
2825
+ notional_value: "1.25",
2826
+ trading_session: "regular",
2827
+ });
2828
+ ```
2829
+
2830
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2831
+
2506
2832
 
2507
2833
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2508
2834
 
@@ -2510,7 +2836,7 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
2510
2836
 
2511
2837
  ##### time_in_force: `string`<a id="time_in_force-string"></a>
2512
2838
 
2513
- Order duration, subject to brokerage and execution-path support. gtd requires expiry_date and a non-market single-leg equity/option order. Existing single-leg option routing does not support ioc. Futures and multi-leg orders do not support gtd through this endpoint. Webull US futures only support day and gtc.
2839
+ Order duration, subject to brokerage and execution-path support. gtd requires expiry_date and a non-market single-leg equity/option order. Existing single-leg option routing does not support ioc. Futures and multi-leg orders do not support gtd through this endpoint. Webull US futures only support day and gtc. TradeStation futures and futures options accept day, gtc, ioc, and fok, subject to the contract and route\\\'s supported combinations.
2514
2840
 
2515
2841
  ##### legs: [`SimpleTradeLeg`](./models/simple-trade-leg.ts)[]<a id="legs-simpletradelegmodelssimple-trade-legts"></a>
2516
2842
 
@@ -2534,7 +2860,7 @@ Only applicable to multi-leg limit and stop_limit orders. Requirements and suppo
2534
2860
 
2535
2861
  ##### client_order_id: [`string`](./models/model-string.ts)<a id="client_order_id-stringmodelsmodel-stringts"></a>
2536
2862
 
2537
- Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade and Webull US futures orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies; SnapTrade does not enforce uniqueness. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade\\\'s trade audit; the converted value is returned as brokerage_order_id for subsequent order reads.
2863
+ Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade, Webull US, and TradeStation futures-family orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies. SnapTrade does not enforce uniqueness, except for requests authenticated with an OAuth access token, where a client_order_id the user has already used returns 409. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade\\\'s trade audit; the converted value is returned as brokerage_order_id for subsequent order reads. For TradeStation live and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as 22-character URL-safe base64 without padding and sends it as OrderConfirmID for brokerage duplicate prevention; the response contains TradeStation\\\'s separate order ID.
2538
2864
 
2539
2865
  ##### expiry_date: `string`<a id="expiry_date-string"></a>
2540
2866
 
@@ -2678,6 +3004,12 @@ const getPartnerInfoResponse =
2678
3004
  await personalApiKeyClient.referenceData.getPartnerInfo();
2679
3005
  ```
2680
3006
 
3007
+ ##### OAuth Auth<a id="oauth-auth"></a>
3008
+
3009
+ ```typescript
3010
+ const getPartnerInfoResponse = await oauthClient.referenceData.getPartnerInfo();
3011
+ ```
3012
+
2681
3013
 
2682
3014
  #### 🔄 Return<a id="🔄-return"></a>
2683
3015
 
@@ -2712,6 +3044,13 @@ const getStockExchangesResponse =
2712
3044
  await personalApiKeyClient.referenceData.getStockExchanges();
2713
3045
  ```
2714
3046
 
3047
+ ##### OAuth Auth<a id="oauth-auth"></a>
3048
+
3049
+ ```typescript
3050
+ const getStockExchangesResponse =
3051
+ await oauthClient.referenceData.getStockExchanges();
3052
+ ```
3053
+
2715
3054
 
2716
3055
  #### 🔄 Return<a id="🔄-return"></a>
2717
3056
 
@@ -2750,6 +3089,14 @@ const getSymbolsResponse = await personalApiKeyClient.referenceData.getSymbols({
2750
3089
  });
2751
3090
  ```
2752
3091
 
3092
+ ##### OAuth Auth<a id="oauth-auth"></a>
3093
+
3094
+ ```typescript
3095
+ const getSymbolsResponse = await oauthClient.referenceData.getSymbols({
3096
+ substring: "AAPL",
3097
+ });
3098
+ ```
3099
+
2753
3100
 
2754
3101
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2755
3102
 
@@ -2795,6 +3142,15 @@ const getSymbolsByTickerResponse =
2795
3142
  });
2796
3143
  ```
2797
3144
 
3145
+ ##### OAuth Auth<a id="oauth-auth"></a>
3146
+
3147
+ ```typescript
3148
+ const getSymbolsByTickerResponse =
3149
+ await oauthClient.referenceData.getSymbolsByTicker({
3150
+ query: "query_example",
3151
+ });
3152
+ ```
3153
+
2798
3154
 
2799
3155
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2800
3156
 
@@ -2883,6 +3239,15 @@ const listAllBrokerageInstrumentsResponse =
2883
3239
  });
2884
3240
  ```
2885
3241
 
3242
+ ##### OAuth Auth<a id="oauth-auth"></a>
3243
+
3244
+ ```typescript
3245
+ const listAllBrokerageInstrumentsResponse =
3246
+ await oauthClient.referenceData.listAllBrokerageInstruments({
3247
+ slug: "QUESTRADE",
3248
+ });
3249
+ ```
3250
+
2886
3251
 
2887
3252
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2888
3253
 
@@ -2923,6 +3288,13 @@ const listAllBrokeragesResponse =
2923
3288
  await personalApiKeyClient.referenceData.listAllBrokerages();
2924
3289
  ```
2925
3290
 
3291
+ ##### OAuth Auth<a id="oauth-auth"></a>
3292
+
3293
+ ```typescript
3294
+ const listAllBrokeragesResponse =
3295
+ await oauthClient.referenceData.listAllBrokerages();
3296
+ ```
3297
+
2926
3298
 
2927
3299
  #### 🔄 Return<a id="🔄-return"></a>
2928
3300
 
@@ -3003,6 +3375,18 @@ const symbolSearchUserAccountResponse =
3003
3375
 
3004
3376
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3005
3377
 
3378
+ ##### OAuth Auth<a id="oauth-auth"></a>
3379
+
3380
+ ```typescript
3381
+ const symbolSearchUserAccountResponse =
3382
+ await oauthClient.referenceData.symbolSearchUserAccount({
3383
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3384
+ substring: "AAPL",
3385
+ });
3386
+ ```
3387
+
3388
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3389
+
3006
3390
 
3007
3391
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3008
3392
 
@@ -3060,6 +3444,17 @@ const cancelOrderResponse = await personalApiKeyClient.trading.cancelOrder({
3060
3444
 
3061
3445
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3062
3446
 
3447
+ ##### OAuth Auth<a id="oauth-auth"></a>
3448
+
3449
+ ```typescript
3450
+ const cancelOrderResponse = await oauthClient.trading.cancelOrder({
3451
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
3452
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3453
+ });
3454
+ ```
3455
+
3456
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3457
+
3063
3458
 
3064
3459
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3065
3460
 
@@ -3119,6 +3514,18 @@ const getCryptocurrencyPairQuoteResponse =
3119
3514
 
3120
3515
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3121
3516
 
3517
+ ##### OAuth Auth<a id="oauth-auth"></a>
3518
+
3519
+ ```typescript
3520
+ const getCryptocurrencyPairQuoteResponse =
3521
+ await oauthClient.trading.getCryptocurrencyPairQuote({
3522
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3523
+ instrumentSymbol: "BTC-USD",
3524
+ });
3525
+ ```
3526
+
3527
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3528
+
3122
3529
 
3123
3530
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3124
3531
 
@@ -3205,6 +3612,31 @@ const getOptionImpactResponse =
3205
3612
 
3206
3613
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3207
3614
 
3615
+ ##### OAuth Auth<a id="oauth-auth"></a>
3616
+
3617
+ ```typescript
3618
+ const getOptionImpactResponse = await oauthClient.trading.getOptionImpact({
3619
+ order_type: "MARKET",
3620
+ time_in_force: "Day",
3621
+ legs: [
3622
+ {
3623
+ instrument: {
3624
+ symbol: "PBI 250718C00006000",
3625
+ instrument_type: "OPTION",
3626
+ },
3627
+ action: "BUY_TO_OPEN",
3628
+ units: 1,
3629
+ },
3630
+ ],
3631
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3632
+ limit_price: "",
3633
+ stop_price: "",
3634
+ price_effect: "DEBIT",
3635
+ });
3636
+ ```
3637
+
3638
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3639
+
3208
3640
 
3209
3641
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3210
3642
 
@@ -3293,6 +3725,24 @@ const getOrderImpactResponse =
3293
3725
 
3294
3726
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3295
3727
 
3728
+ ##### OAuth Auth<a id="oauth-auth"></a>
3729
+
3730
+ ```typescript
3731
+ const getOrderImpactResponse = await oauthClient.trading.getOrderImpact({
3732
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3733
+ action: "BUY",
3734
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
3735
+ order_type: "Market",
3736
+ time_in_force: "Day",
3737
+ price: 31.33,
3738
+ stop: 31.33,
3739
+ units: 10.5,
3740
+ notional_value: null,
3741
+ });
3742
+ ```
3743
+
3744
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3745
+
3296
3746
 
3297
3747
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3298
3748
 
@@ -3451,6 +3901,19 @@ const getUserAccountQuotesResponse =
3451
3901
 
3452
3902
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3453
3903
 
3904
+ ##### OAuth Auth<a id="oauth-auth"></a>
3905
+
3906
+ ```typescript
3907
+ const getUserAccountQuotesResponse =
3908
+ await oauthClient.trading.getUserAccountQuotes({
3909
+ symbols: "symbols_example",
3910
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3911
+ useTicker: true,
3912
+ });
3913
+ ```
3914
+
3915
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3916
+
3454
3917
 
3455
3918
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3456
3919
 
@@ -3568,6 +4031,33 @@ const placeComplexOrderResponse =
3568
4031
 
3569
4032
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3570
4033
 
4034
+ ##### OAuth Auth<a id="oauth-auth"></a>
4035
+
4036
+ ```typescript
4037
+ const placeComplexOrderResponse = await oauthClient.trading.placeComplexOrder({
4038
+ type: "OTO",
4039
+ orders: [
4040
+ {
4041
+ order_role: "TRIGGER",
4042
+ action: "BUY",
4043
+ instrument: {
4044
+ symbol: "AAPL",
4045
+ type: "EQUITY",
4046
+ },
4047
+ order_type: "Market",
4048
+ units: 1,
4049
+ time_in_force: "Day",
4050
+ price: 31.33,
4051
+ stop: 29.5,
4052
+ },
4053
+ ],
4054
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4055
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
4056
+ });
4057
+ ```
4058
+
4059
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4060
+
3571
4061
 
3572
4062
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3573
4063
 
@@ -3660,6 +4150,28 @@ const placeCryptoOrderResponse =
3660
4150
 
3661
4151
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3662
4152
 
4153
+ ##### OAuth Auth<a id="oauth-auth"></a>
4154
+
4155
+ ```typescript
4156
+ const placeCryptoOrderResponse = await oauthClient.trading.placeCryptoOrder({
4157
+ instrument: {
4158
+ symbol: "BTC",
4159
+ type: "CRYPTOCURRENCY",
4160
+ },
4161
+ side: "BUY",
4162
+ type: "MARKET",
4163
+ time_in_force: "GTC",
4164
+ amount: "123.45",
4165
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4166
+ limit_price: "123.45",
4167
+ stop_price: "123.45",
4168
+ post_only: false,
4169
+ expiration_date: "2024-01-01T00:00:00.000Z",
4170
+ });
4171
+ ```
4172
+
4173
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4174
+
3663
4175
 
3664
4176
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3665
4177
 
@@ -3775,6 +4287,28 @@ const placeForceOrderResponse =
3775
4287
 
3776
4288
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3777
4289
 
4290
+ ##### OAuth Auth<a id="oauth-auth"></a>
4291
+
4292
+ ```typescript
4293
+ const placeForceOrderResponse = await oauthClient.trading.placeForceOrder({
4294
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4295
+ action: "BUY",
4296
+ order_type: "Market",
4297
+ time_in_force: "Day",
4298
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
4299
+ symbol: "AAPL",
4300
+ trading_session: "REGULAR",
4301
+ expiry_date: "2026-08-21T23:27:55.027Z",
4302
+ price: 31.33,
4303
+ stop: 31.33,
4304
+ units: 10.5,
4305
+ notional_value: null,
4306
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
4307
+ });
4308
+ ```
4309
+
4310
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4311
+
3778
4312
 
3779
4313
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3780
4314
 
@@ -3906,6 +4440,31 @@ const placeMlegOrderResponse =
3906
4440
 
3907
4441
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3908
4442
 
4443
+ ##### OAuth Auth<a id="oauth-auth"></a>
4444
+
4445
+ ```typescript
4446
+ const placeMlegOrderResponse = await oauthClient.trading.placeMlegOrder({
4447
+ order_type: "MARKET",
4448
+ time_in_force: "Day",
4449
+ legs: [
4450
+ {
4451
+ instrument: {
4452
+ symbol: "PBI 250718C00006000",
4453
+ instrument_type: "OPTION",
4454
+ },
4455
+ action: "BUY_TO_OPEN",
4456
+ units: 1,
4457
+ },
4458
+ ],
4459
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4460
+ limit_price: "",
4461
+ stop_price: "",
4462
+ price_effect: "DEBIT",
4463
+ });
4464
+ ```
4465
+
4466
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4467
+
3909
4468
 
3910
4469
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3911
4470
 
@@ -3981,6 +4540,17 @@ const placeOrderResponse = await personalApiKeyClient.trading.placeOrder({
3981
4540
 
3982
4541
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3983
4542
 
4543
+ ##### OAuth Auth<a id="oauth-auth"></a>
4544
+
4545
+ ```typescript
4546
+ const placeOrderResponse = await oauthClient.trading.placeOrder({
4547
+ tradeId: "139e307a-82f7-4402-b39e-4da7baa87758",
4548
+ wait_to_confirm: true,
4549
+ });
4550
+ ```
4551
+
4552
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4553
+
3984
4554
 
3985
4555
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3986
4556
 
@@ -4064,6 +4634,30 @@ const previewCryptoOrderResponse =
4064
4634
 
4065
4635
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4066
4636
 
4637
+ ##### OAuth Auth<a id="oauth-auth"></a>
4638
+
4639
+ ```typescript
4640
+ const previewCryptoOrderResponse = await oauthClient.trading.previewCryptoOrder(
4641
+ {
4642
+ instrument: {
4643
+ symbol: "BTC",
4644
+ type: "CRYPTOCURRENCY",
4645
+ },
4646
+ side: "BUY",
4647
+ type: "MARKET",
4648
+ time_in_force: "GTC",
4649
+ amount: "123.45",
4650
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4651
+ limit_price: "123.45",
4652
+ stop_price: "123.45",
4653
+ post_only: false,
4654
+ expiration_date: "2024-01-01T00:00:00.000Z",
4655
+ }
4656
+ );
4657
+ ```
4658
+
4659
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4660
+
4067
4661
 
4068
4662
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
4069
4663
 
@@ -4167,6 +4761,24 @@ const replaceOrderResponse = await personalApiKeyClient.trading.replaceOrder({
4167
4761
 
4168
4762
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4169
4763
 
4764
+ ##### OAuth Auth<a id="oauth-auth"></a>
4765
+
4766
+ ```typescript
4767
+ const replaceOrderResponse = await oauthClient.trading.replaceOrder({
4768
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
4769
+ action: "BUY",
4770
+ order_type: "Market",
4771
+ time_in_force: "Day",
4772
+ accountId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
4773
+ price: 31.33,
4774
+ symbol: "AAPL",
4775
+ stop: 31.33,
4776
+ units: 10.5,
4777
+ });
4778
+ ```
4779
+
4780
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4781
+
4170
4782
 
4171
4783
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
4172
4784
 
@@ -4258,6 +4870,19 @@ const searchCryptocurrencyPairInstrumentsResponse =
4258
4870
 
4259
4871
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4260
4872
 
4873
+ ##### OAuth Auth<a id="oauth-auth"></a>
4874
+
4875
+ ```typescript
4876
+ const searchCryptocurrencyPairInstrumentsResponse =
4877
+ await oauthClient.trading.searchCryptocurrencyPairInstruments({
4878
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4879
+ base: "BTC",
4880
+ quote: "USD",
4881
+ });
4882
+ ```
4883
+
4884
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4885
+
4261
4886
 
4262
4887
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
4263
4888
 
@@ -4282,3 +4907,21 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
4282
4907
 
4283
4908
  ## Author<a id="author"></a>
4284
4909
  This TypeScript package is automatically generated by [Konfig](https://konfigthis.com)
4910
+ ### Device authorization<a id="device-authorization"></a>
4911
+
4912
+ For a pre-registered **public OAuth client enabled for the device grant**, use the optional device helper. Device tokens currently grant `read` access only. This helper does not register clients, open a browser, store tokens, or refresh them.
4913
+
4914
+ ```typescript
4915
+ import { SnaptradeOAuthDevice, SnaptradeAuth } from "snaptrade-typescript-sdk";
4916
+
4917
+ const device = new SnaptradeOAuthDevice();
4918
+ const clientId = process.env.OAUTH_CLIENT_ID!;
4919
+ const authorization = await device.startDeviceAuthorization({ clientId });
4920
+ console.log(authorization.verificationUri, authorization.userCode);
4921
+ // Keep authorization.deviceCode private. Optionally display verificationUriComplete too.
4922
+ const tokens = await device.waitForDeviceToken({ clientId, authorization });
4923
+ const auth = SnaptradeAuth.oauth({ accessToken: tokens.accessToken });
4924
+ // Your application owns secure storage and subsequent token refresh.
4925
+ ```
4926
+
4927
+ Both methods accept an optional `signal: AbortSignal` for cancellation. Polling respects the server interval (five seconds by default), pending approval, slowdown, connection timeout backoff, and the original expiry deadline. Denial and other terminal server errors reject with the Axios error, preserving OAuth error details. Cancellation rejects with `name: "AbortError"`. Use `issuer` in the constructor for another SnapTrade environment; it defaults to the API server's origin.