@barchart/portfolio-api-common 1.0.125 → 1.0.129

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,12 @@ module.exports = (() => {
275
275
  } else {
276
276
  this._forexQuotes[index] = rate;
277
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;
278
284
  }
279
285
 
280
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
- setForexQuote(quote) {
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.every(item => item.currency === currency);
250
+
245
251
  const translate = (item, value) => {
246
252
  let translated;
247
253
 
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.129",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -991,6 +991,12 @@ module.exports = (() => {
991
991
  } else {
992
992
  this._forexQuotes[index] = rate;
993
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;
994
1000
  }
995
1001
 
996
1002
  getGroup(name, keys) {
@@ -1075,6 +1081,7 @@ module.exports = (() => {
1075
1081
 
1076
1082
  this._items = items;
1077
1083
  this._currency = currency || Currency.CAD;
1084
+ this._bypassCurrencyTranslation = false;
1078
1085
 
1079
1086
  this._key = key;
1080
1087
  this._description = description;
@@ -1091,6 +1098,7 @@ module.exports = (() => {
1091
1098
 
1092
1099
  this._dataFormat.key = this._key;
1093
1100
  this._dataFormat.description = this._description;
1101
+ this._dataFormat.c = this._currency.code;
1094
1102
 
1095
1103
  this._dataFormat.quantity = null;
1096
1104
 
@@ -1212,8 +1220,10 @@ module.exports = (() => {
1212
1220
  return this._excluded;
1213
1221
  }
1214
1222
 
1215
- setForexQuote(quote) {
1216
-
1223
+ setForexRate(rate) {
1224
+ if (!this._bypassCurrencyTranslation) {
1225
+ this.refresh();
1226
+ }
1217
1227
  }
1218
1228
 
1219
1229
  setExcluded(value) {
@@ -1298,6 +1308,8 @@ module.exports = (() => {
1298
1308
 
1299
1309
  const items = group._items;
1300
1310
 
1311
+ group._bypassCurrencyTranslation = items.every(item => item.currency === currency);
1312
+
1301
1313
  const translate = (item, value) => {
1302
1314
  let translated;
1303
1315