@riocrypto/common-server 1.0.764 → 1.0.766
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.
|
@@ -35,15 +35,19 @@ const calculateAggregateVolumeAndRevenue = (mongoose, days, user) => __awaiter(v
|
|
|
35
35
|
orders.forEach((order) => {
|
|
36
36
|
var _a;
|
|
37
37
|
const fiatAmount = order.amountFiat || 0;
|
|
38
|
-
const conversionRate = order.conversionRateUSD
|
|
38
|
+
const conversionRate = order.conversionRateUSD;
|
|
39
39
|
const platformFee = ((_a = order.fees) === null || _a === void 0 ? void 0 : _a.platformFeeFiat) || 0;
|
|
40
40
|
const price = order.price || 0;
|
|
41
41
|
const amountCrypto = order.amountCrypto || 0;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
let orderVolume = 0;
|
|
43
|
+
if (order.side === common_1.Side.Sell) {
|
|
44
|
+
orderVolume = conversionRate ? amountCrypto * price * conversionRate : 0;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
orderVolume = conversionRate ? fiatAmount * conversionRate : 0;
|
|
48
|
+
}
|
|
45
49
|
volume += orderVolume;
|
|
46
|
-
revenue += platformFee * conversionRate;
|
|
50
|
+
revenue += conversionRate ? platformFee * conversionRate : 0;
|
|
47
51
|
});
|
|
48
52
|
const volumeResult = volume || 0;
|
|
49
53
|
const revenueResult = revenue || 0;
|