snaptrade-typescript-sdk 13.1.15 → 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.15-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.1.15)
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
 
@@ -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
 
@@ -2503,6 +2797,36 @@ const placeSimpleOrderResponse =
2503
2797
 
2504
2798
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2505
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
+
2506
2830
 
2507
2831
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2508
2832
 
@@ -2678,6 +3002,12 @@ const getPartnerInfoResponse =
2678
3002
  await personalApiKeyClient.referenceData.getPartnerInfo();
2679
3003
  ```
2680
3004
 
3005
+ ##### OAuth Auth<a id="oauth-auth"></a>
3006
+
3007
+ ```typescript
3008
+ const getPartnerInfoResponse = await oauthClient.referenceData.getPartnerInfo();
3009
+ ```
3010
+
2681
3011
 
2682
3012
  #### 🔄 Return<a id="🔄-return"></a>
2683
3013
 
@@ -2712,6 +3042,13 @@ const getStockExchangesResponse =
2712
3042
  await personalApiKeyClient.referenceData.getStockExchanges();
2713
3043
  ```
2714
3044
 
3045
+ ##### OAuth Auth<a id="oauth-auth"></a>
3046
+
3047
+ ```typescript
3048
+ const getStockExchangesResponse =
3049
+ await oauthClient.referenceData.getStockExchanges();
3050
+ ```
3051
+
2715
3052
 
2716
3053
  #### 🔄 Return<a id="🔄-return"></a>
2717
3054
 
@@ -2750,6 +3087,14 @@ const getSymbolsResponse = await personalApiKeyClient.referenceData.getSymbols({
2750
3087
  });
2751
3088
  ```
2752
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
+
2753
3098
 
2754
3099
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2755
3100
 
@@ -2795,6 +3140,15 @@ const getSymbolsByTickerResponse =
2795
3140
  });
2796
3141
  ```
2797
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
+
2798
3152
 
2799
3153
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2800
3154
 
@@ -2883,6 +3237,15 @@ const listAllBrokerageInstrumentsResponse =
2883
3237
  });
2884
3238
  ```
2885
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
+
2886
3249
 
2887
3250
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2888
3251
 
@@ -2923,6 +3286,13 @@ const listAllBrokeragesResponse =
2923
3286
  await personalApiKeyClient.referenceData.listAllBrokerages();
2924
3287
  ```
2925
3288
 
3289
+ ##### OAuth Auth<a id="oauth-auth"></a>
3290
+
3291
+ ```typescript
3292
+ const listAllBrokeragesResponse =
3293
+ await oauthClient.referenceData.listAllBrokerages();
3294
+ ```
3295
+
2926
3296
 
2927
3297
  #### 🔄 Return<a id="🔄-return"></a>
2928
3298
 
@@ -3003,6 +3373,18 @@ const symbolSearchUserAccountResponse =
3003
3373
 
3004
3374
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3005
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
+
3006
3388
 
3007
3389
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3008
3390
 
@@ -3060,6 +3442,17 @@ const cancelOrderResponse = await personalApiKeyClient.trading.cancelOrder({
3060
3442
 
3061
3443
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3062
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
+
3063
3456
 
3064
3457
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3065
3458
 
@@ -3119,6 +3512,18 @@ const getCryptocurrencyPairQuoteResponse =
3119
3512
 
3120
3513
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3121
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
+
3122
3527
 
3123
3528
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3124
3529
 
@@ -3205,6 +3610,31 @@ const getOptionImpactResponse =
3205
3610
 
3206
3611
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3207
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
+
3208
3638
 
3209
3639
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3210
3640
 
@@ -3293,6 +3723,24 @@ const getOrderImpactResponse =
3293
3723
 
3294
3724
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3295
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
+
3296
3744
 
3297
3745
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3298
3746
 
@@ -3451,6 +3899,19 @@ const getUserAccountQuotesResponse =
3451
3899
 
3452
3900
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3453
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
+
3454
3915
 
3455
3916
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3456
3917
 
@@ -3568,6 +4029,33 @@ const placeComplexOrderResponse =
3568
4029
 
3569
4030
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3570
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
+
3571
4059
 
3572
4060
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3573
4061
 
@@ -3660,6 +4148,28 @@ const placeCryptoOrderResponse =
3660
4148
 
3661
4149
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3662
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
+
3663
4173
 
3664
4174
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3665
4175
 
@@ -3775,6 +4285,28 @@ const placeForceOrderResponse =
3775
4285
 
3776
4286
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3777
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
+
3778
4310
 
3779
4311
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3780
4312
 
@@ -3906,6 +4438,31 @@ const placeMlegOrderResponse =
3906
4438
 
3907
4439
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3908
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
+
3909
4466
 
3910
4467
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3911
4468
 
@@ -3981,6 +4538,17 @@ const placeOrderResponse = await personalApiKeyClient.trading.placeOrder({
3981
4538
 
3982
4539
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3983
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
+
3984
4552
 
3985
4553
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
3986
4554
 
@@ -4064,6 +4632,30 @@ const previewCryptoOrderResponse =
4064
4632
 
4065
4633
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4066
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
+
4067
4659
 
4068
4660
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
4069
4661
 
@@ -4167,6 +4759,24 @@ const replaceOrderResponse = await personalApiKeyClient.trading.replaceOrder({
4167
4759
 
4168
4760
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4169
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
+
4170
4780
 
4171
4781
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
4172
4782
 
@@ -4258,6 +4868,19 @@ const searchCryptocurrencyPairInstrumentsResponse =
4258
4868
 
4259
4869
  The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
4260
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
+
4261
4884
 
4262
4885
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
4263
4886
 
@@ -4282,3 +4905,21 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
4282
4905
 
4283
4906
  ## Author<a id="author"></a>
4284
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.