@riocrypto/common-server 1.0.1921 → 1.0.1924

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.
@@ -39,30 +39,40 @@ const getExchangeRates = (mongoose, fiat, side) => __awaiter(void 0, void 0, voi
39
39
  if (rioSettings.isAfterHours[common_1.Country.Peru].value) {
40
40
  conversionRateToUSDWithMarkups =
41
41
  conversionRateToUSDWithMarkups *
42
- (1 - afterHoursExchangeRateMarkup - generalExchangeRateMarkup);
42
+ (1 -
43
+ afterHoursExchangeRateMarkup[common_1.Fiat.PEN] -
44
+ generalExchangeRateMarkup[common_1.Fiat.PEN]);
43
45
  conversionRateFromUSDWithMarkups =
44
46
  conversionRateFromUSDWithMarkups *
45
- (1 - afterHoursExchangeRateMarkup - generalExchangeRateMarkup);
47
+ (1 -
48
+ afterHoursExchangeRateMarkup[common_1.Fiat.PEN] -
49
+ generalExchangeRateMarkup[common_1.Fiat.PEN]);
46
50
  }
47
51
  if (generalExchangeRateMarkup) {
48
52
  conversionRateToUSDWithMarkups =
49
- conversionRateToUSDWithMarkups * (1 - generalExchangeRateMarkup);
53
+ conversionRateToUSDWithMarkups *
54
+ (1 - generalExchangeRateMarkup[common_1.Fiat.PEN]);
50
55
  conversionRateFromUSDWithMarkups =
51
- conversionRateFromUSDWithMarkups * (1 - generalExchangeRateMarkup);
56
+ conversionRateFromUSDWithMarkups *
57
+ (1 - generalExchangeRateMarkup[common_1.Fiat.PEN]);
52
58
  }
53
59
  }
54
60
  if (fiat === common_1.Fiat.MXN) {
55
61
  if (rioSettings.isAfterHours[common_1.Country.Mexico].value) {
56
62
  conversionRateToUSDWithMarkups =
57
- conversionRateToUSDWithMarkups * (1 - afterHoursExchangeRateMarkup);
63
+ conversionRateToUSDWithMarkups *
64
+ (1 - afterHoursExchangeRateMarkup[common_1.Fiat.MXN]);
58
65
  conversionRateFromUSDWithMarkups =
59
- conversionRateFromUSDWithMarkups * (1 - afterHoursExchangeRateMarkup);
66
+ conversionRateFromUSDWithMarkups *
67
+ (1 - afterHoursExchangeRateMarkup[common_1.Fiat.MXN]);
60
68
  }
61
69
  if (generalExchangeRateMarkup) {
62
70
  conversionRateToUSDWithMarkups =
63
- conversionRateToUSDWithMarkups * (1 - generalExchangeRateMarkup);
71
+ conversionRateToUSDWithMarkups *
72
+ (1 - generalExchangeRateMarkup[common_1.Fiat.MXN]);
64
73
  conversionRateFromUSDWithMarkups =
65
- conversionRateFromUSDWithMarkups * (1 - generalExchangeRateMarkup);
74
+ conversionRateFromUSDWithMarkups *
75
+ (1 - generalExchangeRateMarkup[common_1.Fiat.MXN]);
66
76
  }
67
77
  }
68
78
  return {
@@ -1,3 +1,4 @@
1
+ import { Fiat } from "@riocrypto/common";
1
2
  import mongoose from "mongoose";
2
3
  interface RioSettingsAttrs {
3
4
  platformFee: number;
@@ -9,10 +10,18 @@ interface RioSettingsAttrs {
9
10
  };
10
11
  buyOrderNextDaySettlementFee: number;
11
12
  sellOrderNextDaySettlementFee: number;
12
- buyOrderAfterHoursExchangeRateMarkup: number;
13
- sellOrderAfterHoursExchangeRateMarkup: number;
14
- buyOrderGeneralExchangeRateMarkup: number;
15
- sellOrderGeneralExchangeRateMarkup: number;
13
+ buyOrderAfterHoursExchangeRateMarkup: {
14
+ [key in Fiat]: number;
15
+ };
16
+ sellOrderAfterHoursExchangeRateMarkup: {
17
+ [key in Fiat]: number;
18
+ };
19
+ buyOrderGeneralExchangeRateMarkup: {
20
+ [key in Fiat]: number;
21
+ };
22
+ sellOrderGeneralExchangeRateMarkup: {
23
+ [key in Fiat]: number;
24
+ };
16
25
  additionalBuyOrderLiquidityUSD?: number;
17
26
  additionalSellOrderLiquidityUSD?: number;
18
27
  previousDayUSDMXNConversionRate?: number;
@@ -27,10 +36,18 @@ interface RioSettingsDoc extends mongoose.Document {
27
36
  frozen: boolean;
28
37
  };
29
38
  };
30
- buyOrderAfterHoursExchangeRateMarkup: number;
31
- sellOrderAfterHoursExchangeRateMarkup: number;
32
- buyOrderGeneralExchangeRateMarkup: number;
33
- sellOrderGeneralExchangeRateMarkup: number;
39
+ buyOrderGeneralExchangeRateMarkup: {
40
+ [key in Fiat]: number;
41
+ };
42
+ sellOrderGeneralExchangeRateMarkup: {
43
+ [key in Fiat]: number;
44
+ };
45
+ buyOrderAfterHoursExchangeRateMarkup: {
46
+ [key in Fiat]: number;
47
+ };
48
+ sellOrderAfterHoursExchangeRateMarkup: {
49
+ [key in Fiat]: number;
50
+ };
34
51
  additionalBuyOrderLiquidityUSD?: number;
35
52
  additionalSellOrderLiquidityUSD?: number;
36
53
  previousDayUSDMXNConversionRate?: number;
@@ -21,16 +21,16 @@ const buildRioSettings = (mongoose) => {
21
21
  type: Object,
22
22
  },
23
23
  buyOrderAfterHoursExchangeRateMarkup: {
24
- type: Number,
24
+ type: Object,
25
25
  },
26
26
  sellOrderAfterHoursExchangeRateMarkup: {
27
- type: Number,
27
+ type: Object,
28
28
  },
29
29
  buyOrderGeneralExchangeRateMarkup: {
30
- type: Number,
30
+ type: Object,
31
31
  },
32
32
  sellOrderGeneralExchangeRateMarkup: {
33
- type: Number,
33
+ type: Object,
34
34
  },
35
35
  additionalBuyOrderLiquidityUSD: {
36
36
  type: Number,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1921",
3
+ "version": "1.0.1924",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/secret-manager": "^5.3.0",
29
29
  "@google-cloud/storage": "^6.9.5",
30
30
  "@hyperdx/node-opentelemetry": "^0.7.0",
31
- "@riocrypto/common": "^1.0.1703",
31
+ "@riocrypto/common": "^1.0.1704",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",