@riocrypto/common-server 1.0.2691 → 1.0.2694
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.
|
@@ -753,7 +753,7 @@ const buildClusterClient = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
753
753
|
throw new common_1.SecretManagerError();
|
|
754
754
|
}
|
|
755
755
|
const baseUrl = process.env.RIO_ENV === common_1.RioEnv.Local
|
|
756
|
-
? "https://app.local.rio.trade"
|
|
756
|
+
? "https://app.local.rio.trade:3443"
|
|
757
757
|
: process.env.RIO_ENV === common_1.RioEnv.Development
|
|
758
758
|
? "https://app.dev.rio.trade"
|
|
759
759
|
: process.env.RIO_ENV === common_1.RioEnv.Production
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Fiat, Side } from "@riocrypto/common";
|
|
2
|
+
import { RioSettingsDoc } from "../models/rio-settings";
|
|
3
|
+
import { MarketDataDoc } from "../models/market-data";
|
|
4
|
+
export interface ExchangeRatesWithMarkups {
|
|
5
|
+
conversionRateToUSD: number;
|
|
6
|
+
conversionRateToUSDWithMarkups: number;
|
|
7
|
+
conversionRateFromUSD: number;
|
|
8
|
+
conversionRateFromUSDWithMarkups: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const getExchangeRatesWithMarkups: ({ fiat, side, marketData, rioSettings, noAfterHoursMarkup, }: {
|
|
11
|
+
fiat: Fiat;
|
|
12
|
+
side: Side;
|
|
13
|
+
marketData: MarketDataDoc;
|
|
14
|
+
rioSettings: RioSettingsDoc;
|
|
15
|
+
noAfterHoursMarkup?: boolean | undefined;
|
|
16
|
+
}) => ExchangeRatesWithMarkups;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExchangeRatesWithMarkups = void 0;
|
|
4
|
+
const common_1 = require("@riocrypto/common");
|
|
5
|
+
const getExchangeRatesWithMarkups = ({ fiat, side, marketData, rioSettings, noAfterHoursMarkup = false, }) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const afterHoursExchangeRateMarkup = side === common_1.Side.Buy
|
|
8
|
+
? rioSettings.buyOrderAfterHoursExchangeRateMarkup
|
|
9
|
+
: rioSettings.sellOrderAfterHoursExchangeRateMarkup;
|
|
10
|
+
const generalExchangeRateMarkup = side === common_1.Side.Buy
|
|
11
|
+
? rioSettings.buyOrderGeneralExchangeRateMarkup
|
|
12
|
+
: rioSettings.sellOrderGeneralExchangeRateMarkup;
|
|
13
|
+
const conversionRateToUSD = marketData.conversionRatesToUSD[fiat].value;
|
|
14
|
+
const conversionRateFromUSD = marketData.conversionRatesFromUSD[fiat].value;
|
|
15
|
+
let conversionRateToUSDWithMarkups = conversionRateToUSD;
|
|
16
|
+
let conversionRateFromUSDWithMarkups = conversionRateFromUSD;
|
|
17
|
+
if (generalExchangeRateMarkup) {
|
|
18
|
+
conversionRateToUSDWithMarkups =
|
|
19
|
+
conversionRateToUSD * (1 - generalExchangeRateMarkup[fiat]);
|
|
20
|
+
conversionRateFromUSDWithMarkups =
|
|
21
|
+
conversionRateFromUSD * (1 - generalExchangeRateMarkup[fiat]);
|
|
22
|
+
}
|
|
23
|
+
if (((((_a = rioSettings.isAfterHours[common_1.Country.Mexico]) === null || _a === void 0 ? void 0 : _a.value) && fiat === common_1.Fiat.MXN) ||
|
|
24
|
+
(((_b = rioSettings.isAfterHours[common_1.Country.Peru]) === null || _b === void 0 ? void 0 : _b.value) && fiat === common_1.Fiat.PEN)) &&
|
|
25
|
+
afterHoursExchangeRateMarkup &&
|
|
26
|
+
!noAfterHoursMarkup) {
|
|
27
|
+
conversionRateToUSDWithMarkups =
|
|
28
|
+
conversionRateToUSDWithMarkups * (1 - afterHoursExchangeRateMarkup[fiat]);
|
|
29
|
+
conversionRateFromUSDWithMarkups =
|
|
30
|
+
conversionRateFromUSDWithMarkups *
|
|
31
|
+
(1 - afterHoursExchangeRateMarkup[fiat]);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
conversionRateToUSD,
|
|
35
|
+
conversionRateToUSDWithMarkups,
|
|
36
|
+
conversionRateFromUSD,
|
|
37
|
+
conversionRateFromUSDWithMarkups,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
exports.getExchangeRatesWithMarkups = getExchangeRatesWithMarkups;
|
package/build/index.d.ts
CHANGED
|
@@ -147,3 +147,4 @@ export * from "./helpers/get-is-fireblocks-signature-valid";
|
|
|
147
147
|
export * from "./helpers/get-processor";
|
|
148
148
|
export * from "./helpers/get-bulk-payment-from-reference";
|
|
149
149
|
export * from "./helpers/extract-error-message";
|
|
150
|
+
export * from "./helpers/get-exchange-rates-with-markups";
|
package/build/index.js
CHANGED
|
@@ -163,3 +163,4 @@ __exportStar(require("./helpers/get-is-fireblocks-signature-valid"), exports);
|
|
|
163
163
|
__exportStar(require("./helpers/get-processor"), exports);
|
|
164
164
|
__exportStar(require("./helpers/get-bulk-payment-from-reference"), exports);
|
|
165
165
|
__exportStar(require("./helpers/extract-error-message"), exports);
|
|
166
|
+
__exportStar(require("./helpers/get-exchange-rates-with-markups"), exports);
|