snaptrade-typescript-sdk 12.2.16 → 12.2.18
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 +260 -1
- package/dist/browser.umd.js +1 -1
- package/dist/index.cjs +371 -5
- package/dist/index.d.cts +857 -521
- package/dist/index.d.mts +857 -521
- package/dist/index.d.ts +857 -521
- package/dist/index.mjs +371 -5
- package/package.json +1 -1
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
|
-
[](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/12.2.18)
|
|
67
67
|
[](https://snaptrade.com/)
|
|
68
68
|
|
|
69
69
|
</div>
|
|
@@ -107,10 +107,13 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
107
107
|
* [`snaptrade.connections.syncBrokerageAuthorizationTransactions`](#snaptradeconnectionssyncbrokerageauthorizationtransactions)
|
|
108
108
|
* [`snaptrade.experimentalEndpoints.addSubscription`](#snaptradeexperimentalendpointsaddsubscription)
|
|
109
109
|
* [`snaptrade.experimentalEndpoints.cancelSubscription`](#snaptradeexperimentalendpointscancelsubscription)
|
|
110
|
+
* [`snaptrade.experimentalEndpoints.getAccountDetails`](#snaptradeexperimentalendpointsgetaccountdetails)
|
|
110
111
|
* [`snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`](#snaptradeexperimentalendpointsgetuseraccountorderdetailv2)
|
|
111
112
|
* [`snaptrade.experimentalEndpoints.getUserAccountOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountordersv2)
|
|
112
113
|
* [`snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountrecentordersv2)
|
|
114
|
+
* [`snaptrade.experimentalEndpoints.listAllUserAccounts`](#snaptradeexperimentalendpointslistalluseraccounts)
|
|
113
115
|
* [`snaptrade.experimentalEndpoints.listSubscriptions`](#snaptradeexperimentalendpointslistsubscriptions)
|
|
116
|
+
* [`snaptrade.experimentalEndpoints.placeSimpleOrder`](#snaptradeexperimentalendpointsplacesimpleorder)
|
|
114
117
|
* [`snaptrade.referenceData.getPartnerInfo`](#snaptradereferencedatagetpartnerinfo)
|
|
115
118
|
* [`snaptrade.referenceData.getStockExchanges`](#snaptradereferencedatagetstockexchanges)
|
|
116
119
|
* [`snaptrade.referenceData.getSymbols`](#snaptradereferencedatagetsymbols)
|
|
@@ -393,6 +396,8 @@ Optional comma separated list of transaction types to filter by. SnapTrade does
|
|
|
393
396
|
|
|
394
397
|
An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and has a maximum lookback of 1 year. Because the data is dynamically generated, we recommend replacing your dataset with each request as opposed to combining data from multiple requests. Enable this feature for free in the [Add-on page of the Customer Dashboard](https://dashboard.snaptrade.com/add-ons)
|
|
395
398
|
|
|
399
|
+
The data may contain gaps and is best used for charting account value trends. It should not be relied on as a complete or exact record of historical account values.
|
|
400
|
+
|
|
396
401
|
|
|
397
402
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
398
403
|
|
|
@@ -1920,6 +1925,69 @@ Unique identifier for the connected brokerage account. This is the UUID used to
|
|
|
1920
1925
|
---
|
|
1921
1926
|
|
|
1922
1927
|
|
|
1928
|
+
### `snaptrade.experimentalEndpoints.getAccountDetails`<a id="snaptradeexperimentalendpointsgetaccountdetails"></a>
|
|
1929
|
+
|
|
1930
|
+
Experimental and subject to change without notice.
|
|
1931
|
+
|
|
1932
|
+
Returns the specified account for the authenticated user, using the `kind`-discriminated account shape. Use the `kind` discriminator to determine the shape of the account, which can be an investment, deposit, or line of credit account.
|
|
1933
|
+
|
|
1934
|
+
On Pay as you Go / Real-time, this endpoint refreshes the account's opening date and total net value (`net_value`) live from the institution on each call, along with funding date for `investment` accounts.
|
|
1935
|
+
|
|
1936
|
+
On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by institution. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
|
|
1937
|
+
|
|
1938
|
+
Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
|
|
1939
|
+
|
|
1940
|
+
If the connection has become disabled, it can no longer access the latest data from the institution, 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.
|
|
1941
|
+
|
|
1942
|
+
|
|
1943
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1944
|
+
|
|
1945
|
+
##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
|
|
1946
|
+
|
|
1947
|
+
```typescript
|
|
1948
|
+
const getAccountDetailsResponse =
|
|
1949
|
+
await commercialApiKeyClient.experimentalEndpoints.getAccountDetails({
|
|
1950
|
+
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1951
|
+
userId: "snaptrade-user-123",
|
|
1952
|
+
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1953
|
+
});
|
|
1954
|
+
```
|
|
1955
|
+
|
|
1956
|
+
Required credentials for this mode:
|
|
1957
|
+
|
|
1958
|
+
- `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.
|
|
1959
|
+
|
|
1960
|
+
- `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).
|
|
1961
|
+
|
|
1962
|
+
##### Personal API Key Auth<a id="personal-api-key-auth"></a>
|
|
1963
|
+
|
|
1964
|
+
```typescript
|
|
1965
|
+
const getAccountDetailsResponse =
|
|
1966
|
+
await personalApiKeyClient.experimentalEndpoints.getAccountDetails({
|
|
1967
|
+
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1968
|
+
});
|
|
1969
|
+
```
|
|
1970
|
+
|
|
1971
|
+
The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1975
|
+
|
|
1976
|
+
##### accountId: `string`<a id="accountid-string"></a>
|
|
1977
|
+
|
|
1978
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1979
|
+
|
|
1980
|
+
[ConnectionAccount](./models/connection-account.ts)
|
|
1981
|
+
|
|
1982
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1983
|
+
|
|
1984
|
+
`/accounts/{accountId}/details` `GET`
|
|
1985
|
+
|
|
1986
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1987
|
+
|
|
1988
|
+
---
|
|
1989
|
+
|
|
1990
|
+
|
|
1923
1991
|
### `snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`<a id="snaptradeexperimentalendpointsgetuseraccountorderdetailv2"></a>
|
|
1924
1992
|
|
|
1925
1993
|
Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|
|
@@ -2122,6 +2190,58 @@ Defaults to true. Indicates if request should fetch only executed orders. Set to
|
|
|
2122
2190
|
---
|
|
2123
2191
|
|
|
2124
2192
|
|
|
2193
|
+
### `snaptrade.experimentalEndpoints.listAllUserAccounts`<a id="snaptradeexperimentalendpointslistalluseraccounts"></a>
|
|
2194
|
+
|
|
2195
|
+
Experimental and subject to change without notice.
|
|
2196
|
+
|
|
2197
|
+
Returns all accounts across all connections known to SnapTrade for the authenticated user.
|
|
2198
|
+
|
|
2199
|
+
The `results` list can contain multiple account kinds in the same response, including investment, deposit, and line of credit accounts. Use the `kind` discriminator to determine the shape for each account.
|
|
2200
|
+
|
|
2201
|
+
This endpoint returns Daily data regardless of the customer's plan. Daily data is cached and refreshed once a day, which makes this endpoint fast and well-suited to listing accounts across all of a user's connections in a single call. Exact refresh timing may vary by institution. To get real-time data on Pay as you Go / Real-time, use the [list accounts for a connection endpoint](/reference/Connections/Connections_listConnectionAccounts). Customers on Pay as you Go / Daily can force a refresh with the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization).
|
|
2202
|
+
|
|
2203
|
+
|
|
2204
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
2205
|
+
|
|
2206
|
+
##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
|
|
2207
|
+
|
|
2208
|
+
```typescript
|
|
2209
|
+
const listAllUserAccountsResponse =
|
|
2210
|
+
await commercialApiKeyClient.experimentalEndpoints.listAllUserAccounts({
|
|
2211
|
+
userId: "snaptrade-user-123",
|
|
2212
|
+
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2213
|
+
});
|
|
2214
|
+
```
|
|
2215
|
+
|
|
2216
|
+
Required credentials for this mode:
|
|
2217
|
+
|
|
2218
|
+
- `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.
|
|
2219
|
+
|
|
2220
|
+
- `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).
|
|
2221
|
+
|
|
2222
|
+
##### Personal API Key Auth<a id="personal-api-key-auth"></a>
|
|
2223
|
+
|
|
2224
|
+
```typescript
|
|
2225
|
+
const listAllUserAccountsResponse =
|
|
2226
|
+
await personalApiKeyClient.experimentalEndpoints.listAllUserAccounts();
|
|
2227
|
+
```
|
|
2228
|
+
|
|
2229
|
+
The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
|
|
2230
|
+
|
|
2231
|
+
|
|
2232
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
2233
|
+
|
|
2234
|
+
[AllUserAccountsResponse](./models/all-user-accounts-response.ts)
|
|
2235
|
+
|
|
2236
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
2237
|
+
|
|
2238
|
+
`/accounts/all` `GET`
|
|
2239
|
+
|
|
2240
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
2241
|
+
|
|
2242
|
+
---
|
|
2243
|
+
|
|
2244
|
+
|
|
2125
2245
|
### `snaptrade.experimentalEndpoints.listSubscriptions`<a id="snaptradeexperimentalendpointslistsubscriptions"></a>
|
|
2126
2246
|
|
|
2127
2247
|
Returns active Trade Detection subscriptions for your Client ID. Cancelled subscriptions are not returned.
|
|
@@ -2156,6 +2276,145 @@ const listSubscriptionsResponse =
|
|
|
2156
2276
|
---
|
|
2157
2277
|
|
|
2158
2278
|
|
|
2279
|
+
### `snaptrade.experimentalEndpoints.placeSimpleOrder`<a id="snaptradeexperimentalendpointsplacesimpleorder"></a>
|
|
2280
|
+
|
|
2281
|
+
**Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase.
|
|
2282
|
+
|
|
2283
|
+
Equity and equity-option orders use the existing brokerage trading capabilities. Futures and future options are currently supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages).
|
|
2284
|
+
|
|
2285
|
+
An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders.
|
|
2286
|
+
|
|
2287
|
+
All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces.
|
|
2288
|
+
|
|
2289
|
+
A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
2293
|
+
|
|
2294
|
+
##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
|
|
2295
|
+
|
|
2296
|
+
```typescript
|
|
2297
|
+
const placeSimpleOrderResponse =
|
|
2298
|
+
await commercialApiKeyClient.experimentalEndpoints.placeSimpleOrder({
|
|
2299
|
+
order_type: "stop_limit",
|
|
2300
|
+
time_in_force: "day",
|
|
2301
|
+
legs: [
|
|
2302
|
+
{
|
|
2303
|
+
instrument: {
|
|
2304
|
+
kind: "future",
|
|
2305
|
+
symbol: "/ESZ6",
|
|
2306
|
+
},
|
|
2307
|
+
action: "buy",
|
|
2308
|
+
units: "1.25",
|
|
2309
|
+
},
|
|
2310
|
+
],
|
|
2311
|
+
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2312
|
+
limit_price: "1.25",
|
|
2313
|
+
stop_price: "1.25",
|
|
2314
|
+
price_effect: "debit",
|
|
2315
|
+
client_order_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
2316
|
+
expiry_date: "2026-12-18T20:00:00.000Z",
|
|
2317
|
+
notional_value: "1.25",
|
|
2318
|
+
trading_session: "regular",
|
|
2319
|
+
userId: "snaptrade-user-123",
|
|
2320
|
+
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
2321
|
+
});
|
|
2322
|
+
```
|
|
2323
|
+
|
|
2324
|
+
Required credentials for this mode:
|
|
2325
|
+
|
|
2326
|
+
- `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.
|
|
2327
|
+
|
|
2328
|
+
- `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).
|
|
2329
|
+
|
|
2330
|
+
##### Personal API Key Auth<a id="personal-api-key-auth"></a>
|
|
2331
|
+
|
|
2332
|
+
```typescript
|
|
2333
|
+
const placeSimpleOrderResponse =
|
|
2334
|
+
await personalApiKeyClient.experimentalEndpoints.placeSimpleOrder({
|
|
2335
|
+
order_type: "stop_limit",
|
|
2336
|
+
time_in_force: "day",
|
|
2337
|
+
legs: [
|
|
2338
|
+
{
|
|
2339
|
+
instrument: {
|
|
2340
|
+
kind: "future",
|
|
2341
|
+
symbol: "/ESZ6",
|
|
2342
|
+
},
|
|
2343
|
+
action: "buy",
|
|
2344
|
+
units: "1.25",
|
|
2345
|
+
},
|
|
2346
|
+
],
|
|
2347
|
+
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
2348
|
+
limit_price: "1.25",
|
|
2349
|
+
stop_price: "1.25",
|
|
2350
|
+
price_effect: "debit",
|
|
2351
|
+
client_order_id: "550e8400-e29b-41d4-a716-446655440000",
|
|
2352
|
+
expiry_date: "2026-12-18T20:00:00.000Z",
|
|
2353
|
+
notional_value: "1.25",
|
|
2354
|
+
trading_session: "regular",
|
|
2355
|
+
});
|
|
2356
|
+
```
|
|
2357
|
+
|
|
2358
|
+
The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
2362
|
+
|
|
2363
|
+
##### order_type: `string`<a id="order_type-string"></a>
|
|
2364
|
+
|
|
2365
|
+
##### time_in_force: `string`<a id="time_in_force-string"></a>
|
|
2366
|
+
|
|
2367
|
+
Order duration, subject to brokerage and execution-path support. gtd requires expiry_date and a non-market single-leg equity/option order. Existing single-leg option routing does not support ioc. Futures and multi-leg orders do not support gtd through this endpoint.
|
|
2368
|
+
|
|
2369
|
+
##### legs: [`SimpleTradeLeg`](./models/simple-trade-leg.ts)[]<a id="legs-simpletradelegmodelssimple-trade-legts"></a>
|
|
2370
|
+
|
|
2371
|
+
Legs of one brokerage order. Use equity/option legs or future/future_option legs, without mixing the two families. Brokerage strategy and leg-count limits apply.
|
|
2372
|
+
|
|
2373
|
+
##### accountId: `string`<a id="accountid-string"></a>
|
|
2374
|
+
|
|
2375
|
+
The ID of the account to execute the trade on.
|
|
2376
|
+
|
|
2377
|
+
##### limit_price: [`string`](./models/model-string.ts)<a id="limit_price-stringmodelsmodel-stringts"></a>
|
|
2378
|
+
|
|
2379
|
+
Required for limit and stop_limit orders, except that multi-leg price_effect even implies zero. Must be omitted or null for market and stop orders. For multi-leg orders this is the net strategy price. Negative prices are accepted only for futures-family orders, subject to brokerage support.
|
|
2380
|
+
|
|
2381
|
+
##### stop_price: [`string`](./models/model-string.ts)<a id="stop_price-stringmodelsmodel-stringts"></a>
|
|
2382
|
+
|
|
2383
|
+
Required for stop and stop_limit orders. Must be omitted or null for market and limit orders. Must be positive for equity/option orders; futures-family trigger prices are subject to brokerage support.
|
|
2384
|
+
|
|
2385
|
+
##### price_effect: `string`<a id="price_effect-string"></a>
|
|
2386
|
+
|
|
2387
|
+
Only applicable to multi-leg limit and stop_limit orders. Requirements and supported values depend on the brokerage; tastytrade requires credit or debit. even implies a zero limit_price, which may be omitted and must be zero if supplied. Single-leg price effects are derived from the action.
|
|
2388
|
+
|
|
2389
|
+
##### client_order_id: [`string`](./models/model-string.ts)<a id="client_order_id-stringmodelsmodel-stringts"></a>
|
|
2390
|
+
|
|
2391
|
+
Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade futures orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies; SnapTrade does not enforce uniqueness. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions.
|
|
2392
|
+
|
|
2393
|
+
##### expiry_date: `string`<a id="expiry_date-string"></a>
|
|
2394
|
+
|
|
2395
|
+
ISO 8601 expiry timestamp, required for gtd and invalid with other durations. A missing timezone is treated as UTC. Supported only through existing single-leg Public and Sandbox execution paths.
|
|
2396
|
+
|
|
2397
|
+
##### notional_value: [`string`](./models/model-string.ts)<a id="notional_value-stringmodelsmodel-stringts"></a>
|
|
2398
|
+
|
|
2399
|
+
Positive order value, supported only for a single-equity market order on eligible brokerages and partners. Mutually exclusive with leg units. Omit or set units to null when supplied.
|
|
2400
|
+
|
|
2401
|
+
##### trading_session: `string`<a id="trading_session-string"></a>
|
|
2402
|
+
|
|
2403
|
+
extended uses existing single-leg equity/option brokerage support and requires extended-hours enablement. Futures and multi-leg orders only accept regular.
|
|
2404
|
+
|
|
2405
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
2406
|
+
|
|
2407
|
+
[SimpleTradeResponse](./models/simple-trade-response.ts)
|
|
2408
|
+
|
|
2409
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
2410
|
+
|
|
2411
|
+
`/accounts/{accountId}/trading/simple` `POST`
|
|
2412
|
+
|
|
2413
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
2414
|
+
|
|
2415
|
+
---
|
|
2416
|
+
|
|
2417
|
+
|
|
2159
2418
|
### `snaptrade.referenceData.getPartnerInfo`<a id="snaptradereferencedatagetpartnerinfo"></a>
|
|
2160
2419
|
|
|
2161
2420
|
Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
|