@riocrypto/common-server 1.0.766 → 1.0.768

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.
@@ -40,14 +40,19 @@ const calculateAggregateVolumeAndRevenue = (mongoose, days, user) => __awaiter(v
40
40
  const price = order.price || 0;
41
41
  const amountCrypto = order.amountCrypto || 0;
42
42
  let orderVolume = 0;
43
+ let orderRevenue = 0;
43
44
  if (order.side === common_1.Side.Sell) {
44
- orderVolume = conversionRate ? amountCrypto * price * conversionRate : 0;
45
+ orderVolume = conversionRate
46
+ ? amountCrypto * price * (1 / conversionRate)
47
+ : 0;
48
+ orderRevenue = conversionRate ? platformFee * (1 / conversionRate) : 0;
45
49
  }
46
50
  else {
47
51
  orderVolume = conversionRate ? fiatAmount * conversionRate : 0;
52
+ orderRevenue += conversionRate ? platformFee * conversionRate : 0;
48
53
  }
49
54
  volume += orderVolume;
50
- revenue += conversionRate ? platformFee * conversionRate : 0;
55
+ revenue += orderRevenue;
51
56
  });
52
57
  const volumeResult = volume || 0;
53
58
  const revenueResult = revenue || 0;
@@ -27,6 +27,7 @@ interface OrderAttrs {
27
27
  actualConversionRateUSD?: number;
28
28
  notes?: string;
29
29
  discount?: number;
30
+ invoiceUrl?: string;
30
31
  }
31
32
  interface OrderDoc extends Document {
32
33
  userId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.766",
3
+ "version": "1.0.768",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",