@barchart/portfolio-client-js 10.4.0 → 10.5.1

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.
@@ -17,6 +17,7 @@ const BrokerageReportAvailabilitySchema = require('@barchart/portfolio-api-commo
17
17
  TransactionSchema = require('@barchart/portfolio-api-common/lib/serialization/TransactionSchema');
18
18
 
19
19
  const PositionSummaryFrame = require('@barchart/portfolio-api-common/lib/data/PositionSummaryFrame'),
20
+ SnapTradeLinkMode = require('@barchart/portfolio-api-common/lib/data/SnapTradeLinkMode'),
20
21
  SnapTradeLinkStatus = require('@barchart/portfolio-api-common/lib/data/SnapTradeLinkStatus');
21
22
 
22
23
  const EndpointBuilder = require('@barchart/common-js/api/http/builders/EndpointBuilder'),
@@ -631,6 +632,9 @@ module.exports = (() => {
631
632
  .withLiteralParameter('accounts', 'accounts')
632
633
  .withVariableParameter('account', 'account', 'account', false);
633
634
  })
635
+ .withQueryBuilder((qb) => {
636
+ qb.withVariableParameter('mode', 'mode', 'mode', true, mode => mode.code);
637
+ })
634
638
  .withRequestInterceptor(requestInterceptor)
635
639
  .withResponseInterceptor(responseInterceptorForSnapTradeAccountLinkResponse)
636
640
  .withErrorInterceptor(errorInterceptor)
@@ -670,6 +674,9 @@ module.exports = (() => {
670
674
  .withLiteralParameter('accounts', 'accounts')
671
675
  .withVariableParameter('account', 'account', 'account', false);
672
676
  })
677
+ .withQueryBuilder((qb) => {
678
+ qb.withVariableParameter('mode', 'mode', 'mode', true, mode => mode.code);
679
+ })
673
680
  .withRequestInterceptor(requestInterceptor)
674
681
  .withResponseInterceptor(responseInterceptorForSnapTradeAccountLinkResponse)
675
682
  .withErrorInterceptor(errorInterceptor)
@@ -762,7 +769,7 @@ module.exports = (() => {
762
769
  * @public
763
770
  * @async
764
771
  * @param {String} symbol - The instrument symbol.
765
- * @param {Day=} day - The date the closing price is requested.
772
+ * @param {Day} day - The date the closing price is requested.
766
773
  * @returns {Promise<Object>}
767
774
  */
768
775
  async readInstrumentClosing(symbol, day) {
@@ -1548,15 +1555,23 @@ module.exports = (() => {
1548
1555
  * @async
1549
1556
  * @param {String} connection - The SnapTrade identifier for the brokerage connection.
1550
1557
  * @param {String} account - The SnapTrade identifier for the brokerage account.
1558
+ * @param {SnapTradeLinkMode=} mode - The strategy used when importing positions into the linked portfolio.
1551
1559
  * @returns {Promise<Schema.SnapTradeLinkingReport>}
1552
1560
  */
1553
- async linkSnapTradeAccount(connection, account) {
1561
+ async linkSnapTradeAccount(connection, account, mode) {
1554
1562
  checkStart.call(this);
1555
1563
 
1556
1564
  assert.argumentIsRequired(connection, 'connection', String);
1557
1565
  assert.argumentIsRequired(account, 'account', String);
1566
+ assert.argumentIsOptional(mode, 'mode', SnapTradeLinkMode, 'SnapTradeLinkMode');
1567
+
1568
+ const payload = { connection, account };
1558
1569
 
1559
- return Gateway.invoke(this._linkSnapTradeAccountEndpoint, { connection, account });
1570
+ if (mode) {
1571
+ payload.mode = mode;
1572
+ }
1573
+
1574
+ return Gateway.invoke(this._linkSnapTradeAccountEndpoint, payload);
1560
1575
  }
1561
1576
 
1562
1577
  /**
@@ -1582,15 +1597,23 @@ module.exports = (() => {
1582
1597
  * @async
1583
1598
  * @param {String} connection - The SnapTrade identifier for the brokerage connection.
1584
1599
  * @param {String} account - The SnapTrade identifier for the brokerage account.
1600
+ * @param {SnapTradeLinkMode=} mode - The strategy used when importing positions into the linked portfolio.
1585
1601
  * @returns {Promise<Schema.SnapTradeLinkingReport>}
1586
1602
  */
1587
- async refreshSnapTradeAccount(connection, account) {
1603
+ async refreshSnapTradeAccount(connection, account, mode) {
1588
1604
  checkStart.call(this);
1589
1605
 
1590
1606
  assert.argumentIsRequired(connection, 'connection', String);
1591
1607
  assert.argumentIsRequired(account, 'account', String);
1608
+ assert.argumentIsOptional(mode, 'mode', SnapTradeLinkMode, 'SnapTradeLinkMode');
1609
+
1610
+ const payload = { connection, account };
1611
+
1612
+ if (mode) {
1613
+ payload.mode = mode;
1614
+ }
1592
1615
 
1593
- return Gateway.invoke(this._refreshSnapTradeAccountEndpoint, { connection, account });
1616
+ return Gateway.invoke(this._refreshSnapTradeAccountEndpoint, payload);
1594
1617
  }
1595
1618
 
1596
1619
  /**
@@ -1977,6 +2000,7 @@ module.exports = (() => {
1977
2000
 
1978
2001
  accounts.forEach((account) => {
1979
2002
  if (account.link) {
2003
+ account.link.mode = SnapTradeLinkMode.parse(account.link.mode);
1980
2004
  account.link.status = SnapTradeLinkStatus.parse(account.link.status);
1981
2005
  account.link.timestamp = Timestamp.parse(account.link.timestamp);
1982
2006
  }
package/lib/index.js CHANGED
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtProvider: JwtProvider,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '10.4.0'
10
+ version: '10.5.1'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "10.4.0",
3
+ "version": "10.5.1",
4
4
  "description": "JavaScript SDK for Barchart's Portfolio Service",
5
5
  "homepage": "https://docs.barchart.com/portfolio/#/",
6
6
  "author": {
@@ -8,7 +8,15 @@
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": {
19
+ "clean": "rm -rf node_modules",
12
20
  "test": "echo \"Error: Please use gulp to run tests\" && exit 1"
13
21
  },
14
22
  "repository": {
@@ -29,7 +37,7 @@
29
37
  ],
30
38
  "dependencies": {
31
39
  "@barchart/common-js": "^4.70.0",
32
- "@barchart/portfolio-api-common": "^7.4.0"
40
+ "@barchart/portfolio-api-common": "^7.5.2"
33
41
  },
34
42
  "devDependencies": {
35
43
  "@babel/core": "^7.11.1",