@barchart/portfolio-api-common 1.0.80 → 1.0.81
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 +12 -7
- package/package.json +1 -1
- package/test/SpecRunner.js +12 -7
|
@@ -224,9 +224,9 @@ module.exports = (() => {
|
|
|
224
224
|
return updates;
|
|
225
225
|
}, {
|
|
226
226
|
market: Decimal.ZERO,
|
|
227
|
-
marketDirection:
|
|
227
|
+
marketDirection: unchanged,
|
|
228
228
|
unrealizedToday: Decimal.ZERO,
|
|
229
|
-
unrealizedTodayDirection:
|
|
229
|
+
unrealizedTodayDirection: unchanged
|
|
230
230
|
|
|
231
231
|
});
|
|
232
232
|
} else {
|
|
@@ -254,17 +254,22 @@ module.exports = (() => {
|
|
|
254
254
|
actual.marketPercent = updates.marketPercent;
|
|
255
255
|
actual.unrealizedToday = updates.unrealizedToday;
|
|
256
256
|
actual.total = updates.unrealizedToday.add(actual.realized).add(actual.income);
|
|
257
|
-
|
|
258
257
|
format.market = formatCurrency(actual.market, currency);
|
|
259
258
|
format.marketPercent = formatPercent(actual.marketPercent, 2);
|
|
260
|
-
format.marketDirection = unchanged;
|
|
261
|
-
format.marketDirection = updates.marketDirection;
|
|
262
259
|
format.unrealizedToday = formatCurrency(actual.unrealizedToday, currency);
|
|
263
260
|
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
264
|
-
format.unrealizedTodayDirection = unchanged;
|
|
265
|
-
format.unrealizedTodayDirection = updates.unrealizedTodayDirection;
|
|
266
261
|
format.total = formatCurrency(actual.total, currency);
|
|
267
262
|
format.totalNegative = actual.total.getIsNegative();
|
|
263
|
+
|
|
264
|
+
if (updates.marketDirection.up || updates.marketDirection.down) {
|
|
265
|
+
format.marketDirection = unchanged;
|
|
266
|
+
format.marketDirection = updates.marketDirection;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (updates.unrealizedTodayDirection.up || updates.unrealizedTodayDirection.down) {
|
|
270
|
+
format.unrealizedTodayDirection = unchanged;
|
|
271
|
+
format.unrealizedTodayDirection = updates.unrealizedTodayDirection;
|
|
272
|
+
}
|
|
268
273
|
}
|
|
269
274
|
|
|
270
275
|
const unchanged = { up: false, down: false };
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1163,9 +1163,9 @@ module.exports = (() => {
|
|
|
1163
1163
|
return updates;
|
|
1164
1164
|
}, {
|
|
1165
1165
|
market: Decimal.ZERO,
|
|
1166
|
-
marketDirection:
|
|
1166
|
+
marketDirection: unchanged,
|
|
1167
1167
|
unrealizedToday: Decimal.ZERO,
|
|
1168
|
-
unrealizedTodayDirection:
|
|
1168
|
+
unrealizedTodayDirection: unchanged
|
|
1169
1169
|
|
|
1170
1170
|
});
|
|
1171
1171
|
} else {
|
|
@@ -1193,17 +1193,22 @@ module.exports = (() => {
|
|
|
1193
1193
|
actual.marketPercent = updates.marketPercent;
|
|
1194
1194
|
actual.unrealizedToday = updates.unrealizedToday;
|
|
1195
1195
|
actual.total = updates.unrealizedToday.add(actual.realized).add(actual.income);
|
|
1196
|
-
|
|
1197
1196
|
format.market = formatCurrency(actual.market, currency);
|
|
1198
1197
|
format.marketPercent = formatPercent(actual.marketPercent, 2);
|
|
1199
|
-
format.marketDirection = unchanged;
|
|
1200
|
-
format.marketDirection = updates.marketDirection;
|
|
1201
1198
|
format.unrealizedToday = formatCurrency(actual.unrealizedToday, currency);
|
|
1202
1199
|
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
1203
|
-
format.unrealizedTodayDirection = unchanged;
|
|
1204
|
-
format.unrealizedTodayDirection = updates.unrealizedTodayDirection;
|
|
1205
1200
|
format.total = formatCurrency(actual.total, currency);
|
|
1206
1201
|
format.totalNegative = actual.total.getIsNegative();
|
|
1202
|
+
|
|
1203
|
+
if (updates.marketDirection.up || updates.marketDirection.down) {
|
|
1204
|
+
format.marketDirection = unchanged;
|
|
1205
|
+
format.marketDirection = updates.marketDirection;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
if (updates.unrealizedTodayDirection.up || updates.unrealizedTodayDirection.down) {
|
|
1209
|
+
format.unrealizedTodayDirection = unchanged;
|
|
1210
|
+
format.unrealizedTodayDirection = updates.unrealizedTodayDirection;
|
|
1211
|
+
}
|
|
1207
1212
|
}
|
|
1208
1213
|
|
|
1209
1214
|
const unchanged = { up: false, down: false };
|