@barchart/portfolio-api-common 1.0.157 → 1.0.161
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.
|
@@ -123,7 +123,6 @@ module.exports = (() => {
|
|
|
123
123
|
this._dataActual.summaryTotalPrevious = null;
|
|
124
124
|
this._dataActual.cashTotal = null;
|
|
125
125
|
|
|
126
|
-
this._dataFormat.type = null;
|
|
127
126
|
this._dataFormat.currentPrice = null;
|
|
128
127
|
this._dataFormat.previousPrice = null;
|
|
129
128
|
this._dataFormat.basis = null;
|
|
@@ -144,6 +143,7 @@ module.exports = (() => {
|
|
|
144
143
|
this._dataFormat.summaryTotalPrevious = null;
|
|
145
144
|
this._dataFormat.summaryTotalPreviousNegative = false;
|
|
146
145
|
this._dataFormat.cashTotal = null;
|
|
146
|
+
this._dataFormat.portfolioType = null;
|
|
147
147
|
|
|
148
148
|
this._items.forEach((item) => {
|
|
149
149
|
this._disposeStack.push(item.registerQuoteChangeHandler((quote, sender) => {
|
|
@@ -171,8 +171,8 @@ module.exports = (() => {
|
|
|
171
171
|
this._dataFormat.quoteTime = this._dataActual.quoteTime;
|
|
172
172
|
this._dataFormat.quoteVolume = formatNumber(this._dataActual.quoteVolume, 0);
|
|
173
173
|
|
|
174
|
-
const quoteChangePositive =
|
|
175
|
-
const quoteChangeNegative =
|
|
174
|
+
const quoteChangePositive = quote.lastPriceDirection === 'up';
|
|
175
|
+
const quoteChangeNegative = quote.lastPriceDirection === 'down';
|
|
176
176
|
|
|
177
177
|
setTimeout(() => this._dataFormat.quoteChangeDirection = { up: quoteChangePositive, down: quoteChangeNegative }, 0);
|
|
178
178
|
this._dataFormat.quoteChangeNegative = quoteChangeNegative;
|
|
@@ -509,14 +509,28 @@ module.exports = (() => {
|
|
|
509
509
|
if (group.single) {
|
|
510
510
|
const item = group._items[0];
|
|
511
511
|
|
|
512
|
-
format.type = item.data.type || null;
|
|
513
|
-
|
|
514
512
|
actual.quantity = item.position.snapshot.open;
|
|
515
513
|
actual.basisPrice = item.data.basisPrice;
|
|
516
514
|
|
|
517
515
|
format.quantity = formatDecimal(actual.quantity, 2);
|
|
518
516
|
format.basisPrice = formatCurrency(actual.basisPrice, currency);
|
|
519
517
|
}
|
|
518
|
+
|
|
519
|
+
const groupItems = group._items;
|
|
520
|
+
|
|
521
|
+
let portfolioType = null;
|
|
522
|
+
|
|
523
|
+
if (groupItems.length > 0) {
|
|
524
|
+
const portfolio = groupItems[0].portfolio;
|
|
525
|
+
|
|
526
|
+
if (groupItems.every(i => i.portfolio.portfolio === portfolio.portfolio)) {
|
|
527
|
+
if (portfolio.miscellany && portfolio.miscellany.data.type && portfolio.miscellany.data.type.value) {
|
|
528
|
+
portfolioType = portfolio.miscellany.data.type.value;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
format.portfolioType = portfolioType;
|
|
520
534
|
}
|
|
521
535
|
|
|
522
536
|
function calculatePriceData(group, rates, item, forceRefresh) {
|
|
@@ -61,8 +61,6 @@ module.exports = (() => {
|
|
|
61
61
|
this._data.newsExists = false;
|
|
62
62
|
this._data.fundamental = { };
|
|
63
63
|
|
|
64
|
-
this._data.type = null;
|
|
65
|
-
|
|
66
64
|
calculateStaticData(this);
|
|
67
65
|
calculatePriceData(this, null);
|
|
68
66
|
|
|
@@ -230,16 +228,13 @@ module.exports = (() => {
|
|
|
230
228
|
}
|
|
231
229
|
|
|
232
230
|
function calculateStaticData(item) {
|
|
231
|
+
const portfolio = item.portfolio;
|
|
233
232
|
const position = item.position;
|
|
234
233
|
const snapshot = item.position.snapshot;
|
|
235
234
|
const previousSummaries = item.previousSummaries;
|
|
236
235
|
|
|
237
236
|
const data = item._data;
|
|
238
237
|
|
|
239
|
-
if (position.miscellany && position.miscellany.type && position.miscellany.type.value) {
|
|
240
|
-
data.type = position.miscellany.type.value;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
238
|
data.previousPrice = position.previous || null;
|
|
244
239
|
|
|
245
240
|
let basis;
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1368,7 +1368,6 @@ module.exports = (() => {
|
|
|
1368
1368
|
this._dataActual.summaryTotalPrevious = null;
|
|
1369
1369
|
this._dataActual.cashTotal = null;
|
|
1370
1370
|
|
|
1371
|
-
this._dataFormat.type = null;
|
|
1372
1371
|
this._dataFormat.currentPrice = null;
|
|
1373
1372
|
this._dataFormat.previousPrice = null;
|
|
1374
1373
|
this._dataFormat.basis = null;
|
|
@@ -1389,6 +1388,7 @@ module.exports = (() => {
|
|
|
1389
1388
|
this._dataFormat.summaryTotalPrevious = null;
|
|
1390
1389
|
this._dataFormat.summaryTotalPreviousNegative = false;
|
|
1391
1390
|
this._dataFormat.cashTotal = null;
|
|
1391
|
+
this._dataFormat.portfolioType = null;
|
|
1392
1392
|
|
|
1393
1393
|
this._items.forEach((item) => {
|
|
1394
1394
|
this._disposeStack.push(item.registerQuoteChangeHandler((quote, sender) => {
|
|
@@ -1416,8 +1416,8 @@ module.exports = (() => {
|
|
|
1416
1416
|
this._dataFormat.quoteTime = this._dataActual.quoteTime;
|
|
1417
1417
|
this._dataFormat.quoteVolume = formatNumber(this._dataActual.quoteVolume, 0);
|
|
1418
1418
|
|
|
1419
|
-
const quoteChangePositive =
|
|
1420
|
-
const quoteChangeNegative =
|
|
1419
|
+
const quoteChangePositive = quote.lastPriceDirection === 'up';
|
|
1420
|
+
const quoteChangeNegative = quote.lastPriceDirection === 'down';
|
|
1421
1421
|
|
|
1422
1422
|
setTimeout(() => this._dataFormat.quoteChangeDirection = { up: quoteChangePositive, down: quoteChangeNegative }, 0);
|
|
1423
1423
|
this._dataFormat.quoteChangeNegative = quoteChangeNegative;
|
|
@@ -1754,14 +1754,28 @@ module.exports = (() => {
|
|
|
1754
1754
|
if (group.single) {
|
|
1755
1755
|
const item = group._items[0];
|
|
1756
1756
|
|
|
1757
|
-
format.type = item.data.type || null;
|
|
1758
|
-
|
|
1759
1757
|
actual.quantity = item.position.snapshot.open;
|
|
1760
1758
|
actual.basisPrice = item.data.basisPrice;
|
|
1761
1759
|
|
|
1762
1760
|
format.quantity = formatDecimal(actual.quantity, 2);
|
|
1763
1761
|
format.basisPrice = formatCurrency(actual.basisPrice, currency);
|
|
1764
1762
|
}
|
|
1763
|
+
|
|
1764
|
+
const groupItems = group._items;
|
|
1765
|
+
|
|
1766
|
+
let portfolioType = null;
|
|
1767
|
+
|
|
1768
|
+
if (groupItems.length > 0) {
|
|
1769
|
+
const portfolio = groupItems[0].portfolio;
|
|
1770
|
+
|
|
1771
|
+
if (groupItems.every(i => i.portfolio.portfolio === portfolio.portfolio)) {
|
|
1772
|
+
if (portfolio.miscellany && portfolio.miscellany.data.type && portfolio.miscellany.data.type.value) {
|
|
1773
|
+
portfolioType = portfolio.miscellany.data.type.value;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
format.portfolioType = portfolioType;
|
|
1765
1779
|
}
|
|
1766
1780
|
|
|
1767
1781
|
function calculatePriceData(group, rates, item, forceRefresh) {
|
|
@@ -1975,8 +1989,6 @@ module.exports = (() => {
|
|
|
1975
1989
|
this._data.newsExists = false;
|
|
1976
1990
|
this._data.fundamental = { };
|
|
1977
1991
|
|
|
1978
|
-
this._data.type = null;
|
|
1979
|
-
|
|
1980
1992
|
calculateStaticData(this);
|
|
1981
1993
|
calculatePriceData(this, null);
|
|
1982
1994
|
|
|
@@ -2144,16 +2156,13 @@ module.exports = (() => {
|
|
|
2144
2156
|
}
|
|
2145
2157
|
|
|
2146
2158
|
function calculateStaticData(item) {
|
|
2159
|
+
const portfolio = item.portfolio;
|
|
2147
2160
|
const position = item.position;
|
|
2148
2161
|
const snapshot = item.position.snapshot;
|
|
2149
2162
|
const previousSummaries = item.previousSummaries;
|
|
2150
2163
|
|
|
2151
2164
|
const data = item._data;
|
|
2152
2165
|
|
|
2153
|
-
if (position.miscellany && position.miscellany.type && position.miscellany.type.value) {
|
|
2154
|
-
data.type = position.miscellany.type.value;
|
|
2155
|
-
}
|
|
2156
|
-
|
|
2157
2166
|
data.previousPrice = position.previous || null;
|
|
2158
2167
|
|
|
2159
2168
|
let basis;
|