@barchart/portfolio-api-common 1.0.124 → 1.0.128
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.
|
@@ -95,11 +95,9 @@ module.exports = (() => {
|
|
|
95
95
|
}, [ ]);
|
|
96
96
|
|
|
97
97
|
this._symbols = this._items.reduce((map, item) => {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
if (position.instrument && position.instrument.symbol && position.instrument.symbol.barchart) {
|
|
101
|
-
const symbol = position.instrument.symbol.barchart;
|
|
98
|
+
const symbol = extractSymbolForBarchart(item.position);
|
|
102
99
|
|
|
100
|
+
if (symbol) {
|
|
103
101
|
if (!map.hasOwnProperty(symbol)) {
|
|
104
102
|
map[symbol] = [ ];
|
|
105
103
|
}
|
|
@@ -277,6 +275,12 @@ module.exports = (() => {
|
|
|
277
275
|
} else {
|
|
278
276
|
this._forexQuotes[index] = rate;
|
|
279
277
|
}
|
|
278
|
+
|
|
279
|
+
Object.keys(this._trees).forEach(key => this._trees[key].walk(group => group.setForexRate(rate), true, false));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
setPositionFundamentals(data) {
|
|
283
|
+
return;
|
|
280
284
|
}
|
|
281
285
|
|
|
282
286
|
getGroup(name, keys) {
|
|
@@ -19,6 +19,7 @@ module.exports = (() => {
|
|
|
19
19
|
|
|
20
20
|
this._items = items;
|
|
21
21
|
this._currency = currency || Currency.CAD;
|
|
22
|
+
this._bypassCurrencyTranslation = false;
|
|
22
23
|
|
|
23
24
|
this._key = key;
|
|
24
25
|
this._description = description;
|
|
@@ -35,6 +36,7 @@ module.exports = (() => {
|
|
|
35
36
|
|
|
36
37
|
this._dataFormat.key = this._key;
|
|
37
38
|
this._dataFormat.description = this._description;
|
|
39
|
+
this._dataFormat.c = this._currency.code;
|
|
38
40
|
|
|
39
41
|
this._dataFormat.quantity = null;
|
|
40
42
|
|
|
@@ -156,8 +158,10 @@ module.exports = (() => {
|
|
|
156
158
|
return this._excluded;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
setForexRate(rate) {
|
|
162
|
+
if (!this._bypassCurrencyTranslation) {
|
|
163
|
+
this.refresh();
|
|
164
|
+
}
|
|
161
165
|
}
|
|
162
166
|
|
|
163
167
|
setExcluded(value) {
|
|
@@ -242,6 +246,8 @@ module.exports = (() => {
|
|
|
242
246
|
|
|
243
247
|
const items = group._items;
|
|
244
248
|
|
|
249
|
+
group._bypassCurrencyTranslation = items.some(item => item.currency !== currency);
|
|
250
|
+
|
|
245
251
|
const translate = (item, value) => {
|
|
246
252
|
let translated;
|
|
247
253
|
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -811,11 +811,9 @@ module.exports = (() => {
|
|
|
811
811
|
}, [ ]);
|
|
812
812
|
|
|
813
813
|
this._symbols = this._items.reduce((map, item) => {
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
if (position.instrument && position.instrument.symbol && position.instrument.symbol.barchart) {
|
|
817
|
-
const symbol = position.instrument.symbol.barchart;
|
|
814
|
+
const symbol = extractSymbolForBarchart(item.position);
|
|
818
815
|
|
|
816
|
+
if (symbol) {
|
|
819
817
|
if (!map.hasOwnProperty(symbol)) {
|
|
820
818
|
map[symbol] = [ ];
|
|
821
819
|
}
|
|
@@ -993,6 +991,12 @@ module.exports = (() => {
|
|
|
993
991
|
} else {
|
|
994
992
|
this._forexQuotes[index] = rate;
|
|
995
993
|
}
|
|
994
|
+
|
|
995
|
+
Object.keys(this._trees).forEach(key => this._trees[key].walk(group => group.setForexRate(rate), true, false));
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
setPositionFundamentals(data) {
|
|
999
|
+
return;
|
|
996
1000
|
}
|
|
997
1001
|
|
|
998
1002
|
getGroup(name, keys) {
|
|
@@ -1077,6 +1081,7 @@ module.exports = (() => {
|
|
|
1077
1081
|
|
|
1078
1082
|
this._items = items;
|
|
1079
1083
|
this._currency = currency || Currency.CAD;
|
|
1084
|
+
this._bypassCurrencyTranslation = false;
|
|
1080
1085
|
|
|
1081
1086
|
this._key = key;
|
|
1082
1087
|
this._description = description;
|
|
@@ -1093,6 +1098,7 @@ module.exports = (() => {
|
|
|
1093
1098
|
|
|
1094
1099
|
this._dataFormat.key = this._key;
|
|
1095
1100
|
this._dataFormat.description = this._description;
|
|
1101
|
+
this._dataFormat.c = this._currency.code;
|
|
1096
1102
|
|
|
1097
1103
|
this._dataFormat.quantity = null;
|
|
1098
1104
|
|
|
@@ -1214,8 +1220,10 @@ module.exports = (() => {
|
|
|
1214
1220
|
return this._excluded;
|
|
1215
1221
|
}
|
|
1216
1222
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1223
|
+
setForexRate(rate) {
|
|
1224
|
+
if (!this._bypassCurrencyTranslation) {
|
|
1225
|
+
this.refresh();
|
|
1226
|
+
}
|
|
1219
1227
|
}
|
|
1220
1228
|
|
|
1221
1229
|
setExcluded(value) {
|
|
@@ -1300,6 +1308,8 @@ module.exports = (() => {
|
|
|
1300
1308
|
|
|
1301
1309
|
const items = group._items;
|
|
1302
1310
|
|
|
1311
|
+
group._bypassCurrencyTranslation = items.some(item => item.currency !== currency);
|
|
1312
|
+
|
|
1303
1313
|
const translate = (item, value) => {
|
|
1304
1314
|
let translated;
|
|
1305
1315
|
|