@barchart/portfolio-api-common 1.0.125 → 1.0.126

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.
@@ -275,6 +275,14 @@ module.exports = (() => {
275
275
  } else {
276
276
  this._forexQuotes[index] = rate;
277
277
  }
278
+
279
+ this._trees.forEach((tree) => {
280
+ tree.walk(group => group.setForexRate(rate), true, false);
281
+ });
282
+ }
283
+
284
+ setPositionFundamentals(data) {
285
+ return;
278
286
  }
279
287
 
280
288
  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;
@@ -156,8 +157,10 @@ module.exports = (() => {
156
157
  return this._excluded;
157
158
  }
158
159
 
159
- setForexQuote(quote) {
160
-
160
+ setForexRate(rate) {
161
+ if (!this._bypassCurrencyTranslation) {
162
+ this.refresh();
163
+ }
161
164
  }
162
165
 
163
166
  setExcluded(value) {
@@ -242,6 +245,8 @@ module.exports = (() => {
242
245
 
243
246
  const items = group._items;
244
247
 
248
+ group._bypassCurrencyTranslation = items.some(item => item.currency !== currency);
249
+
245
250
  const translate = (item, value) => {
246
251
  let translated;
247
252
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.125",
3
+ "version": "1.0.126",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -991,6 +991,14 @@ module.exports = (() => {
991
991
  } else {
992
992
  this._forexQuotes[index] = rate;
993
993
  }
994
+
995
+ this._trees.forEach((tree) => {
996
+ tree.walk(group => group.setForexRate(rate), true, false);
997
+ });
998
+ }
999
+
1000
+ setPositionFundamentals(data) {
1001
+ return;
994
1002
  }
995
1003
 
996
1004
  getGroup(name, keys) {
@@ -1075,6 +1083,7 @@ module.exports = (() => {
1075
1083
 
1076
1084
  this._items = items;
1077
1085
  this._currency = currency || Currency.CAD;
1086
+ this._bypassCurrencyTranslation = false;
1078
1087
 
1079
1088
  this._key = key;
1080
1089
  this._description = description;
@@ -1212,8 +1221,10 @@ module.exports = (() => {
1212
1221
  return this._excluded;
1213
1222
  }
1214
1223
 
1215
- setForexQuote(quote) {
1216
-
1224
+ setForexRate(rate) {
1225
+ if (!this._bypassCurrencyTranslation) {
1226
+ this.refresh();
1227
+ }
1217
1228
  }
1218
1229
 
1219
1230
  setExcluded(value) {
@@ -1298,6 +1309,8 @@ module.exports = (() => {
1298
1309
 
1299
1310
  const items = group._items;
1300
1311
 
1312
+ group._bypassCurrencyTranslation = items.some(item => item.currency !== currency);
1313
+
1301
1314
  const translate = (item, value) => {
1302
1315
  let translated;
1303
1316