snaptrade-typescript-sdk 13.2.1 → 13.2.3

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.1-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.2.1)
66
+ [![npm](https://img.shields.io/badge/npm-v13.2.3-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.2.3)
67
67
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
68
68
 
69
69
  </div>
@@ -112,6 +112,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
112
112
  * [`snaptrade.experimentalEndpoints.addSubscription`](#snaptradeexperimentalendpointsaddsubscription)
113
113
  * [`snaptrade.experimentalEndpoints.cancelSubscription`](#snaptradeexperimentalendpointscancelsubscription)
114
114
  * [`snaptrade.experimentalEndpoints.getAllAccountOrders`](#snaptradeexperimentalendpointsgetallaccountorders)
115
+ * [`snaptrade.experimentalEndpoints.getAllAccountRecentOrders`](#snaptradeexperimentalendpointsgetallaccountrecentorders)
115
116
  * [`snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`](#snaptradeexperimentalendpointsgetuseraccountorderdetailv2)
116
117
  * [`snaptrade.experimentalEndpoints.getUserAccountOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountordersv2)
117
118
  * [`snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountrecentordersv2)
@@ -632,11 +633,11 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
632
633
 
633
634
  Returns a list of all positions in the specified account.
634
635
 
635
- The `results` list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
636
+ The `results` list can contain multiple instrument types in the same response, including stocks, preferred stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset positions. Use the `instrument.kind` discriminator to determine the schema for each position's `instrument`.
636
637
 
637
638
  **Beta:** future option positions (`instrument.kind: future_option`) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The `FutureOptionInstrument` schema may change.
638
639
 
639
- Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages).
640
+ Positions counted in account cash balance or buying power include `cash_equivalent: true`. Security positions (`stock`, `preferred_stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages).
640
641
 
641
642
  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.
642
643
 
@@ -2441,6 +2442,74 @@ Number of days in the past to fetch the most recent orders. Defaults to the last
2441
2442
  ---
2442
2443
 
2443
2444
 
2445
+ ### `snaptrade.experimentalEndpoints.getAllAccountRecentOrders`<a id="snaptradeexperimentalendpointsgetallaccountrecentorders"></a>
2446
+
2447
+ 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.
2448
+ 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.
2449
+ 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.
2450
+ By default only returns executed orders, but that can be changed by setting *only_executed* to false.
2451
+
2452
+ 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.
2453
+
2454
+ **Experimental:** this endpoint may change without notice.
2455
+
2456
+ **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)**
2457
+
2458
+
2459
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
2460
+
2461
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2462
+
2463
+ ```typescript
2464
+ const getAllAccountRecentOrdersResponse =
2465
+ await commercialApiKeyClient.experimentalEndpoints.getAllAccountRecentOrders({
2466
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2467
+ onlyExecuted: true,
2468
+ userId: "snaptrade-user-123",
2469
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2470
+ });
2471
+ ```
2472
+
2473
+ Required credentials for this mode:
2474
+
2475
+ - `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.
2476
+
2477
+ - `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).
2478
+
2479
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2480
+
2481
+ ```typescript
2482
+ const getAllAccountRecentOrdersResponse =
2483
+ await personalApiKeyClient.experimentalEndpoints.getAllAccountRecentOrders({
2484
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2485
+ onlyExecuted: true,
2486
+ });
2487
+ ```
2488
+
2489
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2490
+
2491
+
2492
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2493
+
2494
+ ##### accountId: `string`<a id="accountid-string"></a>
2495
+
2496
+ ##### onlyExecuted: `boolean`<a id="onlyexecuted-boolean"></a>
2497
+
2498
+ Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
2499
+
2500
+ #### 🔄 Return<a id="🔄-return"></a>
2501
+
2502
+ [AllAccountOrdersResponse](./models/all-account-orders-response.ts)
2503
+
2504
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2505
+
2506
+ `/accounts/{accountId}/orders/recent` `GET`
2507
+
2508
+ [🔙 **Back to Table of Contents**](#table-of-contents)
2509
+
2510
+ ---
2511
+
2512
+
2444
2513
  ### `snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`<a id="snaptradeexperimentalendpointsgetuseraccountorderdetailv2"></a>
2445
2514
 
2446
2515
  Returns the detail of a single order using the brokerage order ID provided as a path parameter.