@barchart/portfolio-api-common 1.0.78 → 1.0.79
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 +13 -2
- package/package.json +1 -1
- package/test/SpecRunner.js +13 -2
|
@@ -49,8 +49,12 @@ module.exports = (() => {
|
|
|
49
49
|
this._dataFormat.income = null;
|
|
50
50
|
this._dataFormat.market = null;
|
|
51
51
|
this._dataFormat.marketPercent = null;
|
|
52
|
+
this._dataFormat.marketDirection = null;
|
|
52
53
|
this._dataFormat.unrealizedToday = null;
|
|
54
|
+
this._dataFormat.unrealizedTodayNegative = false;
|
|
55
|
+
this._dataFormat.unrealizedTodayDirection = null;
|
|
53
56
|
this._dataFormat.total = null;
|
|
57
|
+
this._dataFormat.totalNegative = false;
|
|
54
58
|
this._dataFormat.summaryOneTotal = null;
|
|
55
59
|
this._dataFormat.summaryTwoTotal = null;
|
|
56
60
|
|
|
@@ -220,13 +224,17 @@ module.exports = (() => {
|
|
|
220
224
|
return updates;
|
|
221
225
|
}, {
|
|
222
226
|
market: Decimal.ZERO,
|
|
227
|
+
marketDirection: { up: false, down: false },
|
|
228
|
+
unrealizedToday: Decimal.ZERO,
|
|
229
|
+
unrealizedTodayDirection: { up: false, down: false }
|
|
223
230
|
|
|
224
|
-
unrealizedToday: Decimal.ZERO
|
|
225
231
|
});
|
|
226
232
|
} else {
|
|
227
233
|
updates = {
|
|
228
234
|
market: actual.market.add(item.data.marketChange),
|
|
229
|
-
|
|
235
|
+
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() }
|
|
230
238
|
};
|
|
231
239
|
}
|
|
232
240
|
|
|
@@ -249,9 +257,12 @@ module.exports = (() => {
|
|
|
249
257
|
|
|
250
258
|
format.market = formatCurrency(actual.market, currency);
|
|
251
259
|
format.marketPercent = formatPercent(actual.marketPercent, 2);
|
|
260
|
+
format.marketDirection = updates.marketDirection;
|
|
252
261
|
format.unrealizedToday = formatCurrency(actual.unrealizedToday, currency);
|
|
253
262
|
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
263
|
+
format.unrealizedTodayDirection = updates.unrealizedTodayDirection;
|
|
254
264
|
format.total = formatCurrency(actual.total, currency);
|
|
265
|
+
format.totalNegative = actual.total.getIsNegative();
|
|
255
266
|
}
|
|
256
267
|
|
|
257
268
|
return PositionGroup;
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -988,8 +988,12 @@ module.exports = (() => {
|
|
|
988
988
|
this._dataFormat.income = null;
|
|
989
989
|
this._dataFormat.market = null;
|
|
990
990
|
this._dataFormat.marketPercent = null;
|
|
991
|
+
this._dataFormat.marketDirection = null;
|
|
991
992
|
this._dataFormat.unrealizedToday = null;
|
|
993
|
+
this._dataFormat.unrealizedTodayNegative = false;
|
|
994
|
+
this._dataFormat.unrealizedTodayDirection = null;
|
|
992
995
|
this._dataFormat.total = null;
|
|
996
|
+
this._dataFormat.totalNegative = false;
|
|
993
997
|
this._dataFormat.summaryOneTotal = null;
|
|
994
998
|
this._dataFormat.summaryTwoTotal = null;
|
|
995
999
|
|
|
@@ -1159,13 +1163,17 @@ module.exports = (() => {
|
|
|
1159
1163
|
return updates;
|
|
1160
1164
|
}, {
|
|
1161
1165
|
market: Decimal.ZERO,
|
|
1166
|
+
marketDirection: { up: false, down: false },
|
|
1167
|
+
unrealizedToday: Decimal.ZERO,
|
|
1168
|
+
unrealizedTodayDirection: { up: false, down: false }
|
|
1162
1169
|
|
|
1163
|
-
unrealizedToday: Decimal.ZERO
|
|
1164
1170
|
});
|
|
1165
1171
|
} else {
|
|
1166
1172
|
updates = {
|
|
1167
1173
|
market: actual.market.add(item.data.marketChange),
|
|
1168
|
-
|
|
1174
|
+
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() }
|
|
1169
1177
|
};
|
|
1170
1178
|
}
|
|
1171
1179
|
|
|
@@ -1188,9 +1196,12 @@ module.exports = (() => {
|
|
|
1188
1196
|
|
|
1189
1197
|
format.market = formatCurrency(actual.market, currency);
|
|
1190
1198
|
format.marketPercent = formatPercent(actual.marketPercent, 2);
|
|
1199
|
+
format.marketDirection = updates.marketDirection;
|
|
1191
1200
|
format.unrealizedToday = formatCurrency(actual.unrealizedToday, currency);
|
|
1192
1201
|
format.unrealizedTodayNegative = actual.unrealizedToday.getIsNegative();
|
|
1202
|
+
format.unrealizedTodayDirection = updates.unrealizedTodayDirection;
|
|
1193
1203
|
format.total = formatCurrency(actual.total, currency);
|
|
1204
|
+
format.totalNegative = actual.total.getIsNegative();
|
|
1194
1205
|
}
|
|
1195
1206
|
|
|
1196
1207
|
return PositionGroup;
|