@riocrypto/common-server 1.0.1439 → 1.0.1442
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/build/helpers/{calculate-weekly-volume-and-revenue.d.ts → calculate-volume-and-revenue.d.ts} +1 -1
- package/build/helpers/{calculate-weekly-volume-and-revenue.js → calculate-volume-and-revenue.js} +4 -4
- package/build/helpers/get-exchange-rates.js +9 -14
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/package.json +1 -1
package/build/helpers/{calculate-weekly-volume-and-revenue.d.ts → calculate-volume-and-revenue.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { User } from "@riocrypto/common";
|
|
2
2
|
import { Mongoose } from "mongoose";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const calculateVolumeAndRevenue: (mongoose: Mongoose, daysAgo: number, user?: User) => Promise<{
|
|
4
4
|
volume: number;
|
|
5
5
|
revenue: number;
|
|
6
6
|
}>;
|
package/build/helpers/{calculate-weekly-volume-and-revenue.js → calculate-volume-and-revenue.js}
RENAMED
|
@@ -9,13 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.calculateVolumeAndRevenue = void 0;
|
|
13
13
|
const common_1 = require("@riocrypto/common");
|
|
14
14
|
const order_1 = require("../models/order");
|
|
15
|
-
const
|
|
15
|
+
const calculateVolumeAndRevenue = (mongoose, daysAgo, user) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
var _a;
|
|
17
17
|
const startDate = new Date();
|
|
18
|
-
startDate.setDate(startDate.getDate() -
|
|
18
|
+
startDate.setDate(startDate.getDate() - daysAgo);
|
|
19
19
|
startDate.setHours(12, 0, 0, 0);
|
|
20
20
|
const Order = (0, order_1.buildOrder)(mongoose);
|
|
21
21
|
let orders;
|
|
@@ -66,4 +66,4 @@ const calculateWeeklyVolumeAndRevenue = (mongoose, user) => __awaiter(void 0, vo
|
|
|
66
66
|
const revenueResult = revenue || 0;
|
|
67
67
|
return { volume: volumeResult, revenue: revenueResult };
|
|
68
68
|
});
|
|
69
|
-
exports.
|
|
69
|
+
exports.calculateVolumeAndRevenue = calculateVolumeAndRevenue;
|
|
@@ -48,15 +48,16 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
|
|
|
48
48
|
const mexicoCityTime = new Date(now.toLocaleString("en-US", { timeZone: "America/Mexico_City" }));
|
|
49
49
|
const hours = mexicoCityTime.getHours();
|
|
50
50
|
const minutes = mexicoCityTime.getMinutes();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
(hours ===
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
let isAfterHours = false;
|
|
52
|
+
if ((hours >= 8 && hours < 15) ||
|
|
53
|
+
(hours === 15 && minutes <= 45) ||
|
|
54
|
+
(hours >= 19 && hours <= 22)) {
|
|
55
|
+
isAfterHours = true;
|
|
56
|
+
}
|
|
57
|
+
if (mexicoCityTime.getDay() === 0 || mexicoCityTime.getDay() === 6) {
|
|
58
|
+
isAfterHours = true;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
if (isAfterHours) {
|
|
60
61
|
conversionRateToUSDWithMarkups =
|
|
61
62
|
conversionRateToUSD * (1 - afterHoursExchangeRateMarkup);
|
|
62
63
|
conversionRateFromUSDWithMarkups =
|
|
@@ -71,9 +72,3 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
|
|
|
71
72
|
};
|
|
72
73
|
});
|
|
73
74
|
exports.getExchangeRates = getExchangeRates;
|
|
74
|
-
// function getDateRange(): { startDate: Date; endDate: Date } {
|
|
75
|
-
// const endDate = new Date(); // Current time
|
|
76
|
-
// // Subtract 10 minutes from the end_date
|
|
77
|
-
// const startDate = new Date(endDate.getTime() - 10 * 60 * 1000);
|
|
78
|
-
// return { startDate, endDate };
|
|
79
|
-
// }
|
package/build/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export * from "./helpers/get-user-helper";
|
|
|
66
66
|
export * from "./helpers/get-processor-fees";
|
|
67
67
|
export * from "./helpers/get-network-fees";
|
|
68
68
|
export * from "./helpers/calculate-aggregate-volume-and-revenue";
|
|
69
|
-
export * from "./helpers/calculate-
|
|
69
|
+
export * from "./helpers/calculate-volume-and-revenue";
|
|
70
70
|
export * from "./helpers/get-exchange-rates";
|
|
71
71
|
export * from "./helpers/get-user";
|
|
72
72
|
export * from "./helpers/unescape";
|
package/build/index.js
CHANGED
|
@@ -82,7 +82,7 @@ __exportStar(require("./helpers/get-user-helper"), exports);
|
|
|
82
82
|
__exportStar(require("./helpers/get-processor-fees"), exports);
|
|
83
83
|
__exportStar(require("./helpers/get-network-fees"), exports);
|
|
84
84
|
__exportStar(require("./helpers/calculate-aggregate-volume-and-revenue"), exports);
|
|
85
|
-
__exportStar(require("./helpers/calculate-
|
|
85
|
+
__exportStar(require("./helpers/calculate-volume-and-revenue"), exports);
|
|
86
86
|
__exportStar(require("./helpers/get-exchange-rates"), exports);
|
|
87
87
|
__exportStar(require("./helpers/get-user"), exports);
|
|
88
88
|
__exportStar(require("./helpers/unescape"), exports);
|