@riocrypto/common-server 1.0.820 → 1.0.822
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.
|
@@ -13,7 +13,7 @@ exports.getExchangeRates = void 0;
|
|
|
13
13
|
const common_1 = require("@riocrypto/common");
|
|
14
14
|
const currency_api_client_1 = require("../clients/currency-api-client");
|
|
15
15
|
const kapstar_client_1 = require("../clients/kapstar-client");
|
|
16
|
-
const QUOTE_DURATION_MINUTES =
|
|
16
|
+
const QUOTE_DURATION_MINUTES = 10;
|
|
17
17
|
const getExchangeRates = (from, to) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
const currencyAPIClient = yield (0, currency_api_client_1.buildCurrencyAPIClient)();
|
|
19
19
|
const { startDate, endDate } = getDateRange();
|
|
@@ -30,8 +30,8 @@ const getExchangeRates = (from, to) => __awaiter(void 0, void 0, void 0, functio
|
|
|
30
30
|
? yield kapstarClient.getBRLExchangeRateUSD()
|
|
31
31
|
: yield currencyAPIClient.convert(from, to);
|
|
32
32
|
let conversionRateWithVolatilityMarkup;
|
|
33
|
-
conversionRateWithVolatilityMarkup = conversionRate
|
|
34
|
-
let exchangeRateMultiplier = 0.
|
|
33
|
+
conversionRateWithVolatilityMarkup = conversionRate - maximumPriceChange;
|
|
34
|
+
let exchangeRateMultiplier = 0.9997;
|
|
35
35
|
if (from === common_1.Fiat.PEN || to === common_1.Fiat.PEN) {
|
|
36
36
|
const now = new Date();
|
|
37
37
|
const peruTimezoneOffset = -5; // Peru is in the UTC-5 time zone
|
|
@@ -41,6 +41,9 @@ const getExchangeRates = (from, to) => __awaiter(void 0, void 0, void 0, functio
|
|
|
41
41
|
exchangeRateMultiplier = 0.997;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
if (to === common_1.Fiat.USD) {
|
|
45
|
+
exchangeRateMultiplier = 0.999;
|
|
46
|
+
}
|
|
44
47
|
const conversionRateWithRioMarkup = to === from ? conversionRate : conversionRate * exchangeRateMultiplier;
|
|
45
48
|
const conversionRateWithAllMarkups = to === from
|
|
46
49
|
? conversionRateWithVolatilityMarkup
|