snaptrade-typescript-sdk 13.2.5 → 13.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,7 +63,7 @@ backoff with jitter rather than from the headers.
63
63
  See https://docs.snaptrade.com/docs/ratelimiting.
64
64
 
65
65
 
66
- [![npm](https://img.shields.io/badge/npm-v13.2.5-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.2.5)
66
+ [![npm](https://img.shields.io/badge/npm-v13.2.6-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.2.6)
67
67
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
68
68
 
69
69
  </div>
@@ -83,7 +83,10 @@ See https://docs.snaptrade.com/docs/ratelimiting.
83
83
  * [`snaptrade.accountInformation.getAccountBalanceHistory`](#snaptradeaccountinformationgetaccountbalancehistory)
84
84
  * [`snaptrade.accountInformation.getAccountBalancesV2`](#snaptradeaccountinformationgetaccountbalancesv2)
85
85
  * [`snaptrade.accountInformation.getAccountDetails`](#snaptradeaccountinformationgetaccountdetails)
86
+ * [`snaptrade.accountInformation.getAccountOrder`](#snaptradeaccountinformationgetaccountorder)
87
+ * [`snaptrade.accountInformation.getAllAccountOrders`](#snaptradeaccountinformationgetallaccountorders)
86
88
  * [`snaptrade.accountInformation.getAllAccountPositions`](#snaptradeaccountinformationgetallaccountpositions)
89
+ * [`snaptrade.accountInformation.getAllAccountRecentOrders`](#snaptradeaccountinformationgetallaccountrecentorders)
87
90
  * [`snaptrade.accountInformation.getUserAccountBalance`](#snaptradeaccountinformationgetuseraccountbalance)
88
91
  * [`snaptrade.accountInformation.getUserAccountDetails`](#snaptradeaccountinformationgetuseraccountdetails)
89
92
  * [`snaptrade.accountInformation.getUserAccountOrderDetail`](#snaptradeaccountinformationgetuseraccountorderdetail)
@@ -111,9 +114,6 @@ See https://docs.snaptrade.com/docs/ratelimiting.
111
114
  * [`snaptrade.connections.syncBrokerageAuthorizationTransactions`](#snaptradeconnectionssyncbrokerageauthorizationtransactions)
112
115
  * [`snaptrade.experimentalEndpoints.addSubscription`](#snaptradeexperimentalendpointsaddsubscription)
113
116
  * [`snaptrade.experimentalEndpoints.cancelSubscription`](#snaptradeexperimentalendpointscancelsubscription)
114
- * [`snaptrade.experimentalEndpoints.getAccountOrder`](#snaptradeexperimentalendpointsgetaccountorder)
115
- * [`snaptrade.experimentalEndpoints.getAllAccountOrders`](#snaptradeexperimentalendpointsgetallaccountorders)
116
- * [`snaptrade.experimentalEndpoints.getAllAccountRecentOrders`](#snaptradeexperimentalendpointsgetallaccountrecentorders)
117
117
  * [`snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`](#snaptradeexperimentalendpointsgetuseraccountorderdetailv2)
118
118
  * [`snaptrade.experimentalEndpoints.getUserAccountOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountordersv2)
119
119
  * [`snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountrecentordersv2)
@@ -343,8 +343,8 @@ If the connection has become disabled, it can no longer access the latest data f
343
343
  const getAccountActivitiesResponse =
344
344
  await commercialApiKeyClient.accountInformation.getAccountActivities({
345
345
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
346
- startDate: "2022-01-24T00:00:00.000Z",
347
- endDate: "2022-01-24T00:00:00.000Z",
346
+ startDate: "2022-01-24",
347
+ endDate: "2022-01-24",
348
348
  offset: 0,
349
349
  limit: 1,
350
350
  type: "BUY,SELL,DIVIDEND",
@@ -365,8 +365,8 @@ Required credentials for this mode:
365
365
  const getAccountActivitiesResponse =
366
366
  await personalApiKeyClient.accountInformation.getAccountActivities({
367
367
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
368
- startDate: "2022-01-24T00:00:00.000Z",
369
- endDate: "2022-01-24T00:00:00.000Z",
368
+ startDate: "2022-01-24",
369
+ endDate: "2022-01-24",
370
370
  offset: 0,
371
371
  limit: 1,
372
372
  type: "BUY,SELL,DIVIDEND",
@@ -381,8 +381,8 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
381
381
  const getAccountActivitiesResponse =
382
382
  await oauthClient.accountInformation.getAccountActivities({
383
383
  accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
384
- startDate: "2022-01-24T00:00:00.000Z",
385
- endDate: "2022-01-24T00:00:00.000Z",
384
+ startDate: "2022-01-24",
385
+ endDate: "2022-01-24",
386
386
  offset: 0,
387
387
  limit: 1,
388
388
  type: "BUY,SELL,DIVIDEND",
@@ -630,6 +630,144 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
630
630
  ---
631
631
 
632
632
 
633
+ ### `snaptrade.accountInformation.getAccountOrder`<a id="snaptradeaccountinformationgetaccountorder"></a>
634
+
635
+ Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`.
636
+
637
+ The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs.
638
+
639
+ This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change.
640
+
641
+ This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
642
+
643
+ **Beta:** this endpoint and its response schema may change.
644
+
645
+
646
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
647
+
648
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
649
+
650
+ ```typescript
651
+ const getAccountOrderResponse =
652
+ await commercialApiKeyClient.accountInformation.getAccountOrder({
653
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
654
+ brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
655
+ userId: "snaptrade-user-123",
656
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
657
+ });
658
+ ```
659
+
660
+ Required credentials for this mode:
661
+
662
+ - `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.
663
+
664
+ - `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).
665
+
666
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
667
+
668
+ ```typescript
669
+ const getAccountOrderResponse =
670
+ await personalApiKeyClient.accountInformation.getAccountOrder({
671
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
672
+ brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
673
+ });
674
+ ```
675
+
676
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
677
+
678
+
679
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
680
+
681
+ ##### accountId: `string`<a id="accountid-string"></a>
682
+
683
+ ##### brokerageOrderId: `string`<a id="brokerageorderid-string"></a>
684
+
685
+ #### 🔄 Return<a id="🔄-return"></a>
686
+
687
+ [AccountOrder](./models/account-order.ts)
688
+
689
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
690
+
691
+ `/accounts/{accountId}/orders/{brokerageOrderId}` `GET`
692
+
693
+ [🔙 **Back to Table of Contents**](#table-of-contents)
694
+
695
+ ---
696
+
697
+
698
+ ### `snaptrade.accountInformation.getAllAccountOrders`<a id="snaptradeaccountinformationgetallaccountorders"></a>
699
+
700
+ Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
701
+
702
+ Every order carries a `legs` list with at least one leg. Each leg's `instrument` uses the same `Instrument` union as positions; switch on `instrument.kind` to know which fields are present. Multi-leg orders (spreads, strangles, covered calls) are a single order with multiple legs. Orders that belong to a complex order group (OCO, OTO, OTOCO) share a `group.id`.
703
+
704
+ `order_type` is an object discriminated by `kind`. Each kind declares the price fields it requires (`limit_price` on `limit`, `stop_price` on `stop`, both on `stop_limit`, `trail` on `trailing_stop`), so a consumer never has to null-check a price that cannot exist for that kind. When the brokerage reports an order type we cannot normalize, `kind` is `other` and the brokerage's own label is in `raw_type`.
705
+
706
+ **Beta:** this endpoint and its response schema may change.
707
+
708
+ If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
709
+
710
+
711
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
712
+
713
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
714
+
715
+ ```typescript
716
+ const getAllAccountOrdersResponse =
717
+ await commercialApiKeyClient.accountInformation.getAllAccountOrders({
718
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
719
+ state: "all",
720
+ days: 30,
721
+ userId: "snaptrade-user-123",
722
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
723
+ });
724
+ ```
725
+
726
+ Required credentials for this mode:
727
+
728
+ - `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.
729
+
730
+ - `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).
731
+
732
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
733
+
734
+ ```typescript
735
+ const getAllAccountOrdersResponse =
736
+ await personalApiKeyClient.accountInformation.getAllAccountOrders({
737
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
738
+ state: "all",
739
+ days: 30,
740
+ });
741
+ ```
742
+
743
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
744
+
745
+
746
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
747
+
748
+ ##### accountId: `string`<a id="accountid-string"></a>
749
+
750
+ ##### state: `'all' | 'open' | 'executed'`<a id="state-all--open--executed"></a>
751
+
752
+ defaults to \"all\"
753
+
754
+ ##### days: `number`<a id="days-number"></a>
755
+
756
+ Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
757
+
758
+ #### 🔄 Return<a id="🔄-return"></a>
759
+
760
+ [AllAccountOrdersResponse](./models/all-account-orders-response.ts)
761
+
762
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
763
+
764
+ `/accounts/{accountId}/orders/all` `GET`
765
+
766
+ [🔙 **Back to Table of Contents**](#table-of-contents)
767
+
768
+ ---
769
+
770
+
633
771
  ### `snaptrade.accountInformation.getAllAccountPositions`<a id="snaptradeaccountinformationgetallaccountpositions"></a>
634
772
 
635
773
  Returns a list of all positions in the specified account.
@@ -702,6 +840,74 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
702
840
  ---
703
841
 
704
842
 
843
+ ### `snaptrade.accountInformation.getAllAccountRecentOrders`<a id="snaptradeaccountinformationgetallaccountrecentorders"></a>
844
+
845
+ A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders.
846
+ This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders.
847
+ Differs from `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days.
848
+ By default only returns executed orders, but that can be changed by setting *only_executed* to false.
849
+
850
+ Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request.
851
+
852
+ **Beta:** this endpoint and its response schema may change.
853
+
854
+ **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
855
+
856
+
857
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
858
+
859
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
860
+
861
+ ```typescript
862
+ const getAllAccountRecentOrdersResponse =
863
+ await commercialApiKeyClient.accountInformation.getAllAccountRecentOrders({
864
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
865
+ onlyExecuted: true,
866
+ userId: "snaptrade-user-123",
867
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
868
+ });
869
+ ```
870
+
871
+ Required credentials for this mode:
872
+
873
+ - `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.
874
+
875
+ - `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).
876
+
877
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
878
+
879
+ ```typescript
880
+ const getAllAccountRecentOrdersResponse =
881
+ await personalApiKeyClient.accountInformation.getAllAccountRecentOrders({
882
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
883
+ onlyExecuted: true,
884
+ });
885
+ ```
886
+
887
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
888
+
889
+
890
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
891
+
892
+ ##### accountId: `string`<a id="accountid-string"></a>
893
+
894
+ ##### onlyExecuted: `boolean`<a id="onlyexecuted-boolean"></a>
895
+
896
+ Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
897
+
898
+ #### 🔄 Return<a id="🔄-return"></a>
899
+
900
+ [AllAccountOrdersResponse](./models/all-account-orders-response.ts)
901
+
902
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
903
+
904
+ `/accounts/{accountId}/orders/recent` `GET`
905
+
906
+ [🔙 **Back to Table of Contents**](#table-of-contents)
907
+
908
+ ---
909
+
910
+
705
911
  ### `snaptrade.accountInformation.getUserAccountBalance`<a id="snaptradeaccountinformationgetuseraccountbalance"></a>
706
912
 
707
913
  Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances).
@@ -2370,212 +2576,6 @@ Unique identifier for the connected brokerage account. This is the UUID used to
2370
2576
  ---
2371
2577
 
2372
2578
 
2373
- ### `snaptrade.experimentalEndpoints.getAccountOrder`<a id="snaptradeexperimentalendpointsgetaccountorder"></a>
2374
-
2375
- Returns the detail of a single order, identified by the brokerage order ID in the path, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`.
2376
-
2377
- The order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. Multi-leg orders are a single order with multiple legs.
2378
-
2379
- This endpoint is always realtime and does not rely on cached data, except that an order in a terminal state (executed, canceled, rejected, failed, expired, replaced) may be served from a short-lived cache since it can no longer change.
2380
-
2381
- This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
2382
-
2383
- **Experimental:** this endpoint may change without notice.
2384
-
2385
-
2386
- #### 🛠️ Usage<a id="🛠️-usage"></a>
2387
-
2388
- ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2389
-
2390
- ```typescript
2391
- const getAccountOrderResponse =
2392
- await commercialApiKeyClient.experimentalEndpoints.getAccountOrder({
2393
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2394
- brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
2395
- userId: "snaptrade-user-123",
2396
- userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2397
- });
2398
- ```
2399
-
2400
- Required credentials for this mode:
2401
-
2402
- - `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.
2403
-
2404
- - `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).
2405
-
2406
- ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2407
-
2408
- ```typescript
2409
- const getAccountOrderResponse =
2410
- await personalApiKeyClient.experimentalEndpoints.getAccountOrder({
2411
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2412
- brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
2413
- });
2414
- ```
2415
-
2416
- The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2417
-
2418
-
2419
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2420
-
2421
- ##### accountId: `string`<a id="accountid-string"></a>
2422
-
2423
- ##### brokerageOrderId: `string`<a id="brokerageorderid-string"></a>
2424
-
2425
- #### 🔄 Return<a id="🔄-return"></a>
2426
-
2427
- [AccountOrder](./models/account-order.ts)
2428
-
2429
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2430
-
2431
- `/accounts/{accountId}/orders/{brokerageOrderId}` `GET`
2432
-
2433
- [🔙 **Back to Table of Contents**](#table-of-contents)
2434
-
2435
- ---
2436
-
2437
-
2438
- ### `snaptrade.experimentalEndpoints.getAllAccountOrders`<a id="snaptradeexperimentalendpointsgetallaccountorders"></a>
2439
-
2440
- Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
2441
-
2442
- Every order carries a `legs` list with at least one leg. Each leg's `instrument` uses the same `Instrument` union as positions; switch on `instrument.kind` to know which fields are present. Multi-leg orders (spreads, strangles, covered calls) are a single order with multiple legs. Orders that belong to a complex order group (OCO, OTO, OTOCO) share a `group.id`.
2443
-
2444
- `order_type` is an object discriminated by `kind`. Each kind declares the price fields it requires (`limit_price` on `limit`, `stop_price` on `stop`, both on `stop_limit`, `trail` on `trailing_stop`), so a consumer never has to null-check a price that cannot exist for that kind. When the brokerage reports an order type we cannot normalize, `kind` is `other` and the brokerage's own label is in `raw_type`.
2445
-
2446
- **Experimental:** this endpoint may change without notice.
2447
-
2448
- If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
2449
-
2450
-
2451
- #### 🛠️ Usage<a id="🛠️-usage"></a>
2452
-
2453
- ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2454
-
2455
- ```typescript
2456
- const getAllAccountOrdersResponse =
2457
- await commercialApiKeyClient.experimentalEndpoints.getAllAccountOrders({
2458
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2459
- state: "all",
2460
- days: 30,
2461
- userId: "snaptrade-user-123",
2462
- userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2463
- });
2464
- ```
2465
-
2466
- Required credentials for this mode:
2467
-
2468
- - `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.
2469
-
2470
- - `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).
2471
-
2472
- ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2473
-
2474
- ```typescript
2475
- const getAllAccountOrdersResponse =
2476
- await personalApiKeyClient.experimentalEndpoints.getAllAccountOrders({
2477
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2478
- state: "all",
2479
- days: 30,
2480
- });
2481
- ```
2482
-
2483
- The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2484
-
2485
-
2486
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2487
-
2488
- ##### accountId: `string`<a id="accountid-string"></a>
2489
-
2490
- ##### state: `'all' | 'open' | 'executed'`<a id="state-all--open--executed"></a>
2491
-
2492
- defaults to \"all\"
2493
-
2494
- ##### days: `number`<a id="days-number"></a>
2495
-
2496
- Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
2497
-
2498
- #### 🔄 Return<a id="🔄-return"></a>
2499
-
2500
- [AllAccountOrdersResponse](./models/all-account-orders-response.ts)
2501
-
2502
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2503
-
2504
- `/accounts/{accountId}/orders/all` `GET`
2505
-
2506
- [🔙 **Back to Table of Contents**](#table-of-contents)
2507
-
2508
- ---
2509
-
2510
-
2511
- ### `snaptrade.experimentalEndpoints.getAllAccountRecentOrders`<a id="snaptradeexperimentalendpointsgetallaccountrecentorders"></a>
2512
-
2513
- A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/orders/all`. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders.
2514
- This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders.
2515
- Differs from `/accounts/{accountId}/orders/all` in that it is always realtime, and only checks the last 24 hours as opposed to the last 30 days.
2516
- By default only returns executed orders, but that can be changed by setting *only_executed* to false.
2517
-
2518
- Every order carries a `legs` list with at least one leg; switch on `legs[].instrument.kind` and `order_type.kind` to know which fields are present. `data_freshness.as_of` is the time of this live request.
2519
-
2520
- **Experimental:** this endpoint may change without notice.
2521
-
2522
- **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
2523
-
2524
-
2525
- #### 🛠️ Usage<a id="🛠️-usage"></a>
2526
-
2527
- ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2528
-
2529
- ```typescript
2530
- const getAllAccountRecentOrdersResponse =
2531
- await commercialApiKeyClient.experimentalEndpoints.getAllAccountRecentOrders({
2532
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2533
- onlyExecuted: true,
2534
- userId: "snaptrade-user-123",
2535
- userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2536
- });
2537
- ```
2538
-
2539
- Required credentials for this mode:
2540
-
2541
- - `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.
2542
-
2543
- - `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).
2544
-
2545
- ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2546
-
2547
- ```typescript
2548
- const getAllAccountRecentOrdersResponse =
2549
- await personalApiKeyClient.experimentalEndpoints.getAllAccountRecentOrders({
2550
- accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2551
- onlyExecuted: true,
2552
- });
2553
- ```
2554
-
2555
- The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2556
-
2557
-
2558
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2559
-
2560
- ##### accountId: `string`<a id="accountid-string"></a>
2561
-
2562
- ##### onlyExecuted: `boolean`<a id="onlyexecuted-boolean"></a>
2563
-
2564
- Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
2565
-
2566
- #### 🔄 Return<a id="🔄-return"></a>
2567
-
2568
- [AllAccountOrdersResponse](./models/all-account-orders-response.ts)
2569
-
2570
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2571
-
2572
- `/accounts/{accountId}/orders/recent` `GET`
2573
-
2574
- [🔙 **Back to Table of Contents**](#table-of-contents)
2575
-
2576
- ---
2577
-
2578
-
2579
2579
  ### `snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`<a id="snaptradeexperimentalendpointsgetuseraccountorderdetailv2"></a>
2580
2580
 
2581
2581
  Returns the detail of a single order using the brokerage order ID provided as a path parameter.
@@ -2890,7 +2890,7 @@ const placeSimpleOrderResponse =
2890
2890
  stop_price: "1.25",
2891
2891
  price_effect: "debit",
2892
2892
  client_order_id: "550e8400-e29b-41d4-a716-446655440000",
2893
- expiry_date: "2026-12-18T20:00:00.000Z",
2893
+ expiry_date: "2026-12-18T20:00:00Z",
2894
2894
  notional_value: "1.25",
2895
2895
  trading_session: "regular",
2896
2896
  userId: "snaptrade-user-123",
@@ -2926,7 +2926,7 @@ const placeSimpleOrderResponse =
2926
2926
  stop_price: "1.25",
2927
2927
  price_effect: "debit",
2928
2928
  client_order_id: "550e8400-e29b-41d4-a716-446655440000",
2929
- expiry_date: "2026-12-18T20:00:00.000Z",
2929
+ expiry_date: "2026-12-18T20:00:00Z",
2930
2930
  notional_value: "1.25",
2931
2931
  trading_session: "regular",
2932
2932
  });
@@ -2956,7 +2956,7 @@ const placeSimpleOrderResponse =
2956
2956
  stop_price: "1.25",
2957
2957
  price_effect: "debit",
2958
2958
  client_order_id: "550e8400-e29b-41d4-a716-446655440000",
2959
- expiry_date: "2026-12-18T20:00:00.000Z",
2959
+ expiry_date: "2026-12-18T20:00:00Z",
2960
2960
  notional_value: "1.25",
2961
2961
  trading_session: "regular",
2962
2962
  });
@@ -4250,7 +4250,7 @@ const placeCryptoOrderResponse =
4250
4250
  limit_price: "123.45",
4251
4251
  stop_price: "123.45",
4252
4252
  post_only: false,
4253
- expiration_date: "2024-01-01T00:00:00.000Z",
4253
+ expiration_date: "2024-01-01T00:00:00Z",
4254
4254
  userId: "snaptrade-user-123",
4255
4255
  userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
4256
4256
  });
@@ -4279,7 +4279,7 @@ const placeCryptoOrderResponse =
4279
4279
  limit_price: "123.45",
4280
4280
  stop_price: "123.45",
4281
4281
  post_only: false,
4282
- expiration_date: "2024-01-01T00:00:00.000Z",
4282
+ expiration_date: "2024-01-01T00:00:00Z",
4283
4283
  });
4284
4284
  ```
4285
4285
 
@@ -4301,7 +4301,7 @@ const placeCryptoOrderResponse = await oauthClient.trading.placeCryptoOrder({
4301
4301
  limit_price: "123.45",
4302
4302
  stop_price: "123.45",
4303
4303
  post_only: false,
4304
- expiration_date: "2024-01-01T00:00:00.000Z",
4304
+ expiration_date: "2024-01-01T00:00:00Z",
4305
4305
  });
4306
4306
  ```
4307
4307
 
@@ -4734,7 +4734,7 @@ const previewCryptoOrderResponse =
4734
4734
  limit_price: "123.45",
4735
4735
  stop_price: "123.45",
4736
4736
  post_only: false,
4737
- expiration_date: "2024-01-01T00:00:00.000Z",
4737
+ expiration_date: "2024-01-01T00:00:00Z",
4738
4738
  userId: "snaptrade-user-123",
4739
4739
  userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
4740
4740
  });
@@ -4763,7 +4763,7 @@ const previewCryptoOrderResponse =
4763
4763
  limit_price: "123.45",
4764
4764
  stop_price: "123.45",
4765
4765
  post_only: false,
4766
- expiration_date: "2024-01-01T00:00:00.000Z",
4766
+ expiration_date: "2024-01-01T00:00:00Z",
4767
4767
  });
4768
4768
  ```
4769
4769
 
@@ -4786,7 +4786,7 @@ const previewCryptoOrderResponse = await oauthClient.trading.previewCryptoOrder(
4786
4786
  limit_price: "123.45",
4787
4787
  stop_price: "123.45",
4788
4788
  post_only: false,
4789
- expiration_date: "2024-01-01T00:00:00.000Z",
4789
+ expiration_date: "2024-01-01T00:00:00Z",
4790
4790
  }
4791
4791
  );
4792
4792
  ```