@barchart/portfolio-client-js 10.4.0 → 10.5.0
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/lib/gateway/PortfolioGateway.js +27 -5
- package/lib/index.js +1 -1
- package/package.json +8 -1
|
@@ -631,6 +631,9 @@ module.exports = (() => {
|
|
|
631
631
|
.withLiteralParameter('accounts', 'accounts')
|
|
632
632
|
.withVariableParameter('account', 'account', 'account', false);
|
|
633
633
|
})
|
|
634
|
+
.withQueryBuilder((qb) => {
|
|
635
|
+
qb.withVariableParameter('openOnly', 'openOnly', 'openOnly', true);
|
|
636
|
+
})
|
|
634
637
|
.withRequestInterceptor(requestInterceptor)
|
|
635
638
|
.withResponseInterceptor(responseInterceptorForSnapTradeAccountLinkResponse)
|
|
636
639
|
.withErrorInterceptor(errorInterceptor)
|
|
@@ -670,6 +673,9 @@ module.exports = (() => {
|
|
|
670
673
|
.withLiteralParameter('accounts', 'accounts')
|
|
671
674
|
.withVariableParameter('account', 'account', 'account', false);
|
|
672
675
|
})
|
|
676
|
+
.withQueryBuilder((qb) => {
|
|
677
|
+
qb.withVariableParameter('openOnly', 'openOnly', 'openOnly', true);
|
|
678
|
+
})
|
|
673
679
|
.withRequestInterceptor(requestInterceptor)
|
|
674
680
|
.withResponseInterceptor(responseInterceptorForSnapTradeAccountLinkResponse)
|
|
675
681
|
.withErrorInterceptor(errorInterceptor)
|
|
@@ -762,7 +768,7 @@ module.exports = (() => {
|
|
|
762
768
|
* @public
|
|
763
769
|
* @async
|
|
764
770
|
* @param {String} symbol - The instrument symbol.
|
|
765
|
-
* @param {Day
|
|
771
|
+
* @param {Day} day - The date the closing price is requested.
|
|
766
772
|
* @returns {Promise<Object>}
|
|
767
773
|
*/
|
|
768
774
|
async readInstrumentClosing(symbol, day) {
|
|
@@ -1548,15 +1554,23 @@ module.exports = (() => {
|
|
|
1548
1554
|
* @async
|
|
1549
1555
|
* @param {String} connection - The SnapTrade identifier for the brokerage connection.
|
|
1550
1556
|
* @param {String} account - The SnapTrade identifier for the brokerage account.
|
|
1557
|
+
* @param {Boolean=} openOnly - When true, links only open positions. When false, links all positions.
|
|
1551
1558
|
* @returns {Promise<Schema.SnapTradeLinkingReport>}
|
|
1552
1559
|
*/
|
|
1553
|
-
async linkSnapTradeAccount(connection, account) {
|
|
1560
|
+
async linkSnapTradeAccount(connection, account, openOnly) {
|
|
1554
1561
|
checkStart.call(this);
|
|
1555
1562
|
|
|
1556
1563
|
assert.argumentIsRequired(connection, 'connection', String);
|
|
1557
1564
|
assert.argumentIsRequired(account, 'account', String);
|
|
1565
|
+
assert.argumentIsOptional(openOnly, 'openOnly', Boolean);
|
|
1566
|
+
|
|
1567
|
+
const payload = { connection, account };
|
|
1558
1568
|
|
|
1559
|
-
|
|
1569
|
+
if (is.boolean(openOnly)) {
|
|
1570
|
+
payload.openOnly = openOnly;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
return Gateway.invoke(this._linkSnapTradeAccountEndpoint, payload);
|
|
1560
1574
|
}
|
|
1561
1575
|
|
|
1562
1576
|
/**
|
|
@@ -1582,15 +1596,23 @@ module.exports = (() => {
|
|
|
1582
1596
|
* @async
|
|
1583
1597
|
* @param {String} connection - The SnapTrade identifier for the brokerage connection.
|
|
1584
1598
|
* @param {String} account - The SnapTrade identifier for the brokerage account.
|
|
1599
|
+
* @param {Boolean=} openOnly - When true, refreshes only open positions. When false, refreshes all positions.
|
|
1585
1600
|
* @returns {Promise<Schema.SnapTradeLinkingReport>}
|
|
1586
1601
|
*/
|
|
1587
|
-
async refreshSnapTradeAccount(connection, account) {
|
|
1602
|
+
async refreshSnapTradeAccount(connection, account, openOnly) {
|
|
1588
1603
|
checkStart.call(this);
|
|
1589
1604
|
|
|
1590
1605
|
assert.argumentIsRequired(connection, 'connection', String);
|
|
1591
1606
|
assert.argumentIsRequired(account, 'account', String);
|
|
1607
|
+
assert.argumentIsOptional(openOnly, 'openOnly', Boolean);
|
|
1608
|
+
|
|
1609
|
+
const payload = { connection, account };
|
|
1610
|
+
|
|
1611
|
+
if (is.boolean(openOnly)) {
|
|
1612
|
+
payload.openOnly = openOnly;
|
|
1613
|
+
}
|
|
1592
1614
|
|
|
1593
|
-
return Gateway.invoke(this._refreshSnapTradeAccountEndpoint,
|
|
1615
|
+
return Gateway.invoke(this._refreshSnapTradeAccountEndpoint, payload);
|
|
1594
1616
|
}
|
|
1595
1617
|
|
|
1596
1618
|
/**
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barchart/portfolio-client-js",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.0",
|
|
4
4
|
"description": "JavaScript SDK for Barchart's Portfolio Service",
|
|
5
5
|
"homepage": "https://docs.barchart.com/portfolio/#/",
|
|
6
6
|
"author": {
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
"email": "bryan.ingle@barchart.com",
|
|
9
9
|
"url": "https://www.barchart.com"
|
|
10
10
|
},
|
|
11
|
+
"contributors": [
|
|
12
|
+
{
|
|
13
|
+
"name": "Luka Sotra",
|
|
14
|
+
"email": "luka.sotra@barchart.com",
|
|
15
|
+
"url": "https://www.barchart.com"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
11
18
|
"scripts": {
|
|
12
19
|
"test": "echo \"Error: Please use gulp to run tests\" && exit 1"
|
|
13
20
|
},
|