snaptrade-typescript-sdk 9.0.20 → 9.0.22
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 +34 -36
- package/dist/browser.js +1 -1
- package/dist/common.js +3 -3
- package/dist/configuration.js +1 -1
- package/dist/error.d.ts +1 -1
- package/dist/error.js +3 -2
- package/dist/models/account-order-record.d.ts +3 -4
- package/dist/models/{action.d.ts → action-strict.d.ts} +1 -1
- package/dist/models/delete-user-response.d.ts +1 -1
- package/dist/models/index.d.ts +3 -1
- package/dist/models/index.js +3 -1
- package/dist/models/manual-trade-form-notional-value.d.ts +6 -0
- package/dist/models/manual-trade-form-notional-value.js +2 -0
- package/dist/models/manual-trade-form.d.ts +6 -5
- package/dist/models/manual-trade.d.ts +3 -3
- package/dist/models/notional-value.d.ts +6 -0
- package/dist/models/notional-value.js +2 -0
- package/dist/models/session-event.d.ts +2 -2
- package/dist/models/snap-trade-register-user-request-body.d.ts +1 -1
- package/dist/models/user-idand-secret.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/models/{action.js → action-strict.js} +0 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
|
8
8
|
|
|
9
|
-
[](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/9.0.22)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -188,7 +188,7 @@ the data returned over the more fine-grained **positions**, **orders** and **bal
|
|
|
188
188
|
```typescript
|
|
189
189
|
const getAllUserHoldingsResponse =
|
|
190
190
|
await snaptrade.accountInformation.getAllUserHoldings({
|
|
191
|
-
userId: "
|
|
191
|
+
userId: "snaptrade-user-123",
|
|
192
192
|
userSecret: "USERSECRET123",
|
|
193
193
|
brokerageAuthorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
194
194
|
});
|
|
@@ -226,7 +226,7 @@ A list of account balances for the specified account (one per currency that the
|
|
|
226
226
|
```typescript
|
|
227
227
|
const getUserAccountBalanceResponse =
|
|
228
228
|
await snaptrade.accountInformation.getUserAccountBalance({
|
|
229
|
-
userId: "
|
|
229
|
+
userId: "snaptrade-user-123",
|
|
230
230
|
userSecret: "USERSECRET123",
|
|
231
231
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
232
232
|
});
|
|
@@ -266,7 +266,7 @@ including the total account market value.
|
|
|
266
266
|
```typescript
|
|
267
267
|
const getUserAccountDetailsResponse =
|
|
268
268
|
await snaptrade.accountInformation.getUserAccountDetails({
|
|
269
|
-
userId: "
|
|
269
|
+
userId: "snaptrade-user-123",
|
|
270
270
|
userSecret: "USERSECRET123",
|
|
271
271
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
272
272
|
});
|
|
@@ -304,7 +304,7 @@ Fetch all recent orders from a user's account.
|
|
|
304
304
|
```typescript
|
|
305
305
|
const getUserAccountOrdersResponse =
|
|
306
306
|
await snaptrade.accountInformation.getUserAccountOrders({
|
|
307
|
-
userId: "
|
|
307
|
+
userId: "snaptrade-user-123",
|
|
308
308
|
userSecret: "USERSECRET123",
|
|
309
309
|
state: "all",
|
|
310
310
|
days: 30,
|
|
@@ -352,7 +352,7 @@ Returns a list of positions in the specified account.
|
|
|
352
352
|
```typescript
|
|
353
353
|
const getUserAccountPositionsResponse =
|
|
354
354
|
await snaptrade.accountInformation.getUserAccountPositions({
|
|
355
|
-
userId: "
|
|
355
|
+
userId: "snaptrade-user-123",
|
|
356
356
|
userSecret: "USERSECRET123",
|
|
357
357
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
358
358
|
});
|
|
@@ -394,7 +394,7 @@ data returned over the more fine-grained **positions**, **orders** and **balance
|
|
|
394
394
|
const getUserHoldingsResponse =
|
|
395
395
|
await snaptrade.accountInformation.getUserHoldings({
|
|
396
396
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
397
|
-
userId: "
|
|
397
|
+
userId: "snaptrade-user-123",
|
|
398
398
|
userSecret: "USERSECRET123",
|
|
399
399
|
});
|
|
400
400
|
```
|
|
@@ -431,7 +431,7 @@ Get a list of all Account objects for the authenticated SnapTrade user.
|
|
|
431
431
|
```typescript
|
|
432
432
|
const listUserAccountsResponse =
|
|
433
433
|
await snaptrade.accountInformation.listUserAccounts({
|
|
434
|
-
userId: "
|
|
434
|
+
userId: "snaptrade-user-123",
|
|
435
435
|
userSecret: "USERSECRET123",
|
|
436
436
|
});
|
|
437
437
|
```
|
|
@@ -464,7 +464,7 @@ Updates various properties of a specified account.
|
|
|
464
464
|
```typescript
|
|
465
465
|
const updateUserAccountResponse =
|
|
466
466
|
await snaptrade.accountInformation.updateUserAccount({
|
|
467
|
-
userId: "
|
|
467
|
+
userId: "snaptrade-user-123",
|
|
468
468
|
userSecret: "USERSECRET123",
|
|
469
469
|
accountId: "accountId_example",
|
|
470
470
|
});
|
|
@@ -525,7 +525,7 @@ Deletes a user you've registered over the SnapTrade API, and any data associated
|
|
|
525
525
|
```typescript
|
|
526
526
|
const deleteSnapTradeUserResponse =
|
|
527
527
|
await snaptrade.authentication.deleteSnapTradeUser({
|
|
528
|
-
userId: "
|
|
528
|
+
userId: "snaptrade-user-123",
|
|
529
529
|
});
|
|
530
530
|
```
|
|
531
531
|
|
|
@@ -556,7 +556,7 @@ JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
|
|
556
556
|
|
|
557
557
|
```typescript
|
|
558
558
|
const getUserJWTResponse = await snaptrade.authentication.getUserJWT({
|
|
559
|
-
userId: "
|
|
559
|
+
userId: "snaptrade-user-123",
|
|
560
560
|
userSecret: "USERSECRET123",
|
|
561
561
|
});
|
|
562
562
|
```
|
|
@@ -609,7 +609,7 @@ Logs in a SnapTrade user and returns an authenticated connection portal URL for
|
|
|
609
609
|
```typescript
|
|
610
610
|
const loginSnapTradeUserResponse =
|
|
611
611
|
await snaptrade.authentication.loginSnapTradeUser({
|
|
612
|
-
userId: "
|
|
612
|
+
userId: "snaptrade-user-123",
|
|
613
613
|
userSecret: "USERSECRET123",
|
|
614
614
|
broker: "ALPACA",
|
|
615
615
|
immediateRedirect: true,
|
|
@@ -682,7 +682,7 @@ const registerSnapTradeUserResponse =
|
|
|
682
682
|
|
|
683
683
|
##### userId: `string`<a id="userid-string"></a>
|
|
684
684
|
|
|
685
|
-
SnapTrade User ID.
|
|
685
|
+
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.
|
|
686
686
|
|
|
687
687
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
688
688
|
|
|
@@ -717,7 +717,7 @@ const resetSnapTradeUserSecretResponse =
|
|
|
717
717
|
|
|
718
718
|
##### userId: `string`<a id="userid-string"></a>
|
|
719
719
|
|
|
720
|
-
SnapTrade User ID.
|
|
720
|
+
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.
|
|
721
721
|
|
|
722
722
|
##### userSecret: `string`<a id="usersecret-string"></a>
|
|
723
723
|
|
|
@@ -746,7 +746,7 @@ Returns a single brokerage authorization object for the specified ID.
|
|
|
746
746
|
const detailBrokerageAuthorizationResponse =
|
|
747
747
|
await snaptrade.connections.detailBrokerageAuthorization({
|
|
748
748
|
authorizationId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
749
|
-
userId: "
|
|
749
|
+
userId: "snaptrade-user-123",
|
|
750
750
|
userSecret: "USERSECRET123",
|
|
751
751
|
});
|
|
752
752
|
```
|
|
@@ -783,7 +783,7 @@ Returns a list of Brokerage Authorization objects for the user
|
|
|
783
783
|
```typescript
|
|
784
784
|
const listBrokerageAuthorizationsResponse =
|
|
785
785
|
await snaptrade.connections.listBrokerageAuthorizations({
|
|
786
|
-
userId: "
|
|
786
|
+
userId: "snaptrade-user-123",
|
|
787
787
|
userSecret: "USERSECRET123",
|
|
788
788
|
});
|
|
789
789
|
```
|
|
@@ -817,7 +817,7 @@ Deletes a specified brokerage authorization given by the ID.
|
|
|
817
817
|
const removeBrokerageAuthorizationResponse =
|
|
818
818
|
await snaptrade.connections.removeBrokerageAuthorization({
|
|
819
819
|
authorizationId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
820
|
-
userId: "
|
|
820
|
+
userId: "snaptrade-user-123",
|
|
821
821
|
userSecret: "USERSECRET123",
|
|
822
822
|
});
|
|
823
823
|
```
|
|
@@ -891,7 +891,7 @@ Creates an option strategy object that will be used to place an option strategy
|
|
|
891
891
|
|
|
892
892
|
```typescript
|
|
893
893
|
const getOptionStrategyResponse = await snaptrade.options.getOptionStrategy({
|
|
894
|
-
userId: "
|
|
894
|
+
userId: "snaptrade-user-123",
|
|
895
895
|
userSecret: "USERSECRET123",
|
|
896
896
|
accountId: "accountId_example",
|
|
897
897
|
underlying_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
@@ -943,7 +943,7 @@ Returns the option chain for the specified symbol in the specified account.
|
|
|
943
943
|
|
|
944
944
|
```typescript
|
|
945
945
|
const getOptionsChainResponse = await snaptrade.options.getOptionsChain({
|
|
946
|
-
userId: "
|
|
946
|
+
userId: "snaptrade-user-123",
|
|
947
947
|
userSecret: "USERSECRET123",
|
|
948
948
|
accountId: "accountId_example",
|
|
949
949
|
symbol: "symbol_example",
|
|
@@ -987,7 +987,7 @@ Returns a Strategy Quotes object which has latest market data of the specified o
|
|
|
987
987
|
```typescript
|
|
988
988
|
const getOptionsStrategyQuoteResponse =
|
|
989
989
|
await snaptrade.options.getOptionsStrategyQuote({
|
|
990
|
-
userId: "
|
|
990
|
+
userId: "snaptrade-user-123",
|
|
991
991
|
userSecret: "USERSECRET123",
|
|
992
992
|
accountId: "accountId_example",
|
|
993
993
|
optionStrategyId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
@@ -1030,7 +1030,7 @@ Returns a list of Options Positions.
|
|
|
1030
1030
|
|
|
1031
1031
|
```typescript
|
|
1032
1032
|
const listOptionHoldingsResponse = await snaptrade.options.listOptionHoldings({
|
|
1033
|
-
userId: "
|
|
1033
|
+
userId: "snaptrade-user-123",
|
|
1034
1034
|
userSecret: "USERSECRET123",
|
|
1035
1035
|
accountId: "accountId_example",
|
|
1036
1036
|
});
|
|
@@ -1068,7 +1068,7 @@ Places the option strategy order and returns the order record received from the
|
|
|
1068
1068
|
```typescript
|
|
1069
1069
|
const placeOptionStrategyResponse = await snaptrade.options.placeOptionStrategy(
|
|
1070
1070
|
{
|
|
1071
|
-
userId: "
|
|
1071
|
+
userId: "snaptrade-user-123",
|
|
1072
1072
|
userSecret: "USERSECRET123",
|
|
1073
1073
|
accountId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
1074
1074
|
optionStrategyId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
@@ -1401,7 +1401,7 @@ provided search string, matching on ticker and name.
|
|
|
1401
1401
|
```typescript
|
|
1402
1402
|
const symbolSearchUserAccountResponse =
|
|
1403
1403
|
await snaptrade.referenceData.symbolSearchUserAccount({
|
|
1404
|
-
userId: "
|
|
1404
|
+
userId: "snaptrade-user-123",
|
|
1405
1405
|
userSecret: "USERSECRET123",
|
|
1406
1406
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1407
1407
|
substring: "apple",
|
|
@@ -1444,7 +1444,7 @@ This will only work if the order has not yet been executed.
|
|
|
1444
1444
|
```typescript
|
|
1445
1445
|
const cancelUserAccountOrderResponse =
|
|
1446
1446
|
await snaptrade.trading.cancelUserAccountOrder({
|
|
1447
|
-
userId: "
|
|
1447
|
+
userId: "snaptrade-user-123",
|
|
1448
1448
|
userSecret: "USERSECRET123",
|
|
1449
1449
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1450
1450
|
brokerage_order_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
@@ -1484,7 +1484,7 @@ Return the trade object and it's impact on the account for the specified order.
|
|
|
1484
1484
|
|
|
1485
1485
|
```typescript
|
|
1486
1486
|
const getOrderImpactResponse = await snaptrade.trading.getOrderImpact({
|
|
1487
|
-
userId: "
|
|
1487
|
+
userId: "snaptrade-user-123",
|
|
1488
1488
|
userSecret: "USERSECRET123",
|
|
1489
1489
|
account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
1490
1490
|
action: "BUY",
|
|
@@ -1493,7 +1493,6 @@ const getOrderImpactResponse = await snaptrade.trading.getOrderImpact({
|
|
|
1493
1493
|
stop: 31.33,
|
|
1494
1494
|
time_in_force: "FOK",
|
|
1495
1495
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
1496
|
-
notional_value: 100,
|
|
1497
1496
|
});
|
|
1498
1497
|
```
|
|
1499
1498
|
|
|
@@ -1505,7 +1504,7 @@ const getOrderImpactResponse = await snaptrade.trading.getOrderImpact({
|
|
|
1505
1504
|
|
|
1506
1505
|
##### account_id: `string`<a id="account_id-string"></a>
|
|
1507
1506
|
|
|
1508
|
-
##### action: [`
|
|
1507
|
+
##### action: [`ActionStrict`](./models/action-strict.ts)<a id="action-actionstrictmodelsaction-strictts"></a>
|
|
1509
1508
|
|
|
1510
1509
|
Trade Action
|
|
1511
1510
|
|
|
@@ -1529,7 +1528,7 @@ Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Goo
|
|
|
1529
1528
|
|
|
1530
1529
|
##### universal_symbol_id: `string`<a id="universal_symbol_id-string"></a>
|
|
1531
1530
|
|
|
1532
|
-
##### notional_value: [`
|
|
1531
|
+
##### notional_value: [`ManualTradeFormNotionalValue`](./models/manual-trade-form-notional-value.ts)<a id="notional_value-manualtradeformnotionalvaluemodelsmanual-trade-form-notional-valuets"></a>
|
|
1533
1532
|
|
|
1534
1533
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1535
1534
|
|
|
@@ -1553,7 +1552,7 @@ Returns live quote(s) from the brokerage for the specified symbol(s).
|
|
|
1553
1552
|
```typescript
|
|
1554
1553
|
const getUserAccountQuotesResponse =
|
|
1555
1554
|
await snaptrade.trading.getUserAccountQuotes({
|
|
1556
|
-
userId: "
|
|
1555
|
+
userId: "snaptrade-user-123",
|
|
1557
1556
|
userSecret: "USERSECRET123",
|
|
1558
1557
|
symbols: "symbols_example",
|
|
1559
1558
|
accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
@@ -1599,7 +1598,7 @@ Places a specified trade in the specified account.
|
|
|
1599
1598
|
|
|
1600
1599
|
```typescript
|
|
1601
1600
|
const placeForceOrderResponse = await snaptrade.trading.placeForceOrder({
|
|
1602
|
-
userId: "
|
|
1601
|
+
userId: "snaptrade-user-123",
|
|
1603
1602
|
userSecret: "USERSECRET123",
|
|
1604
1603
|
account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
1605
1604
|
action: "BUY",
|
|
@@ -1608,7 +1607,6 @@ const placeForceOrderResponse = await snaptrade.trading.placeForceOrder({
|
|
|
1608
1607
|
stop: 31.33,
|
|
1609
1608
|
time_in_force: "FOK",
|
|
1610
1609
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
1611
|
-
notional_value: 100,
|
|
1612
1610
|
});
|
|
1613
1611
|
```
|
|
1614
1612
|
|
|
@@ -1620,7 +1618,7 @@ const placeForceOrderResponse = await snaptrade.trading.placeForceOrder({
|
|
|
1620
1618
|
|
|
1621
1619
|
##### account_id: `string`<a id="account_id-string"></a>
|
|
1622
1620
|
|
|
1623
|
-
##### action: [`
|
|
1621
|
+
##### action: [`ActionStrict`](./models/action-strict.ts)<a id="action-actionstrictmodelsaction-strictts"></a>
|
|
1624
1622
|
|
|
1625
1623
|
Trade Action
|
|
1626
1624
|
|
|
@@ -1644,7 +1642,7 @@ Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Goo
|
|
|
1644
1642
|
|
|
1645
1643
|
##### universal_symbol_id: `string`<a id="universal_symbol_id-string"></a>
|
|
1646
1644
|
|
|
1647
|
-
##### notional_value: [`
|
|
1645
|
+
##### notional_value: [`ManualTradeFormNotionalValue`](./models/manual-trade-form-notional-value.ts)<a id="notional_value-manualtradeformnotionalvaluemodelsmanual-trade-form-notional-valuets"></a>
|
|
1648
1646
|
|
|
1649
1647
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
1650
1648
|
|
|
@@ -1670,7 +1668,7 @@ returns the status of the order from the brokerage.
|
|
|
1670
1668
|
```typescript
|
|
1671
1669
|
const placeOrderResponse = await snaptrade.trading.placeOrder({
|
|
1672
1670
|
tradeId: "tradeId_example",
|
|
1673
|
-
userId: "
|
|
1671
|
+
userId: "snaptrade-user-123",
|
|
1674
1672
|
userSecret: "USERSECRET123",
|
|
1675
1673
|
wait_to_confirm: true,
|
|
1676
1674
|
});
|
|
@@ -1719,7 +1717,7 @@ const getActivitiesResponse =
|
|
|
1719
1717
|
brokerageAuthorizations:
|
|
1720
1718
|
"917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
|
|
1721
1719
|
type: "DIVIDEND",
|
|
1722
|
-
userId: "
|
|
1720
|
+
userId: "snaptrade-user-123",
|
|
1723
1721
|
userSecret: "USERSECRET123",
|
|
1724
1722
|
});
|
|
1725
1723
|
```
|
|
@@ -1775,7 +1773,7 @@ const getReportingCustomRangeResponse =
|
|
|
1775
1773
|
"917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
|
|
1776
1774
|
detailed: true,
|
|
1777
1775
|
frequency: "monthly",
|
|
1778
|
-
userId: "
|
|
1776
|
+
userId: "snaptrade-user-123",
|
|
1779
1777
|
userSecret: "USERSECRET123",
|
|
1780
1778
|
});
|
|
1781
1779
|
```
|