@barchart/portfolio-api-common 1.0.123 → 1.0.124
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.
|
@@ -225,8 +225,26 @@ module.exports = (() => {
|
|
|
225
225
|
return this._defaultCurrency;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
getPositionSymbols() {
|
|
229
|
-
|
|
228
|
+
getPositionSymbols(display) {
|
|
229
|
+
const symbols = this._items.reduce((symbols, item) => {
|
|
230
|
+
const position = item.position;
|
|
231
|
+
|
|
232
|
+
let symbol;
|
|
233
|
+
|
|
234
|
+
if (display) {
|
|
235
|
+
symbol = extractSymbolForDisplay(position);
|
|
236
|
+
} else {
|
|
237
|
+
symbol = extractSymbolForBarchart(position);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (symbol !== null) {
|
|
241
|
+
symbols.push(symbol);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return symbols;
|
|
245
|
+
}, [ ]);
|
|
246
|
+
|
|
247
|
+
return array.unique(symbols);
|
|
230
248
|
}
|
|
231
249
|
|
|
232
250
|
setPositionQuote(symbol, quote) {
|
|
@@ -301,5 +319,22 @@ module.exports = (() => {
|
|
|
301
319
|
return ranges.map(range => null);
|
|
302
320
|
}
|
|
303
321
|
|
|
322
|
+
function extractSymbolForBarchart(position) {
|
|
323
|
+
if (position.instrument && position.instrument.symbol && position.instrument.symbol.barchart) {
|
|
324
|
+
return position.instrument.symbol.barchart;
|
|
325
|
+
} else {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function extractSymbolForDisplay(position) {
|
|
331
|
+
if (position.instrument && position.instrument.symbol && position.instrument.symbol.display) {
|
|
332
|
+
return position.instrument.symbol.display;
|
|
333
|
+
} else {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
304
339
|
return PositionContainer;
|
|
305
340
|
})();
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -941,8 +941,26 @@ module.exports = (() => {
|
|
|
941
941
|
return this._defaultCurrency;
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
getPositionSymbols() {
|
|
945
|
-
|
|
944
|
+
getPositionSymbols(display) {
|
|
945
|
+
const symbols = this._items.reduce((symbols, item) => {
|
|
946
|
+
const position = item.position;
|
|
947
|
+
|
|
948
|
+
let symbol;
|
|
949
|
+
|
|
950
|
+
if (display) {
|
|
951
|
+
symbol = extractSymbolForDisplay(position);
|
|
952
|
+
} else {
|
|
953
|
+
symbol = extractSymbolForBarchart(position);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
if (symbol !== null) {
|
|
957
|
+
symbols.push(symbol);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
return symbols;
|
|
961
|
+
}, [ ]);
|
|
962
|
+
|
|
963
|
+
return array.unique(symbols);
|
|
946
964
|
}
|
|
947
965
|
|
|
948
966
|
setPositionQuote(symbol, quote) {
|
|
@@ -1017,6 +1035,23 @@ module.exports = (() => {
|
|
|
1017
1035
|
return ranges.map(range => null);
|
|
1018
1036
|
}
|
|
1019
1037
|
|
|
1038
|
+
function extractSymbolForBarchart(position) {
|
|
1039
|
+
if (position.instrument && position.instrument.symbol && position.instrument.symbol.barchart) {
|
|
1040
|
+
return position.instrument.symbol.barchart;
|
|
1041
|
+
} else {
|
|
1042
|
+
return null;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
function extractSymbolForDisplay(position) {
|
|
1047
|
+
if (position.instrument && position.instrument.symbol && position.instrument.symbol.display) {
|
|
1048
|
+
return position.instrument.symbol.display;
|
|
1049
|
+
} else {
|
|
1050
|
+
return null;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
|
|
1020
1055
|
return PositionContainer;
|
|
1021
1056
|
})();
|
|
1022
1057
|
|