snaptrade-typescript-sdk 13.1.8 → 13.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,7 +63,7 @@ backoff with jitter rather than from the headers.
63
63
  See https://docs.snaptrade.com/docs/ratelimiting.
64
64
 
65
65
 
66
- [![npm](https://img.shields.io/badge/npm-v13.1.8-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.1.8)
66
+ [![npm](https://img.shields.io/badge/npm-v13.1.10-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/13.1.10)
67
67
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
68
68
 
69
69
  </div>
@@ -110,6 +110,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
110
110
  * [`snaptrade.connections.syncBrokerageAuthorizationTransactions`](#snaptradeconnectionssyncbrokerageauthorizationtransactions)
111
111
  * [`snaptrade.experimentalEndpoints.addSubscription`](#snaptradeexperimentalendpointsaddsubscription)
112
112
  * [`snaptrade.experimentalEndpoints.cancelSubscription`](#snaptradeexperimentalendpointscancelsubscription)
113
+ * [`snaptrade.experimentalEndpoints.getAllAccountOrders`](#snaptradeexperimentalendpointsgetallaccountorders)
113
114
  * [`snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`](#snaptradeexperimentalendpointsgetuseraccountorderdetailv2)
114
115
  * [`snaptrade.experimentalEndpoints.getUserAccountOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountordersv2)
115
116
  * [`snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountrecentordersv2)
@@ -2110,6 +2111,79 @@ Unique identifier for the connected brokerage account. This is the UUID used to
2110
2111
  ---
2111
2112
 
2112
2113
 
2114
+ ### `snaptrade.experimentalEndpoints.getAllAccountOrders`<a id="snaptradeexperimentalendpointsgetallaccountorders"></a>
2115
+
2116
+ Returns a list of recent orders in the specified account, in the same `kind`-discriminated format as `/accounts/{accountId}/positions/all`.
2117
+
2118
+ 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`.
2119
+
2120
+ `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`.
2121
+
2122
+ **Experimental:** this endpoint may change without notice.
2123
+
2124
+ 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.
2125
+
2126
+
2127
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
2128
+
2129
+ ##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
2130
+
2131
+ ```typescript
2132
+ const getAllAccountOrdersResponse =
2133
+ await commercialApiKeyClient.experimentalEndpoints.getAllAccountOrders({
2134
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2135
+ state: "all",
2136
+ days: 30,
2137
+ userId: "snaptrade-user-123",
2138
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
2139
+ });
2140
+ ```
2141
+
2142
+ Required credentials for this mode:
2143
+
2144
+ - `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.
2145
+
2146
+ - `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).
2147
+
2148
+ ##### Personal API Key Auth<a id="personal-api-key-auth"></a>
2149
+
2150
+ ```typescript
2151
+ const getAllAccountOrdersResponse =
2152
+ await personalApiKeyClient.experimentalEndpoints.getAllAccountOrders({
2153
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
2154
+ state: "all",
2155
+ days: 30,
2156
+ });
2157
+ ```
2158
+
2159
+ The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
2160
+
2161
+
2162
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
2163
+
2164
+ ##### accountId: `string`<a id="accountid-string"></a>
2165
+
2166
+ ##### state: `'all' | 'open' | 'executed'`<a id="state-all--open--executed"></a>
2167
+
2168
+ defaults to \"all\"
2169
+
2170
+ ##### days: `number`<a id="days-number"></a>
2171
+
2172
+ 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.
2173
+
2174
+ #### 🔄 Return<a id="🔄-return"></a>
2175
+
2176
+ [AllAccountOrdersResponse](./models/all-account-orders-response.ts)
2177
+
2178
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
2179
+
2180
+ `/accounts/{accountId}/orders/all` `GET`
2181
+
2182
+ [🔙 **Back to Table of Contents**](#table-of-contents)
2183
+
2184
+ ---
2185
+
2186
+
2113
2187
  ### `snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`<a id="snaptradeexperimentalendpointsgetuseraccountorderdetailv2"></a>
2114
2188
 
2115
2189
  Returns the detail of a single order using the brokerage order ID provided as a path parameter.