@barchart/portfolio-api-common 1.0.82 → 1.0.83
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.
- package/lib/processing/PositionGroup.js +6 -13
- package/package.json +1 -1
- package/test/SpecRunner.js +6 -13
|
@@ -52,7 +52,6 @@ module.exports = (() => {
|
|
|
52
52
|
this._dataFormat.marketDirection = null;
|
|
53
53
|
this._dataFormat.unrealizedToday = null;
|
|
54
54
|
this._dataFormat.unrealizedTodayNegative = false;
|
|
55
|
-
this._dataFormat.unrealizedTodayDirection = null;
|
|
56
55
|
this._dataFormat.total = null;
|
|
57
56
|
this._dataFormat.totalNegative = false;
|
|
58
57
|
this._dataFormat.summaryOneTotal = null;
|
|
@@ -225,16 +224,14 @@ module.exports = (() => {
|
|
|
225
224
|
}, {
|
|
226
225
|
market: Decimal.ZERO,
|
|
227
226
|
marketDirection: unchanged,
|
|
228
|
-
unrealizedToday: Decimal.ZERO
|
|
229
|
-
unrealizedTodayDirection: unchanged
|
|
227
|
+
unrealizedToday: Decimal.ZERO
|
|
230
228
|
|
|
231
229
|
});
|
|
232
230
|
} else {
|
|
233
231
|
updates = {
|
|
234
232
|
market: actual.market.add(item.data.marketChange),
|
|
235
233
|
marketDirection: { up: item.data.marketChange.getIsPositive(), down: item.data.marketChange.getIsNegative() },
|
|
236
|
-
unrealizedToday: actual.unrealizedToday.add(item.data.unrealizedTodayChange)
|
|
237
|
-
unrealizedTodayDirection: { up: item.data.unrealizedTodayChange.getIsPositive(), down: item.data.unrealizedTodayChange.getIsNegative() }
|
|
234
|
+
unrealizedToday: actual.unrealizedToday.add(item.data.unrealizedTodayChange)
|
|
238
235
|
};
|
|
239
236
|
}
|
|
240
237
|
|
|
@@ -256,20 +253,16 @@ module.exports = (() => {
|
|
|
256
253
|
actual.total = updates.unrealizedToday.add(actual.realized).add(actual.income);
|
|
257
254
|
format.market = formatCurrency(actual.market, currency);
|
|
258
255
|
format.marketPercent = formatPercent(actual.marketPercent, 2);
|
|
259
|
-
format.unrealizedToday = formatCurrency(actual.unrealizedToday, currency);
|
|
260
|
-
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
261
|
-
format.total = formatCurrency(actual.total, currency);
|
|
262
|
-
format.totalNegative = actual.total.getIsNegative();
|
|
263
256
|
|
|
264
257
|
if (updates.marketDirection.up || updates.marketDirection.down) {
|
|
265
258
|
format.marketDirection = unchanged;
|
|
266
259
|
setTimeout(() => format.marketDirection = updates.marketDirection, 0);
|
|
267
260
|
}
|
|
268
261
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
262
|
+
format.unrealizedToday = formatCurrency(actual.unrealizedToday, currency);
|
|
263
|
+
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
264
|
+
format.total = formatCurrency(actual.total, currency);
|
|
265
|
+
format.totalNegative = actual.total.getIsNegative();
|
|
273
266
|
}
|
|
274
267
|
|
|
275
268
|
const unchanged = { up: false, down: false };
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -991,7 +991,6 @@ module.exports = (() => {
|
|
|
991
991
|
this._dataFormat.marketDirection = null;
|
|
992
992
|
this._dataFormat.unrealizedToday = null;
|
|
993
993
|
this._dataFormat.unrealizedTodayNegative = false;
|
|
994
|
-
this._dataFormat.unrealizedTodayDirection = null;
|
|
995
994
|
this._dataFormat.total = null;
|
|
996
995
|
this._dataFormat.totalNegative = false;
|
|
997
996
|
this._dataFormat.summaryOneTotal = null;
|
|
@@ -1164,16 +1163,14 @@ module.exports = (() => {
|
|
|
1164
1163
|
}, {
|
|
1165
1164
|
market: Decimal.ZERO,
|
|
1166
1165
|
marketDirection: unchanged,
|
|
1167
|
-
unrealizedToday: Decimal.ZERO
|
|
1168
|
-
unrealizedTodayDirection: unchanged
|
|
1166
|
+
unrealizedToday: Decimal.ZERO
|
|
1169
1167
|
|
|
1170
1168
|
});
|
|
1171
1169
|
} else {
|
|
1172
1170
|
updates = {
|
|
1173
1171
|
market: actual.market.add(item.data.marketChange),
|
|
1174
1172
|
marketDirection: { up: item.data.marketChange.getIsPositive(), down: item.data.marketChange.getIsNegative() },
|
|
1175
|
-
unrealizedToday: actual.unrealizedToday.add(item.data.unrealizedTodayChange)
|
|
1176
|
-
unrealizedTodayDirection: { up: item.data.unrealizedTodayChange.getIsPositive(), down: item.data.unrealizedTodayChange.getIsNegative() }
|
|
1173
|
+
unrealizedToday: actual.unrealizedToday.add(item.data.unrealizedTodayChange)
|
|
1177
1174
|
};
|
|
1178
1175
|
}
|
|
1179
1176
|
|
|
@@ -1195,20 +1192,16 @@ module.exports = (() => {
|
|
|
1195
1192
|
actual.total = updates.unrealizedToday.add(actual.realized).add(actual.income);
|
|
1196
1193
|
format.market = formatCurrency(actual.market, currency);
|
|
1197
1194
|
format.marketPercent = formatPercent(actual.marketPercent, 2);
|
|
1198
|
-
format.unrealizedToday = formatCurrency(actual.unrealizedToday, currency);
|
|
1199
|
-
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
1200
|
-
format.total = formatCurrency(actual.total, currency);
|
|
1201
|
-
format.totalNegative = actual.total.getIsNegative();
|
|
1202
1195
|
|
|
1203
1196
|
if (updates.marketDirection.up || updates.marketDirection.down) {
|
|
1204
1197
|
format.marketDirection = unchanged;
|
|
1205
1198
|
setTimeout(() => format.marketDirection = updates.marketDirection, 0);
|
|
1206
1199
|
}
|
|
1207
1200
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1201
|
+
format.unrealizedToday = formatCurrency(actual.unrealizedToday, currency);
|
|
1202
|
+
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
1203
|
+
format.total = formatCurrency(actual.total, currency);
|
|
1204
|
+
format.totalNegative = actual.total.getIsNegative();
|
|
1212
1205
|
}
|
|
1213
1206
|
|
|
1214
1207
|
const unchanged = { up: false, down: false };
|