@barchart/portfolio-api-common 1.0.66 → 1.0.67
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.
|
@@ -89,15 +89,15 @@ module.exports = (() => {
|
|
|
89
89
|
if (decimal !== null) {
|
|
90
90
|
return formatter.numberToString(decimal.toFloat(), precision, ',', false);
|
|
91
91
|
} else {
|
|
92
|
-
return '
|
|
92
|
+
return '—';
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function formatPercent(decimal, precision) {
|
|
97
97
|
if (decimal !== null) {
|
|
98
|
-
return formatNumber(decimal.multiply(100));
|
|
98
|
+
return formatNumber(decimal.multiply(100), precision);
|
|
99
99
|
} else {
|
|
100
|
-
return '
|
|
100
|
+
return '—';
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -160,7 +160,11 @@ module.exports = (() => {
|
|
|
160
160
|
|
|
161
161
|
if (parentData.market !== null && !parentData.market.getIsZero()) {
|
|
162
162
|
updates.marketPercent = updates.market.divide(parentData.market);
|
|
163
|
+
} else {
|
|
164
|
+
updates.marketPercent = null;
|
|
163
165
|
}
|
|
166
|
+
} else {
|
|
167
|
+
updates.marketPercent = null;
|
|
164
168
|
}
|
|
165
169
|
|
|
166
170
|
actual.market = updates.market;
|
|
@@ -168,7 +172,7 @@ module.exports = (() => {
|
|
|
168
172
|
actual.unrealizedToday = updates.unrealizedToday;
|
|
169
173
|
|
|
170
174
|
format.market = formatCurrency(updates.market, currency);
|
|
171
|
-
format.marketPercent = formatPercent(updates.
|
|
175
|
+
format.marketPercent = formatPercent(updates.marketPercent, 2);
|
|
172
176
|
format.unrealizedToday = formatCurrency(updates.unrealizedToday, currency);
|
|
173
177
|
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
174
178
|
}
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -907,15 +907,15 @@ module.exports = (() => {
|
|
|
907
907
|
if (decimal !== null) {
|
|
908
908
|
return formatter.numberToString(decimal.toFloat(), precision, ',', false);
|
|
909
909
|
} else {
|
|
910
|
-
return '
|
|
910
|
+
return '—';
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
913
|
|
|
914
914
|
function formatPercent(decimal, precision) {
|
|
915
915
|
if (decimal !== null) {
|
|
916
|
-
return formatNumber(decimal.multiply(100));
|
|
916
|
+
return formatNumber(decimal.multiply(100), precision);
|
|
917
917
|
} else {
|
|
918
|
-
return '
|
|
918
|
+
return '—';
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
921
|
|
|
@@ -978,7 +978,11 @@ module.exports = (() => {
|
|
|
978
978
|
|
|
979
979
|
if (parentData.market !== null && !parentData.market.getIsZero()) {
|
|
980
980
|
updates.marketPercent = updates.market.divide(parentData.market);
|
|
981
|
+
} else {
|
|
982
|
+
updates.marketPercent = null;
|
|
981
983
|
}
|
|
984
|
+
} else {
|
|
985
|
+
updates.marketPercent = null;
|
|
982
986
|
}
|
|
983
987
|
|
|
984
988
|
actual.market = updates.market;
|
|
@@ -986,7 +990,7 @@ module.exports = (() => {
|
|
|
986
990
|
actual.unrealizedToday = updates.unrealizedToday;
|
|
987
991
|
|
|
988
992
|
format.market = formatCurrency(updates.market, currency);
|
|
989
|
-
format.marketPercent = formatPercent(updates.
|
|
993
|
+
format.marketPercent = formatPercent(updates.marketPercent, 2);
|
|
990
994
|
format.unrealizedToday = formatCurrency(updates.unrealizedToday, currency);
|
|
991
995
|
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
992
996
|
}
|