snaptrade-typescript-sdk 13.1.14 → 13.2.0

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.14-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.1.14)
66
+ [![npm](https://img.shields.io/badge/npm-v13.2.0-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.2.0)
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
 
@@ -583,7 +636,7 @@ The `results` list can contain multiple instrument types in the same response, i
583
636
 
584
637
  **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change.
585
638
 
586
- Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` when tax lot data is enabled for the account. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages).
639
+ Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages).
587
640
 
588
641
  If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
589
642
 
@@ -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,11 +2718,13 @@ 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 and future options are currently 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 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).
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
- All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces.
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.
2726
+
2727
+ 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.
2432
2728
 
2433
2729
  A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
2434
2730
 
@@ -2501,6 +2797,36 @@ const placeSimpleOrderResponse =
2501
2797
 
2502
2798
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2503
2799
 
2800
+ ##### OAuth Auth<a id="oauth-auth"></a>
2801
+
2802
+ ```typescript
2803
+ const placeSimpleOrderResponse =
2804
+ await oauthClient.experimentalEndpoints.placeSimpleOrder({
2805
+ order_type: "stop_limit",
2806
+ time_in_force: "day",
2807
+ legs: [
2808
+ {
2809
+ instrument: {
2810
+ kind: "future",
2811
+ symbol: "/ESZ6",
2812
+ },
2813
+ action: "buy",
2814
+ units: "1.25",
2815
+ },
2816
+ ],
2817
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2818
+ limit_price: "1.25",
2819
+ stop_price: "1.25",
2820
+ price_effect: "debit",
2821
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
2822
+ expiry_date: "2026-12-18T20:00:00.000Z",
2823
+ notional_value: "1.25",
2824
+ trading_session: "regular",
2825
+ });
2826
+ ```
2827
+
2828
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2829
+
2504
2830
 
2505
2831
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2506
2832
 
@@ -2508,7 +2834,7 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
2508
2834
 
2509
2835
  ##### time_in_force: `string`<a id="time_in_force-string"></a>
2510
2836
 
2511
- 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.
2837
+ 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.
2512
2838
 
2513
2839
  ##### legs: [`SimpleTradeLeg`](./models/simple-trade-leg.ts)[]<a id="legs-simpletradelegmodelssimple-trade-legts"></a>
2514
2840
 
@@ -2532,7 +2858,7 @@ Only applicable to multi-leg limit and stop_limit orders. Requirements and suppo
2532
2858
 
2533
2859
  ##### client_order_id: [`string`](./models/model-string.ts)<a id="client_order_id-stringmodelsmodel-stringts"></a>
2534
2860
 
2535
- Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade 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.
2861
+ 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.
2536
2862
 
2537
2863
  ##### expiry_date: `string`<a id="expiry_date-string"></a>
2538
2864
 
@@ -2676,6 +3002,12 @@ const getPartnerInfoResponse =
2676
3002
  await personalApiKeyClient.referenceData.getPartnerInfo();
2677
3003
  ```
2678
3004
 
3005
+ ##### OAuth Auth<a id="oauth-auth"></a>
3006
+
3007
+ ```typescript
3008
+ const getPartnerInfoResponse = await oauthClient.referenceData.getPartnerInfo();
3009
+ ```
3010
+
2679
3011
 
2680
3012
  #### 🔄 Return<a id="🔄-return"></a>
2681
3013
 
@@ -2710,6 +3042,13 @@ const getStockExchangesResponse =
2710
3042
  await personalApiKeyClient.referenceData.getStockExchanges();
2711
3043
  ```
2712
3044
 
3045
+ ##### OAuth Auth<a id="oauth-auth"></a>
3046
+
3047
+ ```typescript
3048
+ const getStockExchangesResponse =
3049
+ await oauthClient.referenceData.getStockExchanges();
3050
+ ```
3051
+
2713
3052
 
2714
3053
  #### 🔄 Return<a id="🔄-return"></a>
2715
3054
 
@@ -2748,6 +3087,14 @@ const getSymbolsResponse = await personalApiKeyClient.referenceData.getSymbols({
2748
3087
  });
2749
3088
  ```
2750
3089
 
3090
+ ##### OAuth Auth<a id="oauth-auth"></a>
3091
+
3092
+ ```typescript
3093
+ const getSymbolsResponse = await oauthClient.referenceData.getSymbols({
3094
+ substring: "AAPL",
3095
+ });
3096
+ ```
3097
+
2751
3098
 
2752
3099
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2753
3100
 
@@ -2793,6 +3140,15 @@ const getSymbolsByTickerResponse =
2793
3140
  });
