snaptrade-typescript-sdk 10.0.1 → 10.0.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
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect brokerage accounts to your app for live positions and trading
8
8
 
9
- [![npm](https://img.shields.io/badge/npm-v10.0.1-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/10.0.1)
9
+ [![npm](https://img.shields.io/badge/npm-v10.0.3-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/10.0.3)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -48,6 +48,12 @@ Connect brokerage accounts to your app for live positions and trading
48
48
  * [`snaptrade.connections.returnRates`](#snaptradeconnectionsreturnrates)
49
49
  * [`snaptrade.connections.sessionEvents`](#snaptradeconnectionssessionevents)
50
50
  * [`snaptrade.connections.syncBrokerageAuthorizationTransactions`](#snaptradeconnectionssyncbrokerageauthorizationtransactions)
51
+ * [`snaptrade.experimentalEndpoints.addSubscription`](#snaptradeexperimentalendpointsaddsubscription)
52
+ * [`snaptrade.experimentalEndpoints.cancelSubscription`](#snaptradeexperimentalendpointscancelsubscription)
53
+ * [`snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`](#snaptradeexperimentalendpointsgetuseraccountorderdetailv2)
54
+ * [`snaptrade.experimentalEndpoints.getUserAccountOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountordersv2)
55
+ * [`snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountrecentordersv2)
56
+ * [`snaptrade.experimentalEndpoints.listSubscriptions`](#snaptradeexperimentalendpointslistsubscriptions)
51
57
  * [`snaptrade.options.listOptionHoldings`](#snaptradeoptionslistoptionholdings)
52
58
  * [`snaptrade.referenceData.getCurrencyExchangeRatePair`](#snaptradereferencedatagetcurrencyexchangeratepair)
53
59
  * [`snaptrade.referenceData.getPartnerInfo`](#snaptradereferencedatagetpartnerinfo)
@@ -588,10 +594,11 @@ Number of days in the past to fetch the most recent orders. Defaults to the last
588
594
 
589
595
 
590
596
  ### `snaptrade.accountInformation.getUserAccountPositions`<a id="snaptradeaccountinformationgetuseraccountpositions"></a>
597
+ ![Deprecated](https://img.shields.io/badge/deprecated-yellow)
591
598
 
592
599
  Returns a list of stock/ETF/crypto/mutual fund positions in the specified account. For option positions, please use the [options endpoint](/reference/Options/Options_listOptionHoldings).
593
600
 
594
- Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
601
+ This endpoint is deprecated. Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
595
602
 
596
603
  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:
597
604
  - If you do, this endpoint returns real-time data.
@@ -1259,7 +1266,7 @@ Trigger a holdings update for all accounts under this connection. Updates will b
1259
1266
  This endpoint will also trigger a transaction sync for the past day if one has not yet occurred.
1260
1267
 
1261
1268
  **Because of the cost of refreshing a connection, 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)**
1262
- **Please note this endpoint is disabled for Pay as you Go / Real-time plans. Pay as you Go / Real-time plans do not benefit from this feature since data is refreshed when calls are made**
1269
+ **Please note this endpoint is disabled for Personal and Pay as you Go Real-time plans. Real-time plans do not benefit from this feature since data is refreshed when calls are made**
1263
1270
 
1264
1271
 
1265
1272
  #### 🛠️ Usage<a id="🛠️-usage"></a>
@@ -1445,11 +1452,253 @@ const syncBrokerageAuthorizationTransactionsResponse =
1445
1452
  ---
1446
1453
 
1447
1454
 
1455
+ ### `snaptrade.experimentalEndpoints.addSubscription`<a id="snaptradeexperimentalendpointsaddsubscription"></a>
1456
+
1457
+ Adds or restores a Trade Detection subscription for a connected brokerage account.
1458
+ This endpoint requires `userId` and `userSecret` in addition to the partner signature.
1459
+
1460
+
1461
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1462
+
1463
+ ```typescript
1464
+ const addSubscriptionResponse =
1465
+ await snaptrade.experimentalEndpoints.addSubscription({
1466
+ userId: "snaptrade-user-123",
1467
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1468
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1469
+ });
1470
+ ```
1471
+
1472
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1473
+
1474
+ ##### account_id: `string`<a id="account_id-string"></a>
1475
+
1476
+ Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
1477
+
1478
+ ##### userId: `string`<a id="userid-string"></a>
1479
+
1480
+ ##### userSecret: `string`<a id="usersecret-string"></a>
1481
+
1482
+ #### 🔄 Return<a id="🔄-return"></a>
1483
+
1484
+ [TradeDetectionSubscription](./models/trade-detection-subscription.ts)
1485
+
1486
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1487
+
1488
+ `/snapTrade/tradeDetection/subscriptions` `POST`
1489
+
1490
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1491
+
1492
+ ---
1493
+
1494
+
1495
+ ### `snaptrade.experimentalEndpoints.cancelSubscription`<a id="snaptradeexperimentalendpointscancelsubscription"></a>
1496
+
1497
+ Cancels a Trade Detection subscription for a connected brokerage account.
1498
+ This endpoint requires partner signature authentication only and does not require `userId` or `userSecret`.
1499
+
1500
+
1501
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1502
+
1503
+ ```typescript
1504
+ const cancelSubscriptionResponse =
1505
+ await snaptrade.experimentalEndpoints.cancelSubscription({
1506
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1507
+ });
1508
+ ```
1509
+
1510
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1511
+
1512
+ ##### account_id: `string`<a id="account_id-string"></a>
1513
+
1514
+ Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
1515
+
1516
+ #### 🔄 Return<a id="🔄-return"></a>
1517
+
1518
+ [TradeDetectionCancelSubscriptionResponse](./models/trade-detection-cancel-subscription-response.ts)
1519
+
1520
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1521
+
1522
+ `/snapTrade/tradeDetection/subscriptions/cancel` `POST`
1523
+
1524
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1525
+
1526
+ ---
1527
+
1528
+
1529
+ ### `snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`<a id="snaptradeexperimentalendpointsgetuseraccountorderdetailv2"></a>
1530
+
1531
+ Returns the detail of a single order using the brokerage order ID provided as a path parameter.
1532
+
1533
+ The V2 order response format includes all legs of the order in the `legs` list field.
1534
+ If the order is single legged, `legs` will be a list of one leg.
1535
+
1536
+ This endpoint is always realtime and does not rely on cached data.
1537
+
1538
+ This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
1539
+
1540
+
1541
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1542
+
1543
+ ```typescript
1544
+ const getUserAccountOrderDetailV2Response =
1545
+ await snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2({
1546
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1547
+ brokerageOrderId: "66a033fa-da74-4fcf-b527-feefdec9257e",
1548
+ userId: "snaptrade-user-123",
1549
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1550
+ });
1551
+ ```
1552
+
1553
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1554
+
1555
+ ##### accountId: `string`<a id="accountid-string"></a>
1556
+
1557
+ ##### brokerageOrderId: `string`<a id="brokerageorderid-string"></a>
1558
+
1559
+ ##### userId: `string`<a id="userid-string"></a>
1560
+
1561
+ ##### userSecret: `string`<a id="usersecret-string"></a>
1562
+
1563
+ #### 🔄 Return<a id="🔄-return"></a>
1564
+
1565
+ [AccountOrderRecordV2](./models/account-order-record-v2.ts)
1566
+
1567
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1568
+
1569
+ `/accounts/{accountId}/orders/details/v2/{brokerageOrderId}` `GET`
1570
+
1571
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1572
+
1573
+ ---
1574
+
1575
+
1576
+ ### `snaptrade.experimentalEndpoints.getUserAccountOrdersV2`<a id="snaptradeexperimentalendpointsgetuseraccountordersv2"></a>
1577
+
1578
+ Returns a list of recent orders in the specified account.
1579
+
1580
+ The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg.
1581
+
1582
+ 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.
1583
+
1584
+
1585
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1586
+
1587
+ ```typescript
1588
+ const getUserAccountOrdersV2Response =
1589
+ await snaptrade.experimentalEndpoints.getUserAccountOrdersV2({
1590
+ userId: "snaptrade-user-123",
1591
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1592
+ state: "all",
1593
+ days: 30,
1594
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1595
+ });
1596
+ ```
1597
+
1598
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1599
+
1600
+ ##### userId: `string`<a id="userid-string"></a>
1601
+
1602
+ ##### userSecret: `string`<a id="usersecret-string"></a>
1603
+
1604
+ ##### accountId: `string`<a id="accountid-string"></a>
1605
+
1606
+ ##### state: `'all' | 'open' | 'executed'`<a id="state-all--open--executed"></a>
1607
+
1608
+ defaults to \"all\"
1609
+
1610
+ ##### days: `number`<a id="days-number"></a>
1611
+
1612
+ 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.
1613
+
1614
+ #### 🔄 Return<a id="🔄-return"></a>
1615
+
1616
+ [AccountOrdersV2Response](./models/account-orders-v2-response.ts)
1617
+
1618
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1619
+
1620
+ `/accounts/{accountId}/orders/v2` `GET`
1621
+
1622
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1623
+
1624
+ ---
1625
+
1626
+
1627
+ ### `snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`<a id="snaptradeexperimentalendpointsgetuseraccountrecentordersv2"></a>
1628
+
1629
+ A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format.
1630
+ 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.
1631
+ Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days.
1632
+ By default only returns executed orders, but that can be changed by setting *only_executed* to false.
1633
+ **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)**
1634
+
1635
+
1636
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1637
+
1638
+ ```typescript
1639
+ const getUserAccountRecentOrdersV2Response =
1640
+ await snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2({
1641
+ userId: "snaptrade-user-123",
1642
+ userSecret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1643
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1644
+ });
1645
+ ```
1646
+
1647
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1648
+
1649
+ ##### userId: `string`<a id="userid-string"></a>
1650
+
1651
+ ##### userSecret: `string`<a id="usersecret-string"></a>
1652
+
1653
+ ##### accountId: `string`<a id="accountid-string"></a>
1654
+
1655
+ ##### onlyExecuted: `boolean`<a id="onlyexecuted-boolean"></a>
1656
+
1657
+ Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
1658
+
1659
+ #### 🔄 Return<a id="🔄-return"></a>
1660
+
1661
+ [AccountOrdersV2Response](./models/account-orders-v2-response.ts)
1662
+
1663
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1664
+
1665
+ `/accounts/{accountId}/recentOrders/v2` `GET`
1666
+
1667
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1668
+
1669
+ ---
1670
+
1671
+
1672
+ ### `snaptrade.experimentalEndpoints.listSubscriptions`<a id="snaptradeexperimentalendpointslistsubscriptions"></a>
1673
+
1674
+ Returns active Trade Detection subscriptions for your Client ID. Cancelled subscriptions are not returned.
1675
+
1676
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1677
+
1678
+ ```typescript
1679
+ const listSubscriptionsResponse =
1680
+ await snaptrade.experimentalEndpoints.listSubscriptions();
1681
+ ```
1682
+
1683
+ #### 🔄 Return<a id="🔄-return"></a>
1684
+
1685
+ [TradeDetectionSubscription](./models/trade-detection-subscription.ts)
1686
+
1687
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1688
+
1689
+ `/snapTrade/tradeDetection/subscriptions` `GET`
1690
+
1691
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1692
+
1693
+ ---
1694
+
1695
+
1448
1696
  ### `snaptrade.options.listOptionHoldings`<a id="snaptradeoptionslistoptionholdings"></a>
1697
+ ![Deprecated](https://img.shields.io/badge/deprecated-yellow)
1449
1698
 
1450
1699
  Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
1451
1700
 
1452
- Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
1701
+ This endpoint is deprecatd. Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
1453
1702
 
1454
1703
  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:
1455
1704
  - If you do, this endpoint returns real-time data.