@barchart/portfolio-api-common 1.0.129 → 1.0.130
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.
|
@@ -279,10 +279,19 @@ module.exports = (() => {
|
|
|
279
279
|
Object.keys(this._trees).forEach(key => this._trees[key].walk(group => group.setForexRate(rate), true, false));
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
setPositionFundamentals(data) {
|
|
282
|
+
setPositionFundamentals(symbol, data) {
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
setNewsArticleExists(symbol, exists) {
|
|
287
|
+
assert.argumentIsRequired(symbol, 'symbol', String);
|
|
288
|
+
assert.argumentIsRequired(exists, 'exists', Boolean);
|
|
289
|
+
|
|
290
|
+
if (this._symbols.hasOwnProperty(symbol)) {
|
|
291
|
+
this._symbols[symbol].forEach(item => item.setNewsArticleExists(exists));
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
286
295
|
getGroup(name, keys) {
|
|
287
296
|
assert.argumentIsRequired(name, 'name', String);
|
|
288
297
|
assert.argumentIsArray(keys, 'keys', Number);
|
|
@@ -36,9 +36,15 @@ module.exports = (() => {
|
|
|
36
36
|
|
|
37
37
|
this._dataFormat.key = this._key;
|
|
38
38
|
this._dataFormat.description = this._description;
|
|
39
|
-
this._dataFormat.
|
|
40
|
-
|
|
39
|
+
this._dataFormat.newsExists = false;
|
|
41
40
|
this._dataFormat.quantity = null;
|
|
41
|
+
this._dataFormat.basisPrice = null;
|
|
42
|
+
|
|
43
|
+
this._dataActual.key = this._key;
|
|
44
|
+
this._dataActual.description = this._description;
|
|
45
|
+
this._dataActual.newsExists = false;
|
|
46
|
+
this._dataActual.quantity = null;
|
|
47
|
+
this._dataActual.basisPrice = null;
|
|
42
48
|
|
|
43
49
|
if (this._single) {
|
|
44
50
|
const item = items[0];
|
|
@@ -117,6 +123,13 @@ module.exports = (() => {
|
|
|
117
123
|
|
|
118
124
|
calculatePriceData(this, this._container.getForexQuotes(), sender, false);
|
|
119
125
|
});
|
|
126
|
+
|
|
127
|
+
if (this._single) {
|
|
128
|
+
item.registerNewsExistsChangeHandler((exists, sender) => {
|
|
129
|
+
this._dataFormat.newsExists = exists;
|
|
130
|
+
this._dataFormat.newsExists = exists;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
120
133
|
});
|
|
121
134
|
|
|
122
135
|
this.refresh();
|
|
@@ -298,8 +311,11 @@ module.exports = (() => {
|
|
|
298
311
|
if (group.single) {
|
|
299
312
|
const item = group._items[0];
|
|
300
313
|
|
|
301
|
-
|
|
302
|
-
|
|
314
|
+
actual.quantity = item.position.snapshot.open;
|
|
315
|
+
actual.basisPrice = item.data.basisPrice;
|
|
316
|
+
|
|
317
|
+
format.quantity = formatDecimal(actual.quantity, 2);
|
|
318
|
+
format.basisPrice = formatCurrency(actual.basisPrice, currency);
|
|
303
319
|
}
|
|
304
320
|
}
|
|
305
321
|
|
|
@@ -50,6 +50,8 @@ module.exports = (() => {
|
|
|
50
50
|
this._data.income = null;
|
|
51
51
|
this._data.basisPrice = null;
|
|
52
52
|
|
|
53
|
+
this._data.newsExists = false;
|
|
54
|
+
|
|
53
55
|
this._excluded = false;
|
|
54
56
|
|
|
55
57
|
calculateStaticData(this);
|
|
@@ -57,6 +59,7 @@ module.exports = (() => {
|
|
|
57
59
|
|
|
58
60
|
this._quoteChangedEvent = new Event(this);
|
|
59
61
|
this._excludedChangeEvent = new Event(this);
|
|
62
|
+
this._newsExistsChangedEvent = new Event(this);
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
get portfolio() {
|
|
@@ -112,6 +115,14 @@ module.exports = (() => {
|
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
setNewsArticleExists(value) {
|
|
119
|
+
assert.argumentIsRequired(value, 'value', Boolean);
|
|
120
|
+
|
|
121
|
+
if (this._data.newsExists !== value) {
|
|
122
|
+
this._newsExistsChangedEvent.fire(this._data.newsExists = value);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
115
126
|
registerQuoteChangeHandler(handler) {
|
|
116
127
|
this._quoteChangedEvent.register(handler);
|
|
117
128
|
}
|
|
@@ -120,6 +131,10 @@ module.exports = (() => {
|
|
|
120
131
|
this._excludedChangeEvent.register(handler);
|
|
121
132
|
}
|
|
122
133
|
|
|
134
|
+
registerNewsExistsChangeHandler(handler) {
|
|
135
|
+
this._newsExistsChangedEvent.register(handler);
|
|
136
|
+
}
|
|
137
|
+
|
|
123
138
|
toString() {
|
|
124
139
|
return '[PositionItem]';
|
|
125
140
|
}
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -995,10 +995,19 @@ module.exports = (() => {
|
|
|
995
995
|
Object.keys(this._trees).forEach(key => this._trees[key].walk(group => group.setForexRate(rate), true, false));
|
|
996
996
|
}
|
|
997
997
|
|
|
998
|
-
setPositionFundamentals(data) {
|
|
998
|
+
setPositionFundamentals(symbol, data) {
|
|
999
999
|
return;
|
|
1000
1000
|
}
|
|
1001
1001
|
|
|
1002
|
+
setNewsArticleExists(symbol, exists) {
|
|
1003
|
+
assert.argumentIsRequired(symbol, 'symbol', String);
|
|
1004
|
+
assert.argumentIsRequired(exists, 'exists', Boolean);
|
|
1005
|
+
|
|
1006
|
+
if (this._symbols.hasOwnProperty(symbol)) {
|
|
1007
|
+
this._symbols[symbol].forEach(item => item.setNewsArticleExists(exists));
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1002
1011
|
getGroup(name, keys) {
|
|
1003
1012
|
assert.argumentIsRequired(name, 'name', String);
|
|
1004
1013
|
assert.argumentIsArray(keys, 'keys', Number);
|
|
@@ -1098,9 +1107,15 @@ module.exports = (() => {
|
|
|
1098
1107
|
|
|
1099
1108
|
this._dataFormat.key = this._key;
|
|
1100
1109
|
this._dataFormat.description = this._description;
|
|
1101
|
-
this._dataFormat.
|
|
1102
|
-
|
|
1110
|
+
this._dataFormat.newsExists = false;
|
|
1103
1111
|
this._dataFormat.quantity = null;
|
|
1112
|
+
this._dataFormat.basisPrice = null;
|
|
1113
|
+
|
|
1114
|
+
this._dataActual.key = this._key;
|
|
1115
|
+
this._dataActual.description = this._description;
|
|
1116
|
+
this._dataActual.newsExists = false;
|
|
1117
|
+
this._dataActual.quantity = null;
|
|
1118
|
+
this._dataActual.basisPrice = null;
|
|
1104
1119
|
|
|
1105
1120
|
if (this._single) {
|
|
1106
1121
|
const item = items[0];
|
|
@@ -1179,6 +1194,13 @@ module.exports = (() => {
|
|
|
1179
1194
|
|
|
1180
1195
|
calculatePriceData(this, this._container.getForexQuotes(), sender, false);
|
|
1181
1196
|
});
|
|
1197
|
+
|
|
1198
|
+
if (this._single) {
|
|
1199
|
+
item.registerNewsExistsChangeHandler((exists, sender) => {
|
|
1200
|
+
this._dataFormat.newsExists = exists;
|
|
1201
|
+
this._dataFormat.newsExists = exists;
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1182
1204
|
});
|
|
1183
1205
|
|
|
1184
1206
|
this.refresh();
|
|
@@ -1360,8 +1382,11 @@ module.exports = (() => {
|
|
|
1360
1382
|
if (group.single) {
|
|
1361
1383
|
const item = group._items[0];
|
|
1362
1384
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1385
|
+
actual.quantity = item.position.snapshot.open;
|
|
1386
|
+
actual.basisPrice = item.data.basisPrice;
|
|
1387
|
+
|
|
1388
|
+
format.quantity = formatDecimal(actual.quantity, 2);
|
|
1389
|
+
format.basisPrice = formatCurrency(actual.basisPrice, currency);
|
|
1365
1390
|
}
|
|
1366
1391
|
}
|
|
1367
1392
|
|
|
@@ -1574,6 +1599,8 @@ module.exports = (() => {
|
|
|
1574
1599
|
this._data.income = null;
|
|
1575
1600
|
this._data.basisPrice = null;
|
|
1576
1601
|
|
|
1602
|
+
this._data.newsExists = false;
|
|
1603
|
+
|
|
1577
1604
|
this._excluded = false;
|
|
1578
1605
|
|
|
1579
1606
|
calculateStaticData(this);
|
|
@@ -1581,6 +1608,7 @@ module.exports = (() => {
|
|
|
1581
1608
|
|
|
1582
1609
|
this._quoteChangedEvent = new Event(this);
|
|
1583
1610
|
this._excludedChangeEvent = new Event(this);
|
|
1611
|
+
this._newsExistsChangedEvent = new Event(this);
|
|
1584
1612
|
}
|
|
1585
1613
|
|
|
1586
1614
|
get portfolio() {
|
|
@@ -1636,6 +1664,14 @@ module.exports = (() => {
|
|
|
1636
1664
|
}
|
|
1637
1665
|
}
|
|
1638
1666
|
|
|
1667
|
+
setNewsArticleExists(value) {
|
|
1668
|
+
assert.argumentIsRequired(value, 'value', Boolean);
|
|
1669
|
+
|
|
1670
|
+
if (this._data.newsExists !== value) {
|
|
1671
|
+
this._newsExistsChangedEvent.fire(this._data.newsExists = value);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1639
1675
|
registerQuoteChangeHandler(handler) {
|
|
1640
1676
|
this._quoteChangedEvent.register(handler);
|
|
1641
1677
|
}
|
|
@@ -1644,6 +1680,10 @@ module.exports = (() => {
|
|
|
1644
1680
|
this._excludedChangeEvent.register(handler);
|
|
1645
1681
|
}
|
|
1646
1682
|
|
|
1683
|
+
registerNewsExistsChangeHandler(handler) {
|
|
1684
|
+
this._newsExistsChangedEvent.register(handler);
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1647
1687
|
toString() {
|
|
1648
1688
|
return '[PositionItem]';
|
|
1649
1689
|
}
|