2794
3141
  ```
2795
3142
 
3143
+ ##### OAuth Auth<a id="oauth-auth"></a>
3144
+
3145
+ ```typescript
3146
+ const getSymbolsByTickerResponse =
3147
+ await oauthClient.referenceData.getSymbolsByTicker({
3148
+ query: "query_example",
3149
+ });
3150
+ ```
3151
+
2796
3152
 
2797
3153
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2798
3154
 
@@ -2881,6 +3237,15 @@ const listAllBrokerageInstrumentsResponse =
2881
3237
  });
2882
3238
  ```
2883
3239
 
3240
+ ##### OAuth Auth<a id="oauth-auth"></a>
3241
+
3242
+ ```typescript
3243
+ const listAllBrokerageInstrumentsResponse =
3244
+ await oauthClient.referenceData.listAllBrokerageInstruments({
3245
+ slug: "QUESTRADE",
3246
+ });
3247
+ ```
3248
+
2884
3249
 
2885
3250
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2886
3251
 
@@ -2921,6 +3286,13 @@ const listAllBrokeragesResponse =
2921
3286
  await personalApiKeyClient.referenceData.listAllBrokerages();
2922
3287
  ```
2923
3288
 
3289
+ ##### OAuth Auth<a id="oauth-auth"></a>
3290
+
3291
+ ```typescript
3292
+ const listAllBrokeragesResponse =
3293
+ await oauthClient.referenceData.listAllBrokerages();
3294
+ ```
3295
+
2924
3296
 
2925
3297
  #### 🔄 Return<a id="🔄-return"></a>
2926
3298
 
@@ -3001,6 +3373,18 @@ const symbolSearchUserAccountResponse =
3001
3373
 
3002
3374
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3003
3375
 
3376
+ ##### OAuth Auth<a id="oauth-auth"></a>
3377
+
3378
+ ```typescript
3379
+ const symbolSearchUserAccountResponse =
3380
+ await oauthClient.referenceData.symbolSearchUserAccount({
3381
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3382
+ substring: "AAPL",
3383
+ });
3384
+ ```
3385
+
3386
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3387
+
3004
3388
 
3005
3389
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3006
3390
 
@@ -3058,6 +3442,17 @@ const cancelOrderResponse = await personalApiKeyClient.trading.cancelOrder({
3058
3442
 
3059
3443
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3060
3444
 
3445
+ ##### OAuth Auth<a id="oauth-auth"></a>
3446
+
3447
+ ```typescript
3448
+ const cancelOrderResponse = await oauthClient.trading.cancelOrder({
3449
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
3450
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3451
+ });
3452
+ ```
3453
+
3454
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3455
+
3061
3456
 
3062
3457
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3063
3458
 
@@ -3117,6 +3512,18 @@ const getCryptocurrencyPairQuoteResponse =
3117
3512
 
3118
3513
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3119
3514
 
3515
+ ##### OAuth Auth<a id="oauth-auth"></a>
3516
+
3517
+ ```typescript
3518
+ const getCryptocurrencyPairQuoteResponse =
3519
+ await oauthClient.trading.getCryptocurrencyPairQuote({
3520
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3521
+ instrumentSymbol: "BTC-USD",
3522
+ });
3523
+ ```
3524
+
3525
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3526
+
3120
3527
 
3121
3528
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3122
3529
 
@@ -3203,6 +3610,31 @@ const getOptionImpactResponse =
3203
3610
 
3204
3611
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3205
3612
 
3613
+ ##### OAuth Auth<a id="oauth-auth"></a>
3614
+
3615
+ ```typescript
3616
+ const getOptionImpactResponse = await oauthClient.trading.getOptionImpact({
3617
+ order_type: "MARKET",
3618
+ time_in_force: "Day",
3619
+ legs: [
3620
+ {
3621
+ instrument: {
3622
+ symbol: "PBI 250718C00006000",
3623
+ instrument_type: "OPTION",
3624
+ },
3625
+ action: "BUY_TO_OPEN",
3626
+ units: 1,
3627
+ },
3628
+ ],
3629
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3630
+ limit_price: "",
3631
+ stop_price: "",
3632
+ price_effect: "DEBIT",
3633
+ });
3634
+ ```
3635
+
3636
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3637
+
3206
3638
 
3207
3639
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3208
3640
 
@@ -3291,6 +3723,24 @@ const getOrderImpactResponse =
3291
3723
 
3292
3724
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3293
3725
 
3726
+ ##### OAuth Auth<a id="oauth-auth"></a>
3727
+
3728
+ ```typescript
3729
+ const getOrderImpactResponse = await oauthClient.trading.getOrderImpact({
3730
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3731
+ action: "BUY",
3732
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
3733
+ order_type: "Market",
3734
+ time_in_force: "Day",
3735
+ price: 31.33,
3736
+ stop: 31.33,
3737
+ units: 10.5,
3738
+ notional_value: null,
3739
+ });
3740
+ ```
3741
+
3742
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3743
+
3294
3744
 
3295
3745
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3296
3746
 
@@ -3449,6 +3899,19 @@ const getUserAccountQuotesResponse =
3449
3899
 
3450
3900
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3451
3901
 
3902
+ ##### OAuth Auth<a id="oauth-auth"></a>
3903
+
3904
+ ```typescript
3905
+ const getUserAccountQuotesResponse =
3906
+ await oauthClient.trading.getUserAccountQuotes({
3907
+ symbols: "symbols_example",
3908
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3909
+ useTicker: true,
3910
+ });
3911
+ ```
3912
+
3913
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3914
+
3452
3915
 
3453
3916
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3454
3917
 
@@ -3566,6 +4029,33 @@ const placeComplexOrderResponse =
3566
4029
 
3567
4030
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3568
4031
 
4032
+ ##### OAuth Auth<a id="oauth-auth"></a>
4033
+
4034
+ ```typescript
4035
+ const placeComplexOrderResponse = await oauthClient.trading.placeComplexOrder({
4036
+ type: "OTO",
4037
+ orders: [
4038
+ {
4039
+ order_role: "TRIGGER",
4040
+ action: "BUY",
4041
+ instrument: {
4042
+ symbol: "AAPL",
4043
+ type: "EQUITY",
4044
+ },
4045
+ order_type: "Market",
4046
+ units: 1,
4047
+ time_in_force: "Day",
4048
+ price: 31.33,
4049
+ stop: 29.5,
4050
+ },
4051
+ ],
4052
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4053
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
4054
+ });
4055
+ ```
4056
+
4057
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4058
+
3569
4059
 
3570
4060
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3571
4061
 
@@ -3658,6 +4148,28 @@ const placeCryptoOrderResponse =
3658
4148
 
3659
4149
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3660
4150
 
4151
+ ##### OAuth Auth<a id="oauth-auth"></a>
4152
+
4153
+ ```typescript
4154
+ const placeCryptoOrderResponse = await oauthClient.trading.placeCryptoOrder({
4155
+ instrument: {
4156
+ symbol: "BTC",
4157
+ type: "CRYPTOCURRENCY",
4158
+ },
4159
+ side: "BUY",
4160
+ type: "MARKET",
4161
+ time_in_force: "GTC",
4162
+ amount: "123.45",
4163
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4164
+ limit_price: "123.45",
4165
+ stop_price: "123.45",
4166
+ post_only: false,
4167
+ expiration_date: "2024-01-01T00:00:00.000Z",
4168
+ });
4169
+ ```
4170
+
4171
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4172
+
3661
4173
 
3662
4174
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3663
4175
 
@@ -3773,6 +4285,28 @@ const placeForceOrderResponse =
3773
4285
 
3774
4286
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3775
4287
 
4288
+ ##### OAuth Auth<a id="oauth-auth"></a>
4289
+
4290
+ ```typescript
4291
+ const placeForceOrderResponse = await oauthClient.trading.placeForceOrder({
4292
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4293
+ action: "BUY",
4294
+ order_type: "Market",
4295
+ time_in_force: "Day",
4296
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
4297
+ symbol: "AAPL",
4298
+ trading_session: "REGULAR",
4299
+ expiry_date: "2026-08-21T23:27:55.027Z",
4300
+ price: 31.33,
4301
+ stop: 31.33,
4302
+ units: 10.5,
4303
+ notional_value: null,
4304
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
4305
+ });
4306
+ ```
4307
+
4308
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4309
+
3776
4310
 
3777
4311
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3778
4312
 
@@ -3904,6 +4438,31 @@ const placeMlegOrderResponse =
3904
4438
 
3905
4439
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3906
4440
 
4441
+ ##### OAuth Auth<a id="oauth-auth"></a>
4442
+
4443
+ ```typescript
4444
+ const placeMlegOrderResponse = await oauthClient.trading.placeMlegOrder({
4445
+ order_type: "MARKET",
4446
+ time_in_force: "Day",
4447
+ legs: [
4448
+ {
4449
+ instrument: {
4450
+ symbol: "PBI 250718C00006000",
4451
+ instrument_type: "OPTION",
4452
+ },
4453
+ action: "BUY_TO_OPEN",
4454
+ units: 1,
4455
+ },
4456
+ ],
4457
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4458
+ limit_price: "",
4459
+ stop_price: "",
4460
+ price_effect: "DEBIT",
4461
+ });
4462
+ ```
4463
+
4464
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4465
+
3907
4466
 
3908
4467
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3909
4468
 
@@ -3979,6 +4538,17 @@ const placeOrderResponse = await personalApiKeyClient.trading.placeOrder({
3979
4538
 
3980
4539
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3981
4540
 
4541
+ ##### OAuth Auth<a id="oauth-auth"></a>
4542
+
4543
+ ```typescript
4544
+ const placeOrderResponse = await oauthClient.trading.placeOrder({
4545
+ tradeId: "139e307a-82f7-4402-b39e-4da7baa87758",
4546
+ wait_to_confirm: true,
4547
+ });
4548
+ ```
4549
+
4550
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4551
+
3982
4552
 
3983
4553
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3984
4554
 
@@ -4062,6 +4632,30 @@ const previewCryptoOrderResponse =
4062
4632
 
4063
4633
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4064
4634
 
4635
+ ##### OAuth Auth<a id="oauth-auth"></a>
4636
+
4637
+ ```typescript
4638
+ const previewCryptoOrderResponse = await oauthClient.trading.previewCryptoOrder(
4639
+ {
4640
+ instrument: {
4641
+ symbol: "BTC",
4642
+ type: "CRYPTOCURRENCY",
4643
+ },
4644
+ side: "BUY",
4645
+ type: "MARKET",
4646
+ time_in_force: "GTC",
4647
+ amount: "123.45",
4648
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4649
+ limit_price: "123.45",
4650
+ stop_price: "123.45",
4651
+ post_only: false,
4652
+ expiration_date: "2024-01-01T00:00:00.000Z",
4653
+ }
4654
+ );
4655
+ ```
4656
+
4657
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4658
+
4065
4659
 
4066
4660
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
4067
4661
 
@@ -4165,6 +4759,24 @@ const replaceOrderResponse = await personalApiKeyClient.trading.replaceOrder({
4165
4759
 
4166
4760
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4167
4761
 
4762
+ ##### OAuth Auth<a id="oauth-auth"></a>
4763
+
4764
+ ```typescript
4765
+ const replaceOrderResponse = await oauthClient.trading.replaceOrder({
4766
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
4767
+ action: "BUY",
4768
+ order_type: "Market",
4769
+ time_in_force: "Day",
4770
+ accountId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
4771
+ price: 31.33,
4772
+ symbol: "AAPL",
4773
+ stop: 31.33,
4774
+ units: 10.5,
4775
+ });
4776
+ ```
4777
+
4778
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4779
+
4168
4780
 
4169
4781
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
4170
4782
 
@@ -4256,6 +4868,19 @@ const searchCryptocurrencyPairInstrumentsResponse =
4256
4868
 
4257
4869
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4258
4870
 
4871
+ ##### OAuth Auth<a id="oauth-auth"></a>
4872
+
4873
+ ```typescript
4874
+ const searchCryptocurrencyPairInstrumentsResponse =
4875
+ await oauthClient.trading.searchCryptocurrencyPairInstruments({
4876
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
4877
+ base: "BTC",
4878
+ quote: "USD",
4879
+ });
4880
+ ```
4881
+
4882
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4883
+
4259
4884
 
4260
4885
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
4261
4886
 
@@ -4280,3 +4905,21 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
4280
4905
 
4281
4906
  ## Author<a id="author"></a>
4282
4907
  This TypeScript package is automatically generated by [Konfig](https://konfigthis.com)
4908
+ ### Device authorization<a id="device-authorization"></a>
4909
+
4910
+ 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.
4911
+
4912
+ ```typescript
4913
+ import { SnaptradeOAuthDevice, SnaptradeAuth } from "snaptrade-typescript-sdk";
4914
+
4915
+ const device = new SnaptradeOAuthDevice();
4916
+ const clientId = process.env.OAUTH_CLIENT_ID!;
4917
+ const authorization = await device.startDeviceAuthorization({ clientId });
4918
+ console.log(authorization.verificationUri, authorization.userCode);
4919
+ // Keep authorization.deviceCode private. Optionally display verificationUriComplete too.
4920
+ const tokens = await device.waitForDeviceToken({ clientId, authorization });
4921
+ const auth = SnaptradeAuth.oauth({ accessToken: tokens.accessToken });
4922
+ // Your application owns secure storage and subsequent token refresh.
4923
+ ```
4924
+
4925
+ 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.