snaptrade-typescript-sdk 12.2.2 → 12.2.4

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-v12.2.2-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/12.2.2)
66
+ [![npm](https://img.shields.io/badge/npm-v12.2.4-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/12.2.4)
67
67
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
68
68
 
69
69
  </div>
@@ -73,6 +73,9 @@ See https://docs.snaptrade.com/docs/ratelimiting.
73
73
  <!-- toc -->
74
74
 
75
75
  - [Installation](#installation)
76
+ - [Authentication](#authentication)
77
+ * [Commercial API Key Auth authentication](#commercial-api-key-auth-authentication)
78
+ * [Personal API Key Auth authentication](#personal-api-key-auth-authentication)
76
79
  - [Getting Started](#getting-started)
77
80
  - [Reference](#reference)
78
81
  * [`snaptrade.accountInformation.getAccountActivities`](#snaptradeaccountinformationgetaccountactivities)
@@ -166,6 +169,37 @@ yarn add snaptrade-typescript-sdk
166
169
  </tr>
167
170
  </table>
168
171
 
172
+ ## Authentication<a id="authentication"></a>
173
+
174
+ Choose the authentication mode that matches your credentials, then use its client in the reference examples.
175
+ ### Commercial API Key Auth authentication<a id="commercial-api-key-auth-authentication"></a>
176
+ Use commercial authentication when acting on behalf of your application and passing end-user credentials with requests that require them.
177
+
178
+ ```typescript
179
+ import { Snaptrade, SnaptradeAuth } from "snaptrade-typescript-sdk";
180
+
181
+ const commercialApiKeyClient = new Snaptrade({
182
+ auth: SnaptradeAuth.commercialApiKey({
183
+ consumerKey: "CONSUMER_KEY",
184
+ clientId: "CLIENT_ID",
185
+ }),
186
+ });
187
+ ```
188
+
189
+ ### Personal API Key Auth authentication<a id="personal-api-key-auth-authentication"></a>
190
+ Use personal authentication when the API key belongs to a single user and user credentials are not passed per request.
191
+
192
+ ```typescript
193
+ import { Snaptrade, SnaptradeAuth } from "snaptrade-typescript-sdk";
194
+
195
+ const personalApiKeyClient = new Snaptrade({
196
+ auth: SnaptradeAuth.personalApiKey({
197
+ consumerKey: "CONSUMER_KEY",
198
+ clientId: "CLIENT_ID",
199
+ }),
200
+ });
201
+ ```
202
+
169
203
  ## Getting Started<a id="getting-started"></a>
170
204
 
171
205
  ```typescript
@@ -278,16 +312,45 @@ If the connection has become disabled, it can no longer access the latest data f
278
312
 
279
313
  #### 🛠️ Usage<a id="🛠️-usage"></a>
280
314
 
315
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
316
+
317
+ ```typescript
318
+ const getAccountActivitiesResponse =
319
+ await commercialApiKeyClient.accountInformation.getAccountActivities({
320
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
321
+ startDate: "2022-01-24T00:00:00.000Z",
322
+ endDate: "2022-01-24T00:00:00.000Z",
323
+ offset: 0,
324
+ limit: 1,
325
+ type: "BUY,SELL,DIVIDEND",
326
+ userId: "snaptrade-user-123",
327
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
328
+ });
329
+ ```
330
+
331
+ Required credentials for this mode:
332
+
333
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
334
+
335
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
336
+
337
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
338
+
281
339
  ```typescript
282
340
  const getAccountActivitiesResponse =
283
- await snaptrade.accountInformation.getAccountActivities({
341
+ await personalApiKeyClient.accountInformation.getAccountActivities({
284
342
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
285
343
  startDate: "2022-01-24T00:00:00.000Z",
286
344
  endDate: "2022-01-24T00:00:00.000Z",
345
+ offset: 0,
346
+ limit: 1,
287
347
  type: "BUY,SELL,DIVIDEND",
288
348
  });
289
349
  ```
290
350
 
351
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
352
+
353
+
291
354
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
292
355
 
293
356
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -332,13 +395,35 @@ An experimental endpoint that returns estimated historical total account value f
332
395
 
333
396
  #### 🛠️ Usage<a id="🛠️-usage"></a>
334
397
 
398
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
399
+
335
400
  ```typescript
336
401
  const getAccountBalanceHistoryResponse =
337
- await snaptrade.accountInformation.getAccountBalanceHistory({
402
+ await commercialApiKeyClient.accountInformation.getAccountBalanceHistory({
403
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
404
+ userId: "snaptrade-user-123",
405
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
406
+ });
407
+ ```
408
+
409
+ Required credentials for this mode:
410
+
411
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
412
+
413
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
414
+
415
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
416
+
417
+ ```typescript
418
+ const getAccountBalanceHistoryResponse =
419
+ await personalApiKeyClient.accountInformation.getAccountBalanceHistory({
338
420
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
339
421
  });
340
422
  ```
341
423
 
424
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
425
+
426
+
342
427
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
343
428
 
344
429
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -369,13 +454,35 @@ If the connection has become disabled, it can no longer access the latest data f
369
454
 
370
455
  #### 🛠️ Usage<a id="🛠️-usage"></a>
371
456
 
457
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
458
+
459
+ ```typescript
460
+ const getAllAccountPositionsResponse =
461
+ await commercialApiKeyClient.accountInformation.getAllAccountPositions({
462
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
463
+ userId: "snaptrade-user-123",
464
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
465
+ });
466
+ ```
467
+
468
+ Required credentials for this mode:
469
+
470
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
471
+
472
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
473
+
474
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
475
+
372
476
  ```typescript
373
477
  const getAllAccountPositionsResponse =
374
- await snaptrade.accountInformation.getAllAccountPositions({
478
+ await personalApiKeyClient.accountInformation.getAllAccountPositions({
375
479
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
376
480
  });
377
481
  ```
378
482
 
483
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
484
+
485
+
379
486
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
380
487
 
381
488
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -406,13 +513,35 @@ If the connection has become disabled, it can no longer access the latest data f
406
513
 
407
514
  #### 🛠️ Usage<a id="🛠️-usage"></a>
408
515
 
516
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
517
+
518
+ ```typescript
519
+ const getUserAccountBalanceResponse =
520
+ await commercialApiKeyClient.accountInformation.getUserAccountBalance({
521
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
522
+ userId: "snaptrade-user-123",
523
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
524
+ });
525
+ ```
526
+
527
+ Required credentials for this mode:
528
+
529
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
530
+
531
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
532
+
533
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
534
+
409
535
  ```typescript
410
536
  const getUserAccountBalanceResponse =
411
- await snaptrade.accountInformation.getUserAccountBalance({
537
+ await personalApiKeyClient.accountInformation.getUserAccountBalance({
412
538
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
413
539
  });
414
540
  ```
415
541
 
542
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
543
+
544
+
416
545
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
417
546
 
418
547
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -443,13 +572,35 @@ If the connection has become disabled, it can no longer access the latest data f
443
572
 
444
573
  #### 🛠️ Usage<a id="🛠️-usage"></a>
445
574
 
575
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
576
+
577
+ ```typescript
578
+ const getUserAccountDetailsResponse =
579
+ await commercialApiKeyClient.accountInformation.getUserAccountDetails({
580
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
581
+ userId: "snaptrade-user-123",
582
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
583
+ });
584
+ ```
585
+
586
+ Required credentials for this mode:
587
+
588
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
589
+
590
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
591
+
592
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
593
+
446
594
  ```typescript
447
595
  const getUserAccountDetailsResponse =
448
- await snaptrade.accountInformation.getUserAccountDetails({
596
+ await personalApiKeyClient.accountInformation.getUserAccountDetails({
449
597
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
450
598
  });
451
599
  ```
452
600
 
601
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
602
+
603
+
453
604
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
454
605
 
455
606
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -480,14 +631,37 @@ This endpoint only returns orders placed through SnapTrade. In other words, orde
480
631
 
481
632
  #### 🛠️ Usage<a id="🛠️-usage"></a>
482
633
 
634
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
635
+
483
636
  ```typescript
484
637
  const getUserAccountOrderDetailResponse =
485
- await snaptrade.accountInformation.getUserAccountOrderDetail({
638
+ await commercialApiKeyClient.accountInformation.getUserAccountOrderDetail({
639
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
486
640
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
641
+ userId: "snaptrade-user-123",
642
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
643
+ });
644
+ ```
645
+
646
+ Required credentials for this mode:
647
+
648
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
649
+
650
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
651
+
652
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
653
+
654
+ ```typescript
655
+ const getUserAccountOrderDetailResponse =
656
+ await personalApiKeyClient.accountInformation.getUserAccountOrderDetail({
487
657
  brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
658
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
488
659
  });
489
660
  ```
490
661
 
662
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
663
+
664
+
491
665
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
492
666
 
493
667
  ##### brokerage_order_id: `string`<a id="brokerage_order_id-string"></a>
@@ -522,15 +696,39 @@ If the connection has become disabled, it can no longer access the latest data f
522
696
 
523
697
  #### 🛠️ Usage<a id="🛠️-usage"></a>
524
698
 
699
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
700
+
525
701
  ```typescript
526
702
  const getUserAccountOrdersResponse =
527
- await snaptrade.accountInformation.getUserAccountOrders({
703
+ await commercialApiKeyClient.accountInformation.getUserAccountOrders({
704
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
528
705
  state: "all",
529
706
  days: 30,
707
+ userId: "snaptrade-user-123",
708
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
709
+ });
710
+ ```
711
+
712
+ Required credentials for this mode:
713
+
714
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
715
+
716
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
717
+
718
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
719
+
720
+ ```typescript
721
+ const getUserAccountOrdersResponse =
722
+ await personalApiKeyClient.accountInformation.getUserAccountOrders({
530
723
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
724
+ state: "all",
725
+ days: 30,
531
726
  });
532
727
  ```
533
728
 
729
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
730
+
731
+
534
732
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
535
733
 
536
734
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -566,13 +764,37 @@ By default only returns executed orders, but that can be changed by setting *onl
566
764
 
567
765
  #### 🛠️ Usage<a id="🛠️-usage"></a>
568
766
 
767
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
768
+
769
+ ```typescript
770
+ const getUserAccountRecentOrdersResponse =
771
+ await commercialApiKeyClient.accountInformation.getUserAccountRecentOrders({
772
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
773
+ onlyExecuted: true,
774
+ userId: "snaptrade-user-123",
775
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
776
+ });
777
+ ```
778
+
779
+ Required credentials for this mode:
780
+
781
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
782
+
783
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
784
+
785
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
786
+
569
787
  ```typescript
570
788
  const getUserAccountRecentOrdersResponse =
571
- await snaptrade.accountInformation.getUserAccountRecentOrders({
789
+ await personalApiKeyClient.accountInformation.getUserAccountRecentOrders({
572
790
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
791
+ onlyExecuted: true,
573
792
  });
574
793
  ```
575
794
 
795
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
796
+
797
+
576
798
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
577
799
 
578
800
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -601,14 +823,37 @@ Returns a list of rate of return percents for a given account.
601
823
 
602
824
  #### 🛠️ Usage<a id="🛠️-usage"></a>
603
825
 
826
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
827
+
828
+ ```typescript
829
+ const getUserAccountReturnRatesResponse =
830
+ await commercialApiKeyClient.accountInformation.getUserAccountReturnRates({
831
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
832
+ timeframes: "ALL,1Y",
833
+ userId: "snaptrade-user-123",
834
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
835
+ });
836
+ ```
837
+
838
+ Required credentials for this mode:
839
+
840
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
841
+
842
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
843
+
844
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
845
+
604
846
  ```typescript
605
847
  const getUserAccountReturnRatesResponse =
606
- await snaptrade.accountInformation.getUserAccountReturnRates({
848
+ await personalApiKeyClient.accountInformation.getUserAccountReturnRates({
607
849
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
608
850
  timeframes: "ALL,1Y",
609
851
  });
610
852
  ```
611
853
 
854
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
855
+
856
+
612
857
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
613
858
 
614
859
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -648,13 +893,35 @@ If the connection has become disabled, it can no longer access the latest data f
648
893
 
649
894
  #### 🛠️ Usage<a id="🛠️-usage"></a>
650
895
 
896
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
897
+
898
+ ```typescript
899
+ const getUserHoldingsResponse =
900
+ await commercialApiKeyClient.accountInformation.getUserHoldings({
901
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
902
+ userId: "snaptrade-user-123",
903
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
904
+ });
905
+ ```
906
+
907
+ Required credentials for this mode:
908
+
909
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
910
+
911
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
912
+
913
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
914
+
651
915
  ```typescript
652
916
  const getUserHoldingsResponse =
653
- await snaptrade.accountInformation.getUserHoldings({
917
+ await personalApiKeyClient.accountInformation.getUserHoldings({
654
918
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
655
919
  });
656
920
  ```
657
921
 
922
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
923
+
924
+
658
925
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
659
926
 
660
927
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -681,11 +948,32 @@ This endpoint returns Daily data regardless of the customer's plan. Daily data i
681
948
 
682
949
  #### 🛠️ Usage<a id="🛠️-usage"></a>
683
950
 
951
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
952
+
953
+ ```typescript
954
+ const listUserAccountsResponse =
955
+ await commercialApiKeyClient.accountInformation.listUserAccounts({
956
+ userId: "snaptrade-user-123",
957
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
958
+ });
959
+ ```
960
+
961
+ Required credentials for this mode:
962
+
963
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
964
+
965
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
966
+
967
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
968
+
684
969
  ```typescript
685
970
  const listUserAccountsResponse =
686
- await snaptrade.accountInformation.listUserAccounts();
971
+ await personalApiKeyClient.accountInformation.listUserAccounts();
687
972
  ```
688
973
 
974
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
975
+
976
+
689
977
  #### 🔄 Return<a id="🔄-return"></a>
690
978
 
691
979
  [Account](./models/account.ts)
@@ -705,13 +993,35 @@ Updates various properties of a specified account.
705
993
 
706
994
  #### 🛠️ Usage<a id="🛠️-usage"></a>
707
995
 
996
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
997
+
998
+ ```typescript
999
+ const updateUserAccountResponse =
1000
+ await commercialApiKeyClient.accountInformation.updateUserAccount({
1001
+ accountId: "accountId_example",
1002
+ userId: "snaptrade-user-123",
1003
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1004
+ });
1005
+ ```
1006
+
1007
+ Required credentials for this mode:
1008
+
1009
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1010
+
1011
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1012
+
1013
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1014
+
708
1015
  ```typescript
709
1016
  const updateUserAccountResponse =
710
- await snaptrade.accountInformation.updateUserAccount({
1017
+ await personalApiKeyClient.accountInformation.updateUserAccount({
711
1018
  accountId: "accountId_example",
712
1019
  });
713
1020
  ```
714
1021
 
1022
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1023
+
1024
+
715
1025
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
716
1026
 
717
1027
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -760,11 +1070,21 @@ Deletes a registered user and all associated data. This action is irreversible.
760
1070
 
761
1071
  #### 🛠️ Usage<a id="🛠️-usage"></a>
762
1072
 
1073
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1074
+ This endpoint supports Commercial API Key Auth authentication only.
1075
+
763
1076
  ```typescript
764
1077
  const deleteSnapTradeUserResponse =
765
- await snaptrade.authentication.deleteSnapTradeUser();
1078
+ await commercialApiKeyClient.authentication.deleteSnapTradeUser({
1079
+ userId: "snaptrade-user-123",
1080
+ });
766
1081
  ```
767
1082
 
1083
+ Required credentials for this mode:
1084
+
1085
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1086
+
1087
+
768
1088
  #### 🔄 Return<a id="🔄-return"></a>
769
1089
 
770
1090
  [DeleteUserResponse](./models/delete-user-response.ts)
@@ -784,11 +1104,15 @@ Returns a list of all registered user IDs. Please note that the response is not
784
1104
 
785
1105
  #### 🛠️ Usage<a id="🛠️-usage"></a>
786
1106
 
1107
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1108
+ This endpoint supports Commercial API Key Auth authentication only.
1109
+
787
1110
  ```typescript
788
1111
  const listSnapTradeUsersResponse =
789
- await snaptrade.authentication.listSnapTradeUsers();
1112
+ await commercialApiKeyClient.authentication.listSnapTradeUsers();
790
1113
  ```
791
1114
 
1115
+
792
1116
  #### 🌐 Endpoint<a id="🌐-endpoint"></a>
793
1117
 
794
1118
  `/snapTrade/listUsers` `GET`
@@ -807,9 +1131,36 @@ Please note that the returned URL expires in 5 minutes.
807
1131
 
808
1132
  #### 🛠️ Usage<a id="🛠️-usage"></a>
809
1133
 
1134
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1135
+
1136
+ ```typescript
1137
+ const loginSnapTradeUserResponse =
1138
+ await commercialApiKeyClient.authentication.loginSnapTradeUser({
1139
+ broker: "ALPACA",
1140
+ immediateRedirect: true,
1141
+ customRedirect: "https://snaptrade.com",
1142
+ reconnect: "8b5f262d-4bb9-365d-888a-202bd3b15fa1",
1143
+ connectionType: "read",
1144
+ showCloseButton: true,
1145
+ darkMode: true,
1146
+ locale: "pt-BR",
1147
+ connectionPortalVersion: "v4",
1148
+ userId: "snaptrade-user-123",
1149
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1150
+ });
1151
+ ```
1152
+
1153
+ Required credentials for this mode:
1154
+
1155
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1156
+
1157
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1158
+
1159
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1160
+
810
1161
  ```typescript
811
1162
  const loginSnapTradeUserResponse =
812
- await snaptrade.authentication.loginSnapTradeUser({
1163
+ await personalApiKeyClient.authentication.loginSnapTradeUser({
813
1164
  broker: "ALPACA",
814
1165
  immediateRedirect: true,
815
1166
  customRedirect: "https://snaptrade.com",
@@ -822,6 +1173,9 @@ const loginSnapTradeUserResponse =
822
1173
  });
823
1174
  ```
824
1175
 
1176
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1177
+
1178
+
825
1179
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
826
1180
 
827
1181
  ##### broker: `string`<a id="broker-string"></a>
@@ -881,13 +1235,17 @@ Most SnapTrade operations require a user ID and user secret to be passed in as p
881
1235
 
882
1236
  #### 🛠️ Usage<a id="🛠️-usage"></a>
883
1237
 
1238
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1239
+ This endpoint supports Commercial API Key Auth authentication only.
1240
+
884
1241
  ```typescript
885
1242
  const registerSnapTradeUserResponse =
886
- await snaptrade.authentication.registerSnapTradeUser({
1243
+ await commercialApiKeyClient.authentication.registerSnapTradeUser({
887
1244
  userId: "snaptrade-user-123",
888
1245
  });
889
1246
  ```
890
1247
 
1248
+
891
1249
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
892
1250
 
893
1251
  ##### userId: `string`<a id="userid-string"></a>
@@ -914,14 +1272,18 @@ Rotates the secret for a SnapTrade user. You might use this if `userSecret` is c
914
1272
 
915
1273
  #### 🛠️ Usage<a id="🛠️-usage"></a>
916
1274
 
1275
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1276
+ This endpoint supports Commercial API Key Auth authentication only.
1277
+
917
1278
  ```typescript
918
1279
  const resetSnapTradeUserSecretResponse =
919
- await snaptrade.authentication.resetSnapTradeUserSecret({
1280
+ await commercialApiKeyClient.authentication.resetSnapTradeUserSecret({
920
1281
  userId: "snaptrade-user-123",
921
1282
  userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
922
1283
  });
923
1284
  ```
924
1285
 
1286
+
925
1287
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
926
1288
 
927
1289
  ##### userId: `string`<a id="userid-string"></a>
@@ -951,12 +1313,35 @@ Deletes the SnapTrade connection specified by the ID. This will also remove the
951
1313
 
952
1314
  #### 🛠️ Usage<a id="🛠️-usage"></a>
953
1315
 
1316
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1317
+
954
1318
  ```typescript
955
- const deleteConnectionResponse = await snaptrade.connections.deleteConnection({
956
- connectionId: "87b24961-b51e-4db8-9226-f198f6518a89",
957
- });
1319
+ const deleteConnectionResponse =
1320
+ await commercialApiKeyClient.connections.deleteConnection({
1321
+ connectionId: "87b24961-b51e-4db8-9226-f198f6518a89",
1322
+ userId: "snaptrade-user-123",
1323
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1324
+ });
958
1325
  ```
959
1326
 
1327
+ Required credentials for this mode:
1328
+
1329
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1330
+
1331
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1332
+
1333
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1334
+
1335
+ ```typescript
1336
+ const deleteConnectionResponse =
1337
+ await personalApiKeyClient.connections.deleteConnection({
1338
+ connectionId: "87b24961-b51e-4db8-9226-f198f6518a89",
1339
+ });
1340
+ ```
1341
+
1342
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1343
+
1344
+
960
1345
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
961
1346
 
962
1347
  ##### connectionId: `string`<a id="connectionid-string"></a>
@@ -980,16 +1365,38 @@ Returns a single connection for the specified ID.
980
1365
 
981
1366
  #### 🛠️ Usage<a id="🛠️-usage"></a>
982
1367
 
1368
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1369
+
983
1370
  ```typescript
984
1371
  const detailBrokerageAuthorizationResponse =
985
- await snaptrade.connections.detailBrokerageAuthorization({
1372
+ await commercialApiKeyClient.connections.detailBrokerageAuthorization({
986
1373
  authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1374
+ userId: "snaptrade-user-123",
1375
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
987
1376
  });
988
1377
  ```
989
1378
 
990
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1379
+ Required credentials for this mode:
991
1380
 
992
- ##### authorizationId: `string`<a id="authorizationid-string"></a>
1381
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1382
+
1383
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1384
+
1385
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1386
+
1387
+ ```typescript
1388
+ const detailBrokerageAuthorizationResponse =
1389
+ await personalApiKeyClient.connections.detailBrokerageAuthorization({
1390
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1391
+ });
1392
+ ```
1393
+
1394
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1395
+
1396
+
1397
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1398
+
1399
+ ##### authorizationId: `string`<a id="authorizationid-string"></a>
993
1400
 
994
1401
  #### 🔄 Return<a id="🔄-return"></a>
995
1402
 
@@ -1014,13 +1421,35 @@ This endpoint is available on test keys. If you would like it enabled on product
1014
1421
 
1015
1422
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1016
1423
 
1424
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1425
+
1426
+ ```typescript
1427
+ const disableBrokerageAuthorizationResponse =
1428
+ await commercialApiKeyClient.connections.disableBrokerageAuthorization({
1429
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1430
+ userId: "snaptrade-user-123",
1431
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1432
+ });
1433
+ ```
1434
+
1435
+ Required credentials for this mode:
1436
+
1437
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1438
+
1439
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1440
+
1441
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1442
+
1017
1443
  ```typescript
1018
1444
  const disableBrokerageAuthorizationResponse =
1019
- await snaptrade.connections.disableBrokerageAuthorization({
1445
+ await personalApiKeyClient.connections.disableBrokerageAuthorization({
1020
1446
  authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1021
1447
  });
1022
1448
  ```
1023
1449
 
1450
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1451
+
1452
+
1024
1453
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1025
1454
 
1026
1455
  ##### authorizationId: `string`<a id="authorizationid-string"></a>
@@ -1051,13 +1480,35 @@ Check your API key on the [Customer Dashboard billing page](https://dashboard.sn
1051
1480
 
1052
1481
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1053
1482
 
1483
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1484
+
1054
1485
  ```typescript
1055
1486
  const listBrokerageAuthorizationAccountsResponse =
1056
- await snaptrade.connections.listBrokerageAuthorizationAccounts({
1487
+ await commercialApiKeyClient.connections.listBrokerageAuthorizationAccounts({
1057
1488
  authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1489
+ userId: "snaptrade-user-123",
1490
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1058
1491
  });
1059
1492
  ```
1060
1493
 
1494
+ Required credentials for this mode:
1495
+
1496
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1497
+
1498
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1499
+
1500
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1501
+
1502
+ ```typescript
1503
+ const listBrokerageAuthorizationAccountsResponse =
1504
+ await personalApiKeyClient.connections.listBrokerageAuthorizationAccounts({
1505
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1506
+ });
1507
+ ```
1508
+
1509
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1510
+
1511
+
1061
1512
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1062
1513
 
1063
1514
  ##### authorizationId: `string`<a id="authorizationid-string"></a>
@@ -1086,11 +1537,32 @@ SnapTrade performs de-duping on connections for a given user. If the user has an
1086
1537
 
1087
1538
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1088
1539
 
1540
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1541
+
1089
1542
  ```typescript
1090
1543
  const listBrokerageAuthorizationsResponse =
1091
- await snaptrade.connections.listBrokerageAuthorizations();
1544
+ await commercialApiKeyClient.connections.listBrokerageAuthorizations({
1545
+ userId: "snaptrade-user-123",
1546
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1547
+ });
1092
1548
  ```
1093
1549
 
1550
+ Required credentials for this mode:
1551
+
1552
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1553
+
1554
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1555
+
1556
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1557
+
1558
+ ```typescript
1559
+ const listBrokerageAuthorizationsResponse =
1560
+ await personalApiKeyClient.connections.listBrokerageAuthorizations();
1561
+ ```
1562
+
1563
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1564
+
1565
+
1094
1566
  #### 🔄 Return<a id="🔄-return"></a>
1095
1567
 
1096
1568
  [BrokerageAuthorization](./models/brokerage-authorization.ts)
@@ -1115,13 +1587,35 @@ This endpoint will also trigger a transaction sync for the past day if one has n
1115
1587
 
1116
1588
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1117
1589
 
1590
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1591
+
1592
+ ```typescript
1593
+ const refreshBrokerageAuthorizationResponse =
1594
+ await commercialApiKeyClient.connections.refreshBrokerageAuthorization({
1595
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1596
+ userId: "snaptrade-user-123",
1597
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1598
+ });
1599
+ ```
1600
+
1601
+ Required credentials for this mode:
1602
+
1603
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1604
+
1605
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1606
+
1607
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1608
+
1118
1609
  ```typescript
1119
1610
  const refreshBrokerageAuthorizationResponse =
1120
- await snaptrade.connections.refreshBrokerageAuthorization({
1611
+ await personalApiKeyClient.connections.refreshBrokerageAuthorization({
1121
1612
  authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1122
1613
  });
1123
1614
  ```
1124
1615
 
1616
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1617
+
1618
+
1125
1619
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1126
1620
 
1127
1621
  ##### authorizationId: `string`<a id="authorizationid-string"></a>
@@ -1146,13 +1640,36 @@ Returns a list of rate of return percents for a given connection.
1146
1640
 
1147
1641
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1148
1642
 
1643
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1644
+
1645
+ ```typescript
1646
+ const returnRatesResponse =
1647
+ await commercialApiKeyClient.connections.returnRates({
1648
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1649
+ timeframes: "ALL,1Y",
1650
+ userId: "snaptrade-user-123",
1651
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1652
+ });
1653
+ ```
1654
+
1655
+ Required credentials for this mode:
1656
+
1657
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1658
+
1659
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1660
+
1661
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1662
+
1149
1663
  ```typescript
1150
- const returnRatesResponse = await snaptrade.connections.returnRates({
1664
+ const returnRatesResponse = await personalApiKeyClient.connections.returnRates({
1151
1665
  authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1152
1666
  timeframes: "ALL,1Y",
1153
1667
  });
1154
1668
  ```
1155
1669
 
1670
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1671
+
1672
+
1156
1673
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1157
1674
 
1158
1675
  ##### authorizationId: `string`<a id="authorizationid-string"></a>
@@ -1181,13 +1698,39 @@ Trigger a transactions sync for all accounts under this connection. Updates will
1181
1698
 
1182
1699
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1183
1700
 
1701
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1702
+
1184
1703
  ```typescript
1185
1704
  const syncBrokerageAuthorizationTransactionsResponse =
1186
- await snaptrade.connections.syncBrokerageAuthorizationTransactions({
1187
- authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1188
- });
1705
+ await commercialApiKeyClient.connections.syncBrokerageAuthorizationTransactions(
1706
+ {
1707
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1708
+ userId: "snaptrade-user-123",
1709
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1710
+ }
1711
+ );
1712
+ ```
1713
+
1714
+ Required credentials for this mode:
1715
+
1716
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1717
+
1718
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1719
+
1720
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1721
+
1722
+ ```typescript
1723
+ const syncBrokerageAuthorizationTransactionsResponse =
1724
+ await personalApiKeyClient.connections.syncBrokerageAuthorizationTransactions(
1725
+ {
1726
+ authorizationId: "87b24961-b51e-4db8-9226-f198f6518a89",
1727
+ }
1728
+ );
1189
1729
  ```
1190
1730
 
1731
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1732
+
1733
+
1191
1734
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1192
1735
 
1193
1736
  ##### authorizationId: `string`<a id="authorizationid-string"></a>
@@ -1213,14 +1756,37 @@ This endpoint requires `userId` and `userSecret` in addition to the partner sign
1213
1756
 
1214
1757
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1215
1758
 
1759
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1760
+
1216
1761
  ```typescript
1217
1762
  const addSubscriptionResponse =
1218
- await snaptrade.experimentalEndpoints.addSubscription({
1763
+ await commercialApiKeyClient.experimentalEndpoints.addSubscription({
1764
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1765
+ check_interval_seconds: 300,
1766
+ userId: "snaptrade-user-123",
1767
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1768
+ });
1769
+ ```
1770
+
1771
+ Required credentials for this mode:
1772
+
1773
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1774
+
1775
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1776
+
1777
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1778
+
1779
+ ```typescript
1780
+ const addSubscriptionResponse =
1781
+ await personalApiKeyClient.experimentalEndpoints.addSubscription({
1219
1782
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1220
1783
  check_interval_seconds: 300,
1221
1784
  });
1222
1785
  ```
1223
1786
 
1787
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1788
+
1789
+
1224
1790
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1225
1791
 
1226
1792
  ##### account_id: `string`<a id="account_id-string"></a>
@@ -1252,13 +1818,25 @@ This endpoint requires partner signature authentication only and does not requir
1252
1818
 
1253
1819
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1254
1820
 
1821
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1822
+
1255
1823
  ```typescript
1256
1824
  const cancelSubscriptionResponse =
1257
- await snaptrade.experimentalEndpoints.cancelSubscription({
1825
+ await commercialApiKeyClient.experimentalEndpoints.cancelSubscription({
1258
1826
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1259
1827
  });
1260
1828
  ```
1261
1829
 
1830
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1831
+
1832
+ ```typescript
1833
+ const cancelSubscriptionResponse =
1834
+ await personalApiKeyClient.experimentalEndpoints.cancelSubscription({
1835
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1836
+ });
1837
+ ```
1838
+
1839
+
1262
1840
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1263
1841
 
1264
1842
  ##### account_id: `string`<a id="account_id-string"></a>
@@ -1292,14 +1870,39 @@ This endpoint only returns orders placed through SnapTrade. In other words, orde
1292
1870
 
1293
1871
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1294
1872
 
1873
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1874
+
1295
1875
  ```typescript
1296
1876
  const getUserAccountOrderDetailV2Response =
1297
- await snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2({
1877
+ await commercialApiKeyClient.experimentalEndpoints.getUserAccountOrderDetailV2(
1878
+ {
1879
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1880
+ brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
1881
+ userId: "snaptrade-user-123",
1882
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1883
+ }
1884
+ );
1885
+ ```
1886
+
1887
+ Required credentials for this mode:
1888
+
1889
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1890
+
1891
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1892
+
1893
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1894
+
1895
+ ```typescript
1896
+ const getUserAccountOrderDetailV2Response =
1897
+ await personalApiKeyClient.experimentalEndpoints.getUserAccountOrderDetailV2({
1298
1898
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1299
1899
  brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
1300
1900
  });
1301
1901
  ```
1302
1902
 
1903
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1904
+
1905
+
1303
1906
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1304
1907
 
1305
1908
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -1330,15 +1933,39 @@ If the connection has become disabled, it can no longer access the latest data f
1330
1933
 
1331
1934
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1332
1935
 
1936
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
1937
+
1333
1938
  ```typescript
1334
1939
  const getUserAccountOrdersV2Response =
1335
- await snaptrade.experimentalEndpoints.getUserAccountOrdersV2({
1940
+ await commercialApiKeyClient.experimentalEndpoints.getUserAccountOrdersV2({
1941
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1336
1942
  state: "all",
1337
1943
  days: 30,
1944
+ userId: "snaptrade-user-123",
1945
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1946
+ });
1947
+ ```
1948
+
1949
+ Required credentials for this mode:
1950
+
1951
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1952
+
1953
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1954
+
1955
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1956
+
1957
+ ```typescript
1958
+ const getUserAccountOrdersV2Response =
1959
+ await personalApiKeyClient.experimentalEndpoints.getUserAccountOrdersV2({
1338
1960
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1961
+ state: "all",
1962
+ days: 30,
1339
1963
  });
1340
1964
  ```
1341
1965
 
1966
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
1967
+
1968
+
1342
1969
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1343
1970
 
1344
1971
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -1375,13 +2002,41 @@ By default only returns executed orders, but that can be changed by setting *onl
1375
2002
 
1376
2003
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1377
2004
 
2005
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2006
+
1378
2007
  ```typescript
1379
2008
  const getUserAccountRecentOrdersV2Response =
1380
- await snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2({
1381
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1382
- });
2009
+ await commercialApiKeyClient.experimentalEndpoints.getUserAccountRecentOrdersV2(
2010
+ {
2011
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2012
+ onlyExecuted: true,
2013
+ userId: "snaptrade-user-123",
2014
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2015
+ }
2016
+ );
2017
+ ```
2018
+
2019
+ Required credentials for this mode:
2020
+
2021
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2022
+
2023
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2024
+
2025
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2026
+
2027
+ ```typescript
2028
+ const getUserAccountRecentOrdersV2Response =
2029
+ await personalApiKeyClient.experimentalEndpoints.getUserAccountRecentOrdersV2(
2030
+ {
2031
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2032
+ onlyExecuted: true,
2033
+ }
2034
+ );
1383
2035
  ```
1384
2036
 
2037
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2038
+
2039
+
1385
2040
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1386
2041
 
1387
2042
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -1420,13 +2075,35 @@ Check your API key on the [Customer Dashboard billing page](https://dashboard.sn
1420
2075
 
1421
2076
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1422
2077
 
2078
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2079
+
1423
2080
  ```typescript
1424
2081
  const listConnectionAccountsResponse =
1425
- await snaptrade.experimentalEndpoints.listConnectionAccounts({
2082
+ await commercialApiKeyClient.experimentalEndpoints.listConnectionAccounts({
2083
+ connectionId: "87b24961-b51e-4db8-9226-f198f6518a89",
2084
+ userId: "snaptrade-user-123",
2085
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2086
+ });
2087
+ ```
2088
+
2089
+ Required credentials for this mode:
2090
+
2091
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2092
+
2093
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2094
+
2095
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2096
+
2097
+ ```typescript
2098
+ const listConnectionAccountsResponse =
2099
+ await personalApiKeyClient.experimentalEndpoints.listConnectionAccounts({
1426
2100
  connectionId: "87b24961-b51e-4db8-9226-f198f6518a89",
1427
2101
  });
1428
2102
  ```
1429
2103
 
2104
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2105
+
2106
+
1430
2107
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1431
2108
 
1432
2109
  ##### connectionId: `string`<a id="connectionid-string"></a>
@@ -1450,11 +2127,21 @@ Returns active Trade Detection subscriptions for your Client ID. Cancelled subsc
1450
2127
 
1451
2128
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1452
2129
 
2130
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2131
+
1453
2132
  ```typescript
1454
2133
  const listSubscriptionsResponse =
1455
- await snaptrade.experimentalEndpoints.listSubscriptions();
2134
+ await commercialApiKeyClient.experimentalEndpoints.listSubscriptions();
1456
2135
  ```
1457
2136
 
2137
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2138
+
2139
+ ```typescript
2140
+ const listSubscriptionsResponse =
2141
+ await personalApiKeyClient.experimentalEndpoints.listSubscriptions();
2142
+ ```
2143
+
2144
+
1458
2145
  #### 🔄 Return<a id="🔄-return"></a>
1459
2146
 
1460
2147
  [TradeDetectionSubscription](./models/trade-detection-subscription.ts)
@@ -1474,10 +2161,21 @@ Returns configurations for your SnapTrade Client ID, including allowed brokerage
1474
2161
 
1475
2162
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1476
2163
 
2164
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2165
+
1477
2166
  ```typescript
1478
- const getPartnerInfoResponse = await snaptrade.referenceData.getPartnerInfo();
2167
+ const getPartnerInfoResponse =
2168
+ await commercialApiKeyClient.referenceData.getPartnerInfo();
1479
2169
  ```
1480
2170
 
2171
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2172
+
2173
+ ```typescript
2174
+ const getPartnerInfoResponse =
2175
+ await personalApiKeyClient.referenceData.getPartnerInfo();
2176
+ ```
2177
+
2178
+
1481
2179
  #### 🔄 Return<a id="🔄-return"></a>
1482
2180
 
1483
2181
  [PartnerData](./models/partner-data.ts)
@@ -1497,11 +2195,21 @@ Returns a list of all supported Exchanges.
1497
2195
 
1498
2196
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1499
2197
 
2198
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2199
+
2200
+ ```typescript
2201
+ const getStockExchangesResponse =
2202
+ await commercialApiKeyClient.referenceData.getStockExchanges();
2203
+ ```
2204
+
2205
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2206
+
1500
2207
  ```typescript
1501
2208
  const getStockExchangesResponse =
1502
- await snaptrade.referenceData.getStockExchanges();
2209
+ await personalApiKeyClient.referenceData.getStockExchanges();
1503
2210
  ```
1504
2211
 
2212
+
1505
2213
  #### 🔄 Return<a id="🔄-return"></a>
1506
2214
 
1507
2215
  [Exchange](./models/exchange.ts)
@@ -1522,12 +2230,24 @@ Returns a list of Universal Symbol objects that match the given query. The match
1522
2230
 
1523
2231
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1524
2232
 
2233
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2234
+
1525
2235
  ```typescript
1526
- const getSymbolsResponse = await snaptrade.referenceData.getSymbols({
2236
+ const getSymbolsResponse =
2237
+ await commercialApiKeyClient.referenceData.getSymbols({
2238
+ substring: "AAPL",
2239
+ });
2240
+ ```
2241
+
2242
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2243
+
2244
+ ```typescript
2245
+ const getSymbolsResponse = await personalApiKeyClient.referenceData.getSymbols({
1527
2246
  substring: "AAPL",
1528
2247
  });
1529
2248
  ```
1530
2249
 
2250
+
1531
2251
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1532
2252
 
1533
2253
  ##### substring: `string`<a id="substring-string"></a>
@@ -1554,13 +2274,25 @@ Returns the Universal Symbol object specified by the ticker or the Universal Sym
1554
2274
 
1555
2275
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1556
2276
 
2277
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2278
+
2279
+ ```typescript
2280
+ const getSymbolsByTickerResponse =
2281
+ await commercialApiKeyClient.referenceData.getSymbolsByTicker({
2282
+ query: "query_example",
2283
+ });
2284
+ ```
2285
+
2286
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2287
+
1557
2288
  ```typescript
1558
2289
  const getSymbolsByTickerResponse =
1559
- await snaptrade.referenceData.getSymbolsByTicker({
2290
+ await personalApiKeyClient.referenceData.getSymbolsByTicker({
1560
2291
  query: "query_example",
1561
2292
  });
1562
2293
  ```
1563
2294
 
2295
+
1564
2296
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1565
2297
 
1566
2298
  ##### query: `string`<a id="query-string"></a>
@@ -1586,13 +2318,25 @@ Returns a list of all defined Brokerage authorization Type objects.
1586
2318
 
1587
2319
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1588
2320
 
2321
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2322
+
1589
2323
  ```typescript
1590
2324
  const listAllBrokerageAuthorizationTypeResponse =
1591
- await snaptrade.referenceData.listAllBrokerageAuthorizationType({
2325
+ await commercialApiKeyClient.referenceData.listAllBrokerageAuthorizationType({
1592
2326
  brokerage: "QUESTRADE,ALPACA",
1593
2327
  });
1594
2328
  ```
1595
2329
 
2330
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2331
+
2332
+ ```typescript
2333
+ const listAllBrokerageAuthorizationTypeResponse =
2334
+ await personalApiKeyClient.referenceData.listAllBrokerageAuthorizationType({
2335
+ brokerage: "QUESTRADE,ALPACA",
2336
+ });
2337
+ ```
2338
+
2339
+
1596
2340
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1597
2341
 
1598
2342
  ##### brokerage: `string`<a id="brokerage-string"></a>
@@ -1618,13 +2362,25 @@ Returns a list of all brokerage instruments available for a given brokerage. Not
1618
2362
 
1619
2363
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1620
2364
 
2365
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2366
+
1621
2367
  ```typescript
1622
2368
  const listAllBrokerageInstrumentsResponse =
1623
- await snaptrade.referenceData.listAllBrokerageInstruments({
2369
+ await commercialApiKeyClient.referenceData.listAllBrokerageInstruments({
1624
2370
  slug: "QUESTRADE",
1625
2371
  });
1626
2372
  ```
1627
2373
 
2374
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2375
+
2376
+ ```typescript
2377
+ const listAllBrokerageInstrumentsResponse =
2378
+ await personalApiKeyClient.referenceData.listAllBrokerageInstruments({
2379
+ slug: "QUESTRADE",
2380
+ });
2381
+ ```
2382
+
2383
+
1628
2384
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1629
2385
 
1630
2386
  ##### slug: `string`<a id="slug-string"></a>
@@ -1650,11 +2406,21 @@ Returns a list of all defined Brokerage objects.
1650
2406
 
1651
2407
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1652
2408
 
2409
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2410
+
1653
2411
  ```typescript
1654
2412
  const listAllBrokeragesResponse =
1655
- await snaptrade.referenceData.listAllBrokerages();
2413
+ await commercialApiKeyClient.referenceData.listAllBrokerages();
1656
2414
  ```
1657
2415
 
2416
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2417
+
2418
+ ```typescript
2419
+ const listAllBrokeragesResponse =
2420
+ await personalApiKeyClient.referenceData.listAllBrokerages();
2421
+ ```
2422
+
2423
+
1658
2424
  #### 🔄 Return<a id="🔄-return"></a>
1659
2425
 
1660
2426
  [Brokerage](./models/brokerage.ts)
@@ -1677,14 +2443,37 @@ The search results are further limited to the symbols supported by the brokerage
1677
2443
 
1678
2444
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1679
2445
 
2446
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2447
+
1680
2448
  ```typescript
1681
2449
  const symbolSearchUserAccountResponse =
1682
- await snaptrade.referenceData.symbolSearchUserAccount({
2450
+ await commercialApiKeyClient.referenceData.symbolSearchUserAccount({
1683
2451
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1684
2452
  substring: "AAPL",
2453
+ userId: "snaptrade-user-123",
2454
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1685
2455
  });
1686
2456
  ```
1687
2457
 
2458
+ Required credentials for this mode:
2459
+
2460
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2461
+
2462
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2463
+
2464
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2465
+
2466
+ ```typescript
2467
+ const symbolSearchUserAccountResponse =
2468
+ await personalApiKeyClient.referenceData.symbolSearchUserAccount({
2469
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2470
+ substring: "AAPL",
2471
+ });
2472
+ ```
2473
+
2474
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2475
+
2476
+
1688
2477
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1689
2478
 
1690
2479
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -1708,18 +2497,40 @@ The search query for symbols.
1708
2497
 
1709
2498
  ### `snaptrade.trading.cancelOrder`<a id="snaptradetradingcancelorder"></a>
1710
2499
 
1711
- Cancels an order in the specified account. Accepts order IDs for all asset types.
2500
+ Cancels an order in the specified account. Accepts order IDs for all asset types.
2501
+
2502
+
2503
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
2504
+
2505
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2506
+
2507
+ ```typescript
2508
+ const cancelOrderResponse = await commercialApiKeyClient.trading.cancelOrder({
2509
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
2510
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2511
+ userId: "snaptrade-user-123",
2512
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2513
+ });
2514
+ ```
2515
+
2516
+ Required credentials for this mode:
2517
+
2518
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
1712
2519
 
2520
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
1713
2521
 
1714
- #### 🛠️ Usage<a id="🛠️-usage"></a>
2522
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
1715
2523
 
1716
2524
  ```typescript
1717
- const cancelOrderResponse = await snaptrade.trading.cancelOrder({
1718
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2525
+ const cancelOrderResponse = await personalApiKeyClient.trading.cancelOrder({
1719
2526
  brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
2527
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1720
2528
  });
1721
2529
  ```
1722
2530
 
2531
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2532
+
2533
+
1723
2534
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1724
2535
 
1725
2536
  ##### brokerage_order_id: `string`<a id="brokerage_order_id-string"></a>
@@ -1748,14 +2559,37 @@ Gets a quote for the specified account.
1748
2559
 
1749
2560
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1750
2561
 
2562
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2563
+
2564
+ ```typescript
2565
+ const getCryptocurrencyPairQuoteResponse =
2566
+ await commercialApiKeyClient.trading.getCryptocurrencyPairQuote({
2567
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2568
+ instrumentSymbol: "BTC-USD",
2569
+ userId: "snaptrade-user-123",
2570
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2571
+ });
2572
+ ```
2573
+
2574
+ Required credentials for this mode:
2575
+
2576
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2577
+
2578
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2579
+
2580
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2581
+
1751
2582
  ```typescript
1752
2583
  const getCryptocurrencyPairQuoteResponse =
1753
- await snaptrade.trading.getCryptocurrencyPairQuote({
2584
+ await personalApiKeyClient.trading.getCryptocurrencyPairQuote({
1754
2585
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1755
2586
  instrumentSymbol: "BTC-USD",
1756
2587
  });
1757
2588
  ```
1758
2589
 
2590
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2591
+
2592
+
1759
2593
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1760
2594
 
1761
2595
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -1783,27 +2617,65 @@ Only supported for certain enabled brokerages. Please refer to the [brokerage tr
1783
2617
 
1784
2618
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1785
2619
 
2620
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2621
+
1786
2622
  ```typescript
1787
- const getOptionImpactResponse = await snaptrade.trading.getOptionImpact({
1788
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1789
- order_type: "MARKET",
1790
- time_in_force: "Day",
1791
- limit_price: "",
1792
- stop_price: "",
1793
- price_effect: "DEBIT",
1794
- legs: [
1795
- {
1796
- instrument: {
1797
- symbol: "PBI 250718C00006000",
1798
- instrument_type: "OPTION",
2623
+ const getOptionImpactResponse =
2624
+ await commercialApiKeyClient.trading.getOptionImpact({
2625
+ order_type: "MARKET",
2626
+ time_in_force: "Day",
2627
+ legs: [
2628
+ {
2629
+ instrument: {
2630
+ symbol: "PBI 250718C00006000",
2631
+ instrument_type: "OPTION",
2632
+ },
2633
+ action: "BUY_TO_OPEN",
2634
+ units: 1,
1799
2635
  },
1800
- action: "BUY_TO_OPEN",
1801
- units: 1,
1802
- },
1803
- ],
1804
- });
2636
+ ],
2637
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2638
+ limit_price: "",
2639
+ stop_price: "",
2640
+ price_effect: "DEBIT",
2641
+ userId: "snaptrade-user-123",
2642
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2643
+ });
1805
2644
  ```
1806
2645
 
2646
+ Required credentials for this mode:
2647
+
2648
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2649
+
2650
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2651
+
2652
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2653
+
2654
+ ```typescript
2655
+ const getOptionImpactResponse =
2656
+ await personalApiKeyClient.trading.getOptionImpact({
2657
+ order_type: "MARKET",
2658
+ time_in_force: "Day",
2659
+ legs: [
2660
+ {
2661
+ instrument: {
2662
+ symbol: "PBI 250718C00006000",
2663
+ instrument_type: "OPTION",
2664
+ },
2665
+ action: "BUY_TO_OPEN",
2666
+ units: 1,
2667
+ },
2668
+ ],
2669
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2670
+ limit_price: "",
2671
+ stop_price: "",
2672
+ price_effect: "DEBIT",
2673
+ });
2674
+ ```
2675
+
2676
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2677
+
2678
+
1807
2679
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1808
2680
 
1809
2681
  ##### order_type: [`MlegOrderTypeStrict`](./models/mleg-order-type-strict.ts)<a id="order_type-mlegordertypestrictmodelsmleg-order-type-strictts"></a>
@@ -1847,19 +2719,51 @@ Simulates an order and its impact on the account. This endpoint does not place t
1847
2719
 
1848
2720
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1849
2721
 
2722
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2723
+
1850
2724
  ```typescript
1851
- const getOrderImpactResponse = await snaptrade.trading.getOrderImpact({
1852
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1853
- action: "BUY",
1854
- universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1855
- order_type: "Market",
1856
- time_in_force: "Day",
1857
- price: 31.33,
1858
- stop: 31.33,
1859
- units: 10.5,
1860
- });
2725
+ const getOrderImpactResponse =
2726
+ await commercialApiKeyClient.trading.getOrderImpact({
2727
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2728
+ action: "BUY",
2729
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
2730
+ order_type: "Market",
2731
+ time_in_force: "Day",
2732
+ price: 31.33,
2733
+ stop: 31.33,
2734
+ units: 10.5,
2735
+ notional_value: null,
2736
+ userId: "snaptrade-user-123",
2737
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2738
+ });
2739
+ ```
2740
+
2741
+ Required credentials for this mode:
2742
+
2743
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2744
+
2745
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2746
+
2747
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2748
+
2749
+ ```typescript
2750
+ const getOrderImpactResponse =
2751
+ await personalApiKeyClient.trading.getOrderImpact({
2752
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2753
+ action: "BUY",
2754
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
2755
+ order_type: "Market",
2756
+ time_in_force: "Day",
2757
+ price: 31.33,
2758
+ stop: 31.33,
2759
+ units: 10.5,
2760
+ notional_value: null,
2761
+ });
1861
2762
  ```
1862
2763
 
2764
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2765
+
2766
+
1863
2767
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1864
2768
 
1865
2769
  ##### account_id: `string`<a id="account_id-string"></a>
@@ -1918,14 +2822,37 @@ Returns a quote for a single option contract. The option contract is specified u
1918
2822
 
1919
2823
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1920
2824
 
2825
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2826
+
2827
+ ```typescript
2828
+ const getUserAccountOptionQuotesResponse =
2829
+ await commercialApiKeyClient.trading.getUserAccountOptionQuotes({
2830
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2831
+ symbol: "AAPL 251219C00150000",
2832
+ userId: "snaptrade-user-123",
2833
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2834
+ });
2835
+ ```
2836
+
2837
+ Required credentials for this mode:
2838
+
2839
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2840
+
2841
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2842
+
2843
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2844
+
1921
2845
  ```typescript
1922
2846
  const getUserAccountOptionQuotesResponse =
1923
- await snaptrade.trading.getUserAccountOptionQuotes({
2847
+ await personalApiKeyClient.trading.getUserAccountOptionQuotes({
1924
2848
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1925
2849
  symbol: "AAPL 251219C00150000",
1926
2850
  });
1927
2851
  ```
1928
2852
 
2853
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2854
+
2855
+
1929
2856
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1930
2857
 
1931
2858
  ##### accountId: `string`<a id="accountid-string"></a>
@@ -1960,14 +2887,39 @@ This endpoint does not work for options quotes.
1960
2887
 
1961
2888
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1962
2889
 
2890
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2891
+
2892
+ ```typescript
2893
+ const getUserAccountQuotesResponse =
2894
+ await commercialApiKeyClient.trading.getUserAccountQuotes({
2895
+ symbols: "symbols_example",
2896
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2897
+ useTicker: true,
2898
+ userId: "snaptrade-user-123",
2899
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2900
+ });
2901
+ ```
2902
+
2903
+ Required credentials for this mode:
2904
+
2905
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2906
+
2907
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2908
+
2909
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2910
+
1963
2911
  ```typescript
1964
2912
  const getUserAccountQuotesResponse =
1965
- await snaptrade.trading.getUserAccountQuotes({
2913
+ await personalApiKeyClient.trading.getUserAccountQuotes({
1966
2914
  symbols: "symbols_example",
1967
2915
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2916
+ useTicker: true,
1968
2917
  });
1969
2918
  ```
1970
2919
 
2920
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2921
+
2922
+
1971
2923
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1972
2924
 
1973
2925
  ##### symbols: `string`<a id="symbols-string"></a>
@@ -2006,29 +2958,69 @@ Please refer to the [brokerage trading support page](https://support.snaptrade.c
2006
2958
 
2007
2959
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2008
2960
 
2961
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2962
+
2009
2963
  ```typescript
2010
- const placeComplexOrderResponse = await snaptrade.trading.placeComplexOrder({
2011
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2012
- type: "OTO",
2013
- orders: [
2014
- {
2015
- order_role: "TRIGGER",
2016
- action: "BUY",
2017
- instrument: {
2018
- symbol: "AAPL",
2019
- type: "EQUITY",
2964
+ const placeComplexOrderResponse =
2965
+ await commercialApiKeyClient.trading.placeComplexOrder({
2966
+ type: "OTO",
2967
+ orders: [
2968
+ {
2969
+ order_role: "TRIGGER",
2970
+ action: "BUY",
2971
+ instrument: {
2972
+ symbol: "AAPL",
2973
+ type: "EQUITY",
2974
+ },
2975
+ order_type: "Market",
2976
+ units: 1,
2977
+ time_in_force: "Day",
2978
+ price: 31.33,
2979
+ stop: 29.5,
2020
2980
  },
2021
- order_type: "Market",
2022
- units: 10.5,
2023
- time_in_force: "Day",
2024
- price: 31.33,
2025
- stop: 29.5,
2026
- },
2027
- ],
2028
- client_order_id: "550e8400-e29b-41d4-a716-446655440000",
2029
- });
2981
+ ],
2982
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2983
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
2984
+ userId: "snaptrade-user-123",
2985
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2986
+ });
2987
+ ```
2988
+
2989
+ Required credentials for this mode:
2990
+
2991
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
2992
+
2993
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
2994
+
2995
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2996
+
2997
+ ```typescript
2998
+ const placeComplexOrderResponse =
2999
+ await personalApiKeyClient.trading.placeComplexOrder({
3000
+ type: "OTO",
3001
+ orders: [
3002
+ {
3003
+ order_role: "TRIGGER",
3004
+ action: "BUY",
3005
+ instrument: {
3006
+ symbol: "AAPL",
3007
+ type: "EQUITY",
3008
+ },
3009
+ order_type: "Market",
3010
+ units: 1,
3011
+ time_in_force: "Day",
3012
+ price: 31.33,
3013
+ stop: 29.5,
3014
+ },
3015
+ ],
3016
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3017
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
3018
+ });
2030
3019
  ```
2031
3020
 
3021
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3022
+
3023
+
2032
3024
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2033
3025
 
2034
3026
  ##### type: `string`<a id="type-string"></a>
@@ -2066,24 +3058,59 @@ This endpoint does not compute the impact to the account balance from the order
2066
3058
 
2067
3059
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2068
3060
 
3061
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
3062
+
2069
3063
  ```typescript
2070
- const placeCryptoOrderResponse = await snaptrade.trading.placeCryptoOrder({
2071
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2072
- instrument: {
2073
- symbol: "BTC",
2074
- type: "CRYPTOCURRENCY",
2075
- },
2076
- side: "BUY",
2077
- type: "MARKET",
2078
- time_in_force: "GTC",
2079
- amount: "123.45",
2080
- limit_price: "123.45",
2081
- stop_price: "123.45",
2082
- post_only: false,
2083
- expiration_date: "2024-01-01T00:00:00.000Z",
2084
- });
3064
+ const placeCryptoOrderResponse =
3065
+ await commercialApiKeyClient.trading.placeCryptoOrder({
3066
+ instrument: {
3067
+ symbol: "BTC",
3068
+ type: "CRYPTOCURRENCY",
3069
+ },
3070
+ side: "BUY",
3071
+ type: "MARKET",
3072
+ time_in_force: "GTC",
3073
+ amount: "123.45",
3074
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3075
+ limit_price: "123.45",
3076
+ stop_price: "123.45",
3077
+ post_only: false,
3078
+ expiration_date: "2024-01-01T00:00:00.000Z",
3079
+ userId: "snaptrade-user-123",
3080
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
3081
+ });
2085
3082
  ```
2086
3083
 
3084
+ Required credentials for this mode:
3085
+
3086
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
3087
+
3088
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
3089
+
3090
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
3091
+
3092
+ ```typescript
3093
+ const placeCryptoOrderResponse =
3094
+ await personalApiKeyClient.trading.placeCryptoOrder({
3095
+ instrument: {
3096
+ symbol: "BTC",
3097
+ type: "CRYPTOCURRENCY",
3098
+ },
3099
+ side: "BUY",
3100
+ type: "MARKET",
3101
+ time_in_force: "GTC",
3102
+ amount: "123.45",
3103
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3104
+ limit_price: "123.45",
3105
+ stop_price: "123.45",
3106
+ post_only: false,
3107
+ expiration_date: "2024-01-01T00:00:00.000Z",
3108
+ });
3109
+ ```
3110
+
3111
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3112
+
3113
+
2087
3114
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2088
3115
 
2089
3116
  ##### instrument: [`CryptoTradingInstrument`](./models/crypto-trading-instrument.ts)<a id="instrument-cryptotradinginstrumentmodelscrypto-trading-instrumentts"></a>
@@ -2146,23 +3173,59 @@ It's recommended to trigger a manual refresh of the account after placing an ord
2146
3173
 
2147
3174
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2148
3175
 
3176
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
3177
+
2149
3178
  ```typescript
2150
- const placeForceOrderResponse = await snaptrade.trading.placeForceOrder({
2151
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2152
- action: "BUY",
2153
- universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
2154
- symbol: "AAPL",
2155
- order_type: "Market",
2156
- time_in_force: "Day",
2157
- trading_session: "REGULAR",
2158
- expiry_date: "2026-08-21T23:27:55.027Z",
2159
- price: 31.33,
2160
- stop: 31.33,
2161
- units: 10.5,
2162
- client_order_id: "550e8400-e29b-41d4-a716-446655440000",
2163
- });
3179
+ const placeForceOrderResponse =
3180
+ await commercialApiKeyClient.trading.placeForceOrder({
3181
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3182
+ action: "BUY",
3183
+ order_type: "Market",
3184
+ time_in_force: "Day",
3185
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
3186
+ symbol: "AAPL",
3187
+ trading_session: "REGULAR",
3188
+ expiry_date: "2026-08-21T23:27:55.027Z",
3189
+ price: 31.33,
3190
+ stop: 31.33,
3191
+ units: 10.5,
3192
+ notional_value: null,
3193
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
3194
+ userId: "snaptrade-user-123",
3195
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
3196
+ });
3197
+ ```
3198
+
3199
+ Required credentials for this mode:
3200
+
3201
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
3202
+
3203
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
3204
+
3205
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
3206
+
3207
+ ```typescript
3208
+ const placeForceOrderResponse =
3209
+ await personalApiKeyClient.trading.placeForceOrder({
3210
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3211
+ action: "BUY",
3212
+ order_type: "Market",
3213
+ time_in_force: "Day",
3214
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
3215
+ symbol: "AAPL",
3216
+ trading_session: "REGULAR",
3217
+ expiry_date: "2026-08-21T23:27:55.027Z",
3218
+ price: 31.33,
3219
+ stop: 31.33,
3220
+ units: 10.5,
3221
+ notional_value: null,
3222
+ client_order_id: "550e8400-e29b-41d4-a716-446655440000",
3223
+ });
2164
3224
  ```
2165
3225
 
3226
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3227
+
3228
+
2166
3229
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2167
3230
 
2168
3231
  ##### account_id: `string`<a id="account_id-string"></a>
@@ -2233,27 +3296,65 @@ Places a multi-leg option order. Only supported on certain option trading broker
2233
3296
 
2234
3297
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2235
3298
 
3299
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
3300
+
2236
3301
  ```typescript
2237
- const placeMlegOrderResponse = await snaptrade.trading.placeMlegOrder({
2238
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2239
- order_type: "MARKET",
2240
- time_in_force: "Day",
2241
- limit_price: "",
2242
- stop_price: "",
2243
- price_effect: "DEBIT",
2244
- legs: [
2245
- {
2246
- instrument: {
2247
- symbol: "PBI 250718C00006000",
2248
- instrument_type: "OPTION",
3302
+ const placeMlegOrderResponse =
3303
+ await commercialApiKeyClient.trading.placeMlegOrder({
3304
+ order_type: "MARKET",
3305
+ time_in_force: "Day",
3306
+ legs: [
3307
+ {
3308
+ instrument: {
3309
+ symbol: "PBI 250718C00006000",
3310
+ instrument_type: "OPTION",
3311
+ },
3312
+ action: "BUY_TO_OPEN",
3313
+ units: 1,
2249
3314
  },
2250
- action: "BUY_TO_OPEN",
2251
- units: 1,
2252
- },
2253
- ],
2254
- });
3315
+ ],
3316
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3317
+ limit_price: "",
3318
+ stop_price: "",
3319
+ price_effect: "DEBIT",
3320
+ userId: "snaptrade-user-123",
3321
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
3322
+ });
3323
+ ```
3324
+
3325
+ Required credentials for this mode:
3326
+
3327
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
3328
+
3329
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
3330
+
3331
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
3332
+
3333
+ ```typescript
3334
+ const placeMlegOrderResponse =
3335
+ await personalApiKeyClient.trading.placeMlegOrder({
3336
+ order_type: "MARKET",
3337
+ time_in_force: "Day",
3338
+ legs: [
3339
+ {
3340
+ instrument: {
3341
+ symbol: "PBI 250718C00006000",
3342
+ instrument_type: "OPTION",
3343
+ },
3344
+ action: "BUY_TO_OPEN",
3345
+ units: 1,
3346
+ },
3347
+ ],
3348
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3349
+ limit_price: "",
3350
+ stop_price: "",
3351
+ price_effect: "DEBIT",
3352
+ });
2255
3353
  ```
2256
3354
 
3355
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3356
+
3357
+
2257
3358
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2258
3359
 
2259
3360
  ##### order_type: [`MlegOrderTypeStrict`](./models/mleg-order-type-strict.ts)<a id="order_type-mlegordertypestrictmodelsmleg-order-type-strictts"></a>
@@ -2300,13 +3401,35 @@ It's recommended to trigger a manual refresh of the account after placing an ord
2300
3401
 
2301
3402
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2302
3403
 
3404
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
3405
+
3406
+ ```typescript
3407
+ const placeOrderResponse = await commercialApiKeyClient.trading.placeOrder({
3408
+ tradeId: "139e307a-82f7-4402-b39e-4da7baa87758",
3409
+ wait_to_confirm: true,
3410
+ userId: "snaptrade-user-123",
3411
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
3412
+ });
3413
+ ```
3414
+
3415
+ Required credentials for this mode:
3416
+
3417
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
3418
+
3419
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
3420
+
3421
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
3422
+
2303
3423
  ```typescript
2304
- const placeOrderResponse = await snaptrade.trading.placeOrder({
3424
+ const placeOrderResponse = await personalApiKeyClient.trading.placeOrder({
2305
3425
  tradeId: "139e307a-82f7-4402-b39e-4da7baa87758",
2306
3426
  wait_to_confirm: true,
2307
3427
  });
2308
3428
  ```
2309
3429
 
3430
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3431
+
3432
+
2310
3433
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2311
3434
 
2312
3435
  ##### tradeId: `string`<a id="tradeid-string"></a>
@@ -2337,24 +3460,59 @@ Previews an order using the specified account.
2337
3460
 
2338
3461
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2339
3462
 
3463
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
3464
+
2340
3465
  ```typescript
2341
- const previewCryptoOrderResponse = await snaptrade.trading.previewCryptoOrder({
2342
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2343
- instrument: {
2344
- symbol: "BTC",
2345
- type: "CRYPTOCURRENCY",
2346
- },
2347
- side: "BUY",
2348
- type: "MARKET",
2349
- time_in_force: "GTC",
2350
- amount: "123.45",
2351
- limit_price: "123.45",
2352
- stop_price: "123.45",
2353
- post_only: false,
2354
- expiration_date: "2024-01-01T00:00:00.000Z",
2355
- });
3466
+ const previewCryptoOrderResponse =
3467
+ await commercialApiKeyClient.trading.previewCryptoOrder({
3468
+ instrument: {
3469
+ symbol: "BTC",
3470
+ type: "CRYPTOCURRENCY",
3471
+ },
3472
+ side: "BUY",
3473
+ type: "MARKET",
3474
+ time_in_force: "GTC",
3475
+ amount: "123.45",
3476
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3477
+ limit_price: "123.45",
3478
+ stop_price: "123.45",
3479
+ post_only: false,
3480
+ expiration_date: "2024-01-01T00:00:00.000Z",
3481
+ userId: "snaptrade-user-123",
3482
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
3483
+ });
3484
+ ```
3485
+
3486
+ Required credentials for this mode:
3487
+
3488
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
3489
+
3490
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
3491
+
3492
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
3493
+
3494
+ ```typescript
3495
+ const previewCryptoOrderResponse =
3496
+ await personalApiKeyClient.trading.previewCryptoOrder({
3497
+ instrument: {
3498
+ symbol: "BTC",
3499
+ type: "CRYPTOCURRENCY",
3500
+ },
3501
+ side: "BUY",
3502
+ type: "MARKET",
3503
+ time_in_force: "GTC",
3504
+ amount: "123.45",
3505
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3506
+ limit_price: "123.45",
3507
+ stop_price: "123.45",
3508
+ post_only: false,
3509
+ expiration_date: "2024-01-01T00:00:00.000Z",
3510
+ });
2356
3511
  ```
2357
3512
 
3513
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3514
+
3515
+
2358
3516
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2359
3517
 
2360
3518
  ##### instrument: [`CryptoTradingInstrument`](./models/crypto-trading-instrument.ts)<a id="instrument-cryptotradinginstrumentmodelscrypto-trading-instrumentts"></a>
@@ -2415,13 +3573,39 @@ returned in the response going forward. Only supported on some brokerages
2415
3573
 
2416
3574
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2417
3575
 
3576
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
3577
+
2418
3578
  ```typescript
2419
- const replaceOrderResponse = await snaptrade.trading.replaceOrder({
3579
+ const replaceOrderResponse = await commercialApiKeyClient.trading.replaceOrder({
3580
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
3581
+ action: "BUY",
3582
+ order_type: "Market",
3583
+ time_in_force: "Day",
2420
3584
  accountId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
3585
+ price: 31.33,
3586
+ symbol: "AAPL",
3587
+ stop: 31.33,
3588
+ units: 10.5,
3589
+ userId: "snaptrade-user-123",
3590
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
3591
+ });
3592
+ ```
3593
+
3594
+ Required credentials for this mode:
3595
+
3596
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
3597
+
3598
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
3599
+
3600
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
3601
+
3602
+ ```typescript
3603
+ const replaceOrderResponse = await personalApiKeyClient.trading.replaceOrder({
2421
3604
  brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
2422
3605
  action: "BUY",
2423
3606
  order_type: "Market",
2424
3607
  time_in_force: "Day",
3608
+ accountId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
2425
3609
  price: 31.33,
2426
3610
  symbol: "AAPL",
2427
3611
  stop: 31.33,
@@ -2429,6 +3613,9 @@ const replaceOrderResponse = await snaptrade.trading.replaceOrder({
2429
3613
  });
2430
3614
  ```
2431
3615
 
3616
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3617
+
3618
+
2432
3619
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2433
3620
 
2434
3621
  ##### brokerage_order_id: `string`<a id="brokerage_order_id-string"></a>
@@ -2485,15 +3672,39 @@ Searches cryptocurrency pairs instruments accessible to the specified account. B
2485
3672
 
2486
3673
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2487
3674
 
3675
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
3676
+
2488
3677
  ```typescript
2489
3678
  const searchCryptocurrencyPairInstrumentsResponse =
2490
- await snaptrade.trading.searchCryptocurrencyPairInstruments({
3679
+ await commercialApiKeyClient.trading.searchCryptocurrencyPairInstruments({
3680
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
3681
+ base: "BTC",
3682
+ quote: "USD",
3683
+ userId: "snaptrade-user-123",
3684
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
3685
+ });
3686
+ ```
3687
+
3688
+ Required credentials for this mode:
3689
+
3690
+ - `userId` (string, required): SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
3691
+
3692
+ - `userSecret` (string, required): SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
3693
+
3694
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
3695
+
3696
+ ```typescript
3697
+ const searchCryptocurrencyPairInstrumentsResponse =
3698
+ await personalApiKeyClient.trading.searchCryptocurrencyPairInstruments({
2491
3699
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2492
3700
  base: "BTC",
2493
3701
  quote: "USD",
2494
3702
  });
2495
3703
  ```
2496
3704
 
3705
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
3706
+
3707
+
2497
3708
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2498
3709
 
2499
3710
  ##### accountId: `string`<a id="accountid-string"></a>