@barchart/portfolio-api-common 1.0.108 → 1.0.112

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.
@@ -122,6 +122,8 @@ module.exports = (() => {
122
122
 
123
123
  return map;
124
124
  }, { });
125
+
126
+ this._forex = { };
125
127
 
126
128
  this._trees = definitions.reduce((map, treeDefinition) => {
127
129
  const tree = new Tree();
@@ -238,7 +240,7 @@ module.exports = (() => {
238
240
  assert.argumentIsRequired(symbol, 'symbol', String);
239
241
  assert.argumentIsRequired(quote, 'quote', Object);
240
242
 
241
- return;
243
+ this._forex[symbol] = quote;
242
244
  }
243
245
 
244
246
  getGroup(name, keys) {
@@ -94,7 +94,7 @@ module.exports = (() => {
94
94
  this._dataFormat.quoteHigh = formatNumber(quote.highPrice, precision);
95
95
  this._dataFormat.quoteLow = formatNumber(quote.lowPrice, precision);
96
96
  this._dataFormat.quoteChange = formatNumber(quote.priceChange, precision);
97
- this._dataFormat.quoteChangePercent = formatPercent(quote.percentChange, 2);
97
+ //this._dataFormat.quoteChangePercent = formatPercent(new Decimal(quote.percentChange), 2);
98
98
  this._dataFormat.quoteTime = quote.timeDisplay;
99
99
  this._dataFormat.quoteVolume = formatNumber(quote.volume, 0);
100
100
  } else {
@@ -85,10 +85,13 @@ module.exports = (() => {
85
85
  assert.argumentIsRequired(quote, 'quote', Object);
86
86
 
87
87
  if (this._previousQuote === null || this._previousQuote.lastPrice !== quote.lastPrice) {
88
+ calculatePriceData(this, quote.lastPrice);
89
+
88
90
  this._previousQuote = this._currentQuote;
89
91
  this._currentQuote = quote;
90
92
 
91
- calculatePriceData(this, this._currentQuote.lastPrice);
93
+ this._data.previousPrice = this._data.currentPrice;
94
+ this._data.currentPrice = quote.lastPrice;
92
95
 
93
96
  this._quoteChangedEvent.fire(this._data, this._currentQuote);
94
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.108",
3
+ "version": "1.0.112",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -838,6 +838,8 @@ module.exports = (() => {
838
838
 
839
839
  return map;
840
840
  }, { });
841
+
842
+ this._forex = { };
841
843
 
842
844
  this._trees = definitions.reduce((map, treeDefinition) => {
843
845
  const tree = new Tree();
@@ -954,7 +956,7 @@ module.exports = (() => {
954
956
  assert.argumentIsRequired(symbol, 'symbol', String);
955
957
  assert.argumentIsRequired(quote, 'quote', Object);
956
958
 
957
- return;
959
+ this._forex[symbol] = quote;
958
960
  }
959
961
 
960
962
  getGroup(name, keys) {
@@ -1097,7 +1099,7 @@ module.exports = (() => {
1097
1099
  this._dataFormat.quoteHigh = formatNumber(quote.highPrice, precision);
1098
1100
  this._dataFormat.quoteLow = formatNumber(quote.lowPrice, precision);
1099
1101
  this._dataFormat.quoteChange = formatNumber(quote.priceChange, precision);
1100
- this._dataFormat.quoteChangePercent = formatPercent(quote.percentChange, 2);
1102
+ //this._dataFormat.quoteChangePercent = formatPercent(new Decimal(quote.percentChange), 2);
1101
1103
  this._dataFormat.quoteTime = quote.timeDisplay;
1102
1104
  this._dataFormat.quoteVolume = formatNumber(quote.volume, 0);
1103
1105
  } else {
@@ -1465,10 +1467,13 @@ module.exports = (() => {
1465
1467
  assert.argumentIsRequired(quote, 'quote', Object);
1466
1468
 
1467
1469
  if (this._previousQuote === null || this._previousQuote.lastPrice !== quote.lastPrice) {
1470
+ calculatePriceData(this, quote.lastPrice);
1471
+
1468
1472
  this._previousQuote = this._currentQuote;
1469
1473
  this._currentQuote = quote;
1470
1474
 
1471
- calculatePriceData(this, this._currentQuote.lastPrice);
1475
+ this._data.previousPrice = this._data.currentPrice;
1476
+ this._data.currentPrice = quote.lastPrice;
1472
1477
 
1473
1478
  this._quoteChangedEvent.fire(this._data, this._currentQuote);
1474
1479
  }