snaptrade-typescript-sdk 13.1.2 → 13.1.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 +65 -1
- package/dist/browser.umd.js +1 -1
- package/dist/index.cjs +118 -1
- package/dist/index.d.cts +263 -1
- package/dist/index.d.mts +263 -1
- package/dist/index.d.ts +263 -1
- package/dist/index.mjs +118 -1
- 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/13.1.3)
|
|
67
67
|
[](https://snaptrade.com/)
|
|
68
68
|
|
|
69
69
|
</div>
|
|
@@ -80,6 +80,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
|
|
|
80
80
|
- [Reference](#reference)
|
|
81
81
|
* [`snaptrade.accountInformation.getAccountActivities`](#snaptradeaccountinformationgetaccountactivities)
|
|
82
82
|
* [`snaptrade.accountInformation.getAccountBalanceHistory`](#snaptradeaccountinformationgetaccountbalancehistory)
|
|
83
|
+
* [`snaptrade.accountInformation.getAccountBalancesV2`](#snaptradeaccountinformationgetaccountbalancesv2)
|
|
83
84
|
* [`snaptrade.accountInformation.getAccountDetails`](#snaptradeaccountinformationgetaccountdetails)
|
|
84
85
|
* [`snaptrade.accountInformation.getAllAccountPositions`](#snaptradeaccountinformationgetallaccountpositions)
|
|
85
86
|
* [`snaptrade.accountInformation.getUserAccountBalance`](#snaptradeaccountinformationgetuseraccountbalance)
|
|
@@ -448,6 +449,69 @@ The client identifies the user in this mode. Do not pass `userId` `userSecret` t
|
|
|
448
449
|
---
|
|
449
450
|
|
|
450
451
|
|
|
452
|
+
### `snaptrade.accountInformation.getAccountBalancesV2`<a id="snaptradeaccountinformationgetaccountbalancesv2"></a>
|
|
453
|
+
|
|
454
|
+
Returns the account's balances in a single snapshot: total net value, cash per currency, buying power, and margin details for margin accounts. Every field is always present and is `null` when the institution doesn't report it.
|
|
455
|
+
|
|
456
|
+
**Beta:** this endpoint is only available for partners it has been enabled for. Please contact the SnapTrade team to enable it. The response schema may change.
|
|
457
|
+
|
|
458
|
+
Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
|
|
459
|
+
- If you do, this endpoint returns real-time data.
|
|
460
|
+
- If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by institution. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
461
|
+
|
|
462
|
+
`data_freshness.as_of` is the time the returned data was fetched from the institution.
|
|
463
|
+
|
|
464
|
+
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.
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
468
|
+
|
|
469
|
+
##### Commercial API Key Auth<a id="commercial-api-key-auth"></a>
|
|
470
|
+
|
|
471
|
+
```typescript
|
|
472
|
+
const getAccountBalancesV2Response =
|
|
473
|
+
await commercialApiKeyClient.accountInformation.getAccountBalancesV2({
|
|
474
|
+
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
475
|
+
userId: "snaptrade-user-123",
|
|
476
|
+
userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
477
|
+
});
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Required credentials for this mode:
|
|
481
|
+
|
|
482
|
+
- `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.
|
|
483
|
+
|
|
484
|
+
- `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).
|
|
485
|
+
|
|
486
|
+
##### Personal API Key Auth<a id="personal-api-key-auth"></a>
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
const getAccountBalancesV2Response =
|
|
490
|
+
await personalApiKeyClient.accountInformation.getAccountBalancesV2({
|
|
491
|
+
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
492
|
+
});
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
The client identifies the user in this mode. Do not pass `userId` `userSecret` to this method.
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
499
|
+
|
|
500
|
+
##### accountId: `string`<a id="accountid-string"></a>
|
|
501
|
+
|
|
502
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
503
|
+
|
|
504
|
+
[AccountBalancesV2Response](./models/account-balances-v2-response.ts)
|
|
505
|
+
|
|
506
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
507
|
+
|
|
508
|
+
`/accounts/{accountId}/balances/v2` `GET`
|
|
509
|
+
|
|
510
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
|
|
451
515
|
### `snaptrade.accountInformation.getAccountDetails`<a id="snaptradeaccountinformationgetaccountdetails"></a>
|
|
452
516
|
|
|
453
517
|
Returns the specified account for the authenticated user. The account can be an investment, deposit, or line of credit account. Use the `kind` discriminator to determine the schema for the account.
|