@gainsnetwork/sdk 0.1.29-rc3 → 0.1.30-rc1
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/README.md +11 -11
- package/lib/constants.d.ts +262 -261
- package/lib/constants.js +278 -277
- package/lib/contracts/addresses.d.ts +3 -3
- package/lib/contracts/addresses.js +31 -31
- package/lib/contracts/addresses.json +89 -89
- package/lib/contracts/index.d.ts +8 -8
- package/lib/contracts/index.js +40 -40
- package/lib/contracts/types/generated/GFarmTradingStorageV5.d.ts +1911 -1911
- package/lib/contracts/types/generated/GFarmTradingStorageV5.js +2 -2
- package/lib/contracts/types/generated/GNSBorrowingFees.d.ts +1067 -1067
- package/lib/contracts/types/generated/GNSBorrowingFees.js +2 -2
- package/lib/contracts/types/generated/GNSMultiCollatDiamond.d.ts +1740 -1740
- package/lib/contracts/types/generated/GNSMultiCollatDiamond.js +2 -2
- package/lib/contracts/types/generated/GNSNftRewardsV6.d.ts +533 -533
- package/lib/contracts/types/generated/GNSNftRewardsV6.js +2 -2
- package/lib/contracts/types/generated/GNSNftRewardsV6_3_1.d.ts +613 -613
- package/lib/contracts/types/generated/GNSNftRewardsV6_3_1.js +2 -2
- package/lib/contracts/types/generated/GNSTrading.d.ts +758 -758
- package/lib/contracts/types/generated/GNSTrading.js +2 -2
- package/lib/contracts/types/generated/GNSTradingCallbacks.d.ts +875 -875
- package/lib/contracts/types/generated/GNSTradingCallbacks.js +2 -2
- package/lib/contracts/types/generated/GNSTradingStorage.d.ts +1387 -1387
- package/lib/contracts/types/generated/GNSTradingStorage.js +2 -2
- package/lib/contracts/types/generated/GToken.d.ts +1946 -1946
- package/lib/contracts/types/generated/GToken.js +2 -2
- package/lib/contracts/types/generated/GTokenOpenPnlFeed.d.ts +557 -557
- package/lib/contracts/types/generated/GTokenOpenPnlFeed.js +2 -2
- package/lib/contracts/types/generated/common.d.ts +22 -22
- package/lib/contracts/types/generated/common.js +2 -2
- package/lib/contracts/types/generated/factories/GFarmTradingStorageV5__factory.d.ts +83 -83
- package/lib/contracts/types/generated/factories/GFarmTradingStorageV5__factory.js +2691 -2691
- package/lib/contracts/types/generated/factories/GNSBorrowingFees__factory.d.ts +124 -124
- package/lib/contracts/types/generated/factories/GNSBorrowingFees__factory.js +1784 -1784
- package/lib/contracts/types/generated/factories/GNSMultiCollatDiamond__factory.d.ts +144 -144
- package/lib/contracts/types/generated/factories/GNSMultiCollatDiamond__factory.js +3094 -3094
- package/lib/contracts/types/generated/factories/GNSNftRewardsV6_3_1__factory.d.ts +100 -100
- package/lib/contracts/types/generated/factories/GNSNftRewardsV6_3_1__factory.js +1116 -1116
- package/lib/contracts/types/generated/factories/GNSNftRewardsV6__factory.d.ts +100 -100
- package/lib/contracts/types/generated/factories/GNSNftRewardsV6__factory.js +1003 -1003
- package/lib/contracts/types/generated/factories/GNSTradingCallbacks__factory.d.ts +113 -113
- package/lib/contracts/types/generated/factories/GNSTradingCallbacks__factory.js +1428 -1428
- package/lib/contracts/types/generated/factories/GNSTradingStorage__factory.d.ts +96 -96
- package/lib/contracts/types/generated/factories/GNSTradingStorage__factory.js +2241 -2241
- package/lib/contracts/types/generated/factories/GNSTrading__factory.d.ts +95 -95
- package/lib/contracts/types/generated/factories/GNSTrading__factory.js +1071 -1071
- package/lib/contracts/types/generated/factories/GTokenOpenPnlFeed__factory.d.ts +59 -59
- package/lib/contracts/types/generated/factories/GTokenOpenPnlFeed__factory.js +765 -765
- package/lib/contracts/types/generated/factories/GToken__factory.d.ts +121 -121
- package/lib/contracts/types/generated/factories/GToken__factory.js +2944 -2944
- package/lib/contracts/types/generated/factories/index.d.ts +10 -10
- package/lib/contracts/types/generated/factories/index.js +26 -26
- package/lib/contracts/types/generated/index.d.ts +21 -21
- package/lib/contracts/types/generated/index.js +47 -47
- package/lib/contracts/types/index.d.ts +27 -27
- package/lib/contracts/types/index.js +10 -10
- package/lib/contracts/utils/borrowingFees.d.ts +8 -8
- package/lib/contracts/utils/borrowingFees.js +28 -28
- package/lib/contracts/utils/index.d.ts +4 -4
- package/lib/contracts/utils/index.js +20 -20
- package/lib/contracts/utils/openLimitOrders.d.ts +8 -8
- package/lib/contracts/utils/openLimitOrders.js +88 -88
- package/lib/contracts/utils/openTrades.d.ts +9 -9
- package/lib/contracts/utils/openTrades.js +188 -188
- package/lib/contracts/utils/pairs.d.ts +7 -7
- package/lib/contracts/utils/pairs.js +338 -337
- package/lib/index.d.ts +7 -7
- package/lib/index.js +24 -24
- package/lib/markets/commodities.d.ts +1 -1
- package/lib/markets/commodities.js +31 -31
- package/lib/markets/crypto.d.ts +1 -1
- package/lib/markets/crypto.js +6 -6
- package/lib/markets/forex.d.ts +3 -3
- package/lib/markets/forex.js +45 -45
- package/lib/markets/index.d.ts +5 -5
- package/lib/markets/index.js +21 -21
- package/lib/markets/indices.d.ts +1 -1
- package/lib/markets/indices.js +6 -6
- package/lib/markets/stocks.d.ts +3 -3
- package/lib/markets/stocks.js +54 -54
- package/lib/trade/fees/borrowing/converter.d.ts +13 -13
- package/lib/trade/fees/borrowing/converter.js +41 -41
- package/lib/trade/fees/borrowing/index.d.ts +55 -55
- package/lib/trade/fees/borrowing/index.js +171 -171
- package/lib/trade/fees/borrowing/types.d.ts +36 -36
- package/lib/trade/fees/borrowing/types.js +2 -2
- package/lib/trade/fees/index.d.ts +4 -4
- package/lib/trade/fees/index.js +30 -30
- package/lib/trade/fees/tiers/index.d.ts +12 -12
- package/lib/trade/fees/tiers/index.js +51 -51
- package/lib/trade/fees/tiers/types.d.ts +8 -8
- package/lib/trade/fees/tiers/types.js +2 -2
- package/lib/trade/index.d.ts +8 -8
- package/lib/trade/index.js +24 -24
- package/lib/trade/liquidation.d.ts +3 -3
- package/lib/trade/liquidation.js +16 -16
- package/lib/trade/oiWindows.d.ts +3 -3
- package/lib/trade/oiWindows.js +20 -20
- package/lib/trade/openLimitOrder.d.ts +2 -2
- package/lib/trade/openLimitOrder.js +23 -23
- package/lib/trade/pnl.d.ts +7 -7
- package/lib/trade/pnl.js +33 -33
- package/lib/trade/spread.d.ts +2 -2
- package/lib/trade/spread.js +22 -22
- package/lib/trade/types.d.ts +430 -429
- package/lib/trade/types.js +250 -249
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +17 -17
- package/lib/utils/packing.d.ts +2 -2
- package/lib/utils/packing.js +39 -39
- package/lib/vault/index.d.ts +8 -8
- package/lib/vault/index.js +10 -10
- package/package.json +105 -105
- package/lib/contracts/types/generated/GNSBorrowingFeesV6_4.d.ts +0 -1058
- package/lib/contracts/types/generated/GNSBorrowingFeesV6_4.js +0 -2
- package/lib/contracts/types/generated/GNSPairInfosV6_1.d.ts +0 -911
- package/lib/contracts/types/generated/GNSPairInfosV6_1.js +0 -2
- package/lib/contracts/types/generated/GNSPairsStorageV6.d.ts +0 -660
- package/lib/contracts/types/generated/GNSPairsStorageV6.js +0 -2
- package/lib/contracts/types/generated/GNSTradingCallbacksV6_4.d.ts +0 -821
- package/lib/contracts/types/generated/GNSTradingCallbacksV6_4.js +0 -2
- package/lib/contracts/types/generated/GTokenV6_3_2.d.ts +0 -1838
- package/lib/contracts/types/generated/GTokenV6_3_2.js +0 -2
- package/lib/contracts/types/generated/factories/GNSBorrowingFeesV6_4__factory.d.ts +0 -113
- package/lib/contracts/types/generated/factories/GNSBorrowingFeesV6_4__factory.js +0 -1742
- package/lib/contracts/types/generated/factories/GNSPairInfosV6_1__factory.d.ts +0 -98
- package/lib/contracts/types/generated/factories/GNSPairInfosV6_1__factory.js +0 -1485
- package/lib/contracts/types/generated/factories/GNSPairsStorageV6__factory.d.ts +0 -117
- package/lib/contracts/types/generated/factories/GNSPairsStorageV6__factory.js +0 -1265
- package/lib/contracts/types/generated/factories/GNSTradingCallbacksV6_4__factory.d.ts +0 -82
- package/lib/contracts/types/generated/factories/GNSTradingCallbacksV6_4__factory.js +0 -1326
- package/lib/contracts/types/generated/factories/GTokenV6_3_2__factory.d.ts +0 -110
- package/lib/contracts/types/generated/factories/GTokenV6_3_2__factory.js +0 -2682
- package/lib/trade/fees.d.ts +0 -15
- package/lib/trade/fees.js +0 -45
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./trade";
|
|
2
|
-
export * from "./contracts";
|
|
3
|
-
export * from "./markets";
|
|
4
|
-
export * from "./constants";
|
|
5
|
-
export * from "./utils";
|
|
6
|
-
export * from "./vault";
|
|
7
|
-
export * from "./trade/fees/borrowing/index";
|
|
1
|
+
export * from "./trade";
|
|
2
|
+
export * from "./contracts";
|
|
3
|
+
export * from "./markets";
|
|
4
|
+
export * from "./constants";
|
|
5
|
+
export * from "./utils";
|
|
6
|
+
export * from "./vault";
|
|
7
|
+
export * from "./trade/fees/borrowing/index";
|
package/lib/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./trade"), exports);
|
|
18
|
-
__exportStar(require("./contracts"), exports);
|
|
19
|
-
__exportStar(require("./markets"), exports);
|
|
20
|
-
__exportStar(require("./constants"), exports);
|
|
21
|
-
__exportStar(require("./utils"), exports);
|
|
22
|
-
__exportStar(require("./vault"), exports);
|
|
23
|
-
// Not sure why this is needed, but it is. Barrel imports are not working.
|
|
24
|
-
__exportStar(require("./trade/fees/borrowing/index"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./trade"), exports);
|
|
18
|
+
__exportStar(require("./contracts"), exports);
|
|
19
|
+
__exportStar(require("./markets"), exports);
|
|
20
|
+
__exportStar(require("./constants"), exports);
|
|
21
|
+
__exportStar(require("./utils"), exports);
|
|
22
|
+
__exportStar(require("./vault"), exports);
|
|
23
|
+
// Not sure why this is needed, but it is. Barrel imports are not working.
|
|
24
|
+
__exportStar(require("./trade/fees/borrowing/index"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isCommoditiesOpen: (dateToCheck: Date) => boolean;
|
|
1
|
+
export declare const isCommoditiesOpen: (dateToCheck: Date) => boolean;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCommoditiesOpen = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
-
// @ts-ignore-file
|
|
7
|
-
const luxon_1 = require("luxon");
|
|
8
|
-
const COMMODITIES_MARKETS_TIME_ZONE_IANA = luxon_1.IANAZone.create("America/New_York");
|
|
9
|
-
const isCommoditiesOpen = (dateToCheck) => {
|
|
10
|
-
const now = luxon_1.DateTime.fromJSDate(dateToCheck).setZone(COMMODITIES_MARKETS_TIME_ZONE_IANA);
|
|
11
|
-
const weekday = now.weekday;
|
|
12
|
-
const hour = now.hour;
|
|
13
|
-
const dayOfMonth = now.day;
|
|
14
|
-
const month = now.month;
|
|
15
|
-
const minute = now.minute;
|
|
16
|
-
const isClosed =
|
|
17
|
-
// Christmas 2023
|
|
18
|
-
(month === 12 && dayOfMonth >= 25 && dayOfMonth <= 27) ||
|
|
19
|
-
// New Year's Eve 2023
|
|
20
|
-
(month === 1 && dayOfMonth >= 1 && dayOfMonth <= 2) ||
|
|
21
|
-
// Friday Closing
|
|
22
|
-
(weekday === 5 && hour >= 17) ||
|
|
23
|
-
// Saturday Closed
|
|
24
|
-
weekday === 6 ||
|
|
25
|
-
// Saturday Opening
|
|
26
|
-
(weekday === 7 && hour <= 18) ||
|
|
27
|
-
// Daily Closing
|
|
28
|
-
hour === 17;
|
|
29
|
-
return !isClosed;
|
|
30
|
-
};
|
|
31
|
-
exports.isCommoditiesOpen = isCommoditiesOpen;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCommoditiesOpen = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
+
// @ts-ignore-file
|
|
7
|
+
const luxon_1 = require("luxon");
|
|
8
|
+
const COMMODITIES_MARKETS_TIME_ZONE_IANA = luxon_1.IANAZone.create("America/New_York");
|
|
9
|
+
const isCommoditiesOpen = (dateToCheck) => {
|
|
10
|
+
const now = luxon_1.DateTime.fromJSDate(dateToCheck).setZone(COMMODITIES_MARKETS_TIME_ZONE_IANA);
|
|
11
|
+
const weekday = now.weekday;
|
|
12
|
+
const hour = now.hour;
|
|
13
|
+
const dayOfMonth = now.day;
|
|
14
|
+
const month = now.month;
|
|
15
|
+
const minute = now.minute;
|
|
16
|
+
const isClosed =
|
|
17
|
+
// Christmas 2023
|
|
18
|
+
(month === 12 && dayOfMonth >= 25 && dayOfMonth <= 27) ||
|
|
19
|
+
// New Year's Eve 2023
|
|
20
|
+
(month === 1 && dayOfMonth >= 1 && dayOfMonth <= 2) ||
|
|
21
|
+
// Friday Closing
|
|
22
|
+
(weekday === 5 && hour >= 17) ||
|
|
23
|
+
// Saturday Closed
|
|
24
|
+
weekday === 6 ||
|
|
25
|
+
// Saturday Opening
|
|
26
|
+
(weekday === 7 && hour <= 18) ||
|
|
27
|
+
// Daily Closing
|
|
28
|
+
hour === 17;
|
|
29
|
+
return !isClosed;
|
|
30
|
+
};
|
|
31
|
+
exports.isCommoditiesOpen = isCommoditiesOpen;
|
package/lib/markets/crypto.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isCryptoOpen: (dateToCheck: Date) => boolean;
|
|
1
|
+
export declare const isCryptoOpen: (dateToCheck: Date) => boolean;
|
package/lib/markets/crypto.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCryptoOpen = void 0;
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
-
const isCryptoOpen = (dateToCheck) => true;
|
|
6
|
-
exports.isCryptoOpen = isCryptoOpen;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCryptoOpen = void 0;
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
const isCryptoOpen = (dateToCheck) => true;
|
|
6
|
+
exports.isCryptoOpen = isCryptoOpen;
|
package/lib/markets/forex.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Pair } from "src/trade";
|
|
2
|
-
export declare const isForexOpen: (dateToCheck: Date) => boolean;
|
|
3
|
-
export declare const isForexLowLiquidity: (timestampToCheck: number, pair?: Pair) => boolean;
|
|
1
|
+
import { Pair } from "src/trade";
|
|
2
|
+
export declare const isForexOpen: (dateToCheck: Date) => boolean;
|
|
3
|
+
export declare const isForexLowLiquidity: (timestampToCheck: number, pair?: Pair) => boolean;
|
package/lib/markets/forex.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isForexLowLiquidity = exports.isForexOpen = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
-
// @ts-ignore-file
|
|
7
|
-
const luxon_1 = require("luxon");
|
|
8
|
-
const FOREX_MARKETS_TIME_ZONE_IANA = luxon_1.IANAZone.create("America/New_York");
|
|
9
|
-
const isForexOpen = (dateToCheck) => {
|
|
10
|
-
const now = luxon_1.DateTime.fromJSDate(dateToCheck).setZone(FOREX_MARKETS_TIME_ZONE_IANA);
|
|
11
|
-
const weekday = now.weekday;
|
|
12
|
-
const hour = now.hour;
|
|
13
|
-
const dayOfMonth = now.day;
|
|
14
|
-
const month = now.month;
|
|
15
|
-
const isInDST = now.isInDST;
|
|
16
|
-
const isClosed =
|
|
17
|
-
// Christmas 2023
|
|
18
|
-
(month === 12 && dayOfMonth >= 25 && dayOfMonth <= 27) ||
|
|
19
|
-
// New Year's Eve 2023
|
|
20
|
-
(month === 1 && dayOfMonth >= 1 && dayOfMonth <= 2) ||
|
|
21
|
-
// Friday after 4PM (DST) and 5PM (non-DST)
|
|
22
|
-
(weekday === 5 && ((isInDST && hour >= 16) || hour >= 17)) ||
|
|
23
|
-
// Saturday
|
|
24
|
-
weekday === 6 ||
|
|
25
|
-
// Sunday before 4PM (DST) and 5PM (non-DST)
|
|
26
|
-
(weekday === 7 && ((isInDST && hour < 16) || hour < 17));
|
|
27
|
-
return !isClosed;
|
|
28
|
-
};
|
|
29
|
-
exports.isForexOpen = isForexOpen;
|
|
30
|
-
const extendedLowLiqGroupIds = [8, 9];
|
|
31
|
-
const isForexLowLiquidity = (timestampToCheck, pair) => {
|
|
32
|
-
const now = luxon_1.DateTime.fromMillis(timestampToCheck).setZone(FOREX_MARKETS_TIME_ZONE_IANA);
|
|
33
|
-
const hour = now.hour;
|
|
34
|
-
const minute = now.minute;
|
|
35
|
-
const isInDST = now.isInDST;
|
|
36
|
-
const groupIndex = pair === null || pair === void 0 ? void 0 : pair.groupIndex;
|
|
37
|
-
if (groupIndex && extendedLowLiqGroupIds.includes(+groupIndex)) {
|
|
38
|
-
return ((isInDST &&
|
|
39
|
-
((hour == 15 && minute >= 15) || (hour >= 16 && hour < 21))) ||
|
|
40
|
-
(!isInDST && ((hour == 16 && minute >= 15) || (hour >= 17 && hour < 22))));
|
|
41
|
-
}
|
|
42
|
-
return ((isInDST && ((hour == 15 && minute >= 45) || (hour >= 16 && hour < 19))) ||
|
|
43
|
-
(!isInDST && ((hour == 16 && minute >= 45) || (hour >= 17 && hour < 20))));
|
|
44
|
-
};
|
|
45
|
-
exports.isForexLowLiquidity = isForexLowLiquidity;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isForexLowLiquidity = exports.isForexOpen = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
+
// @ts-ignore-file
|
|
7
|
+
const luxon_1 = require("luxon");
|
|
8
|
+
const FOREX_MARKETS_TIME_ZONE_IANA = luxon_1.IANAZone.create("America/New_York");
|
|
9
|
+
const isForexOpen = (dateToCheck) => {
|
|
10
|
+
const now = luxon_1.DateTime.fromJSDate(dateToCheck).setZone(FOREX_MARKETS_TIME_ZONE_IANA);
|
|
11
|
+
const weekday = now.weekday;
|
|
12
|
+
const hour = now.hour;
|
|
13
|
+
const dayOfMonth = now.day;
|
|
14
|
+
const month = now.month;
|
|
15
|
+
const isInDST = now.isInDST;
|
|
16
|
+
const isClosed =
|
|
17
|
+
// Christmas 2023
|
|
18
|
+
(month === 12 && dayOfMonth >= 25 && dayOfMonth <= 27) ||
|
|
19
|
+
// New Year's Eve 2023
|
|
20
|
+
(month === 1 && dayOfMonth >= 1 && dayOfMonth <= 2) ||
|
|
21
|
+
// Friday after 4PM (DST) and 5PM (non-DST)
|
|
22
|
+
(weekday === 5 && ((isInDST && hour >= 16) || hour >= 17)) ||
|
|
23
|
+
// Saturday
|
|
24
|
+
weekday === 6 ||
|
|
25
|
+
// Sunday before 4PM (DST) and 5PM (non-DST)
|
|
26
|
+
(weekday === 7 && ((isInDST && hour < 16) || hour < 17));
|
|
27
|
+
return !isClosed;
|
|
28
|
+
};
|
|
29
|
+
exports.isForexOpen = isForexOpen;
|
|
30
|
+
const extendedLowLiqGroupIds = [8, 9];
|
|
31
|
+
const isForexLowLiquidity = (timestampToCheck, pair) => {
|
|
32
|
+
const now = luxon_1.DateTime.fromMillis(timestampToCheck).setZone(FOREX_MARKETS_TIME_ZONE_IANA);
|
|
33
|
+
const hour = now.hour;
|
|
34
|
+
const minute = now.minute;
|
|
35
|
+
const isInDST = now.isInDST;
|
|
36
|
+
const groupIndex = pair === null || pair === void 0 ? void 0 : pair.groupIndex;
|
|
37
|
+
if (groupIndex && extendedLowLiqGroupIds.includes(+groupIndex)) {
|
|
38
|
+
return ((isInDST &&
|
|
39
|
+
((hour == 15 && minute >= 15) || (hour >= 16 && hour < 21))) ||
|
|
40
|
+
(!isInDST && ((hour == 16 && minute >= 15) || (hour >= 17 && hour < 22))));
|
|
41
|
+
}
|
|
42
|
+
return ((isInDST && ((hour == 15 && minute >= 45) || (hour >= 16 && hour < 19))) ||
|
|
43
|
+
(!isInDST && ((hour == 16 && minute >= 45) || (hour >= 17 && hour < 20))));
|
|
44
|
+
};
|
|
45
|
+
exports.isForexLowLiquidity = isForexLowLiquidity;
|
package/lib/markets/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./crypto";
|
|
2
|
-
export * from "./forex";
|
|
3
|
-
export * from "./stocks";
|
|
4
|
-
export * from "./indices";
|
|
5
|
-
export * from "./commodities";
|
|
1
|
+
export * from "./crypto";
|
|
2
|
+
export * from "./forex";
|
|
3
|
+
export * from "./stocks";
|
|
4
|
+
export * from "./indices";
|
|
5
|
+
export * from "./commodities";
|
package/lib/markets/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./crypto"), exports);
|
|
18
|
-
__exportStar(require("./forex"), exports);
|
|
19
|
-
__exportStar(require("./stocks"), exports);
|
|
20
|
-
__exportStar(require("./indices"), exports);
|
|
21
|
-
__exportStar(require("./commodities"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./crypto"), exports);
|
|
18
|
+
__exportStar(require("./forex"), exports);
|
|
19
|
+
__exportStar(require("./stocks"), exports);
|
|
20
|
+
__exportStar(require("./indices"), exports);
|
|
21
|
+
__exportStar(require("./commodities"), exports);
|
package/lib/markets/indices.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isIndicesOpen: (dateToCheck: Date) => boolean;
|
|
1
|
+
export declare const isIndicesOpen: (dateToCheck: Date) => boolean;
|
package/lib/markets/indices.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isIndicesOpen = void 0;
|
|
4
|
-
const stocks_1 = require("./stocks");
|
|
5
|
-
const isIndicesOpen = (dateToCheck) => (0, stocks_1.isStocksOpen)(dateToCheck);
|
|
6
|
-
exports.isIndicesOpen = isIndicesOpen;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIndicesOpen = void 0;
|
|
4
|
+
const stocks_1 = require("./stocks");
|
|
5
|
+
const isIndicesOpen = (dateToCheck) => (0, stocks_1.isStocksOpen)(dateToCheck);
|
|
6
|
+
exports.isIndicesOpen = isIndicesOpen;
|
package/lib/markets/stocks.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DateTime } from "luxon";
|
|
2
|
-
export declare const isStocksOpen: (dateToCheck: Date) => boolean;
|
|
3
|
-
export declare const getUSMarketsNow: () => DateTime;
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
|
+
export declare const isStocksOpen: (dateToCheck: Date) => boolean;
|
|
3
|
+
export declare const getUSMarketsNow: () => DateTime;
|
package/lib/markets/stocks.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUSMarketsNow = exports.isStocksOpen = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
-
// @ts-ignore-file
|
|
7
|
-
const luxon_1 = require("luxon");
|
|
8
|
-
const STOCKS_MARKETS_TIME_ZONE_IANA = luxon_1.IANAZone.create("America/New_York");
|
|
9
|
-
const isStocksOpen = (dateToCheck) => {
|
|
10
|
-
const now = luxon_1.DateTime.fromJSDate(dateToCheck).setZone(STOCKS_MARKETS_TIME_ZONE_IANA);
|
|
11
|
-
const weekday = now.weekday;
|
|
12
|
-
const hour = now.hour;
|
|
13
|
-
const dayOfMonth = now.day;
|
|
14
|
-
const month = now.month;
|
|
15
|
-
const minute = now.minute;
|
|
16
|
-
const isClosed =
|
|
17
|
-
// New Year's 2023
|
|
18
|
-
(month === 1 && dayOfMonth === 2) ||
|
|
19
|
-
// Martin Luther King, Jr. Day 2023
|
|
20
|
-
(month === 1 && dayOfMonth === 16) ||
|
|
21
|
-
// Washington's Birthday 2023
|
|
22
|
-
(month === 2 && dayOfMonth === 20) ||
|
|
23
|
-
// Good Friday 2023
|
|
24
|
-
(month === 4 && dayOfMonth === 7) ||
|
|
25
|
-
// Memorial Day 2023
|
|
26
|
-
(month === 5 && dayOfMonth === 29) ||
|
|
27
|
-
// Juneteenth National Independence Day 2023
|
|
28
|
-
(month === 6 && dayOfMonth === 19) ||
|
|
29
|
-
// Independence Day 2023
|
|
30
|
-
(month === 7 && dayOfMonth === 4) ||
|
|
31
|
-
// Labor Day 2023
|
|
32
|
-
(month === 9 && dayOfMonth === 4) ||
|
|
33
|
-
// Thanksgiving Day 2022
|
|
34
|
-
(month === 11 && dayOfMonth === 23) ||
|
|
35
|
-
// Friday after Thanksgiving Day 2023 (closes early at 1PM)
|
|
36
|
-
(month === 11 && dayOfMonth === 24 && hour >= 13) ||
|
|
37
|
-
// Christmas Day 2023
|
|
38
|
-
(month === 12 && dayOfMonth === 25) ||
|
|
39
|
-
// Saturday
|
|
40
|
-
weekday === 6 ||
|
|
41
|
-
// Sunday
|
|
42
|
-
weekday === 7 ||
|
|
43
|
-
// Mo-Fr Daily Opening
|
|
44
|
-
hour < 9 ||
|
|
45
|
-
(hour === 9 && minute < 30) ||
|
|
46
|
-
// Mo-Fr Daily Closing
|
|
47
|
-
hour >= 16;
|
|
48
|
-
return !isClosed;
|
|
49
|
-
};
|
|
50
|
-
exports.isStocksOpen = isStocksOpen;
|
|
51
|
-
const getUSMarketsNow = () => {
|
|
52
|
-
return luxon_1.DateTime.now().setZone(STOCKS_MARKETS_TIME_ZONE_IANA);
|
|
53
|
-
};
|
|
54
|
-
exports.getUSMarketsNow = getUSMarketsNow;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUSMarketsNow = exports.isStocksOpen = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
+
// @ts-ignore-file
|
|
7
|
+
const luxon_1 = require("luxon");
|
|
8
|
+
const STOCKS_MARKETS_TIME_ZONE_IANA = luxon_1.IANAZone.create("America/New_York");
|
|
9
|
+
const isStocksOpen = (dateToCheck) => {
|
|
10
|
+
const now = luxon_1.DateTime.fromJSDate(dateToCheck).setZone(STOCKS_MARKETS_TIME_ZONE_IANA);
|
|
11
|
+
const weekday = now.weekday;
|
|
12
|
+
const hour = now.hour;
|
|
13
|
+
const dayOfMonth = now.day;
|
|
14
|
+
const month = now.month;
|
|
15
|
+
const minute = now.minute;
|
|
16
|
+
const isClosed =
|
|
17
|
+
// New Year's 2023
|
|
18
|
+
(month === 1 && dayOfMonth === 2) ||
|
|
19
|
+
// Martin Luther King, Jr. Day 2023
|
|
20
|
+
(month === 1 && dayOfMonth === 16) ||
|
|
21
|
+
// Washington's Birthday 2023
|
|
22
|
+
(month === 2 && dayOfMonth === 20) ||
|
|
23
|
+
// Good Friday 2023
|
|
24
|
+
(month === 4 && dayOfMonth === 7) ||
|
|
25
|
+
// Memorial Day 2023
|
|
26
|
+
(month === 5 && dayOfMonth === 29) ||
|
|
27
|
+
// Juneteenth National Independence Day 2023
|
|
28
|
+
(month === 6 && dayOfMonth === 19) ||
|
|
29
|
+
// Independence Day 2023
|
|
30
|
+
(month === 7 && dayOfMonth === 4) ||
|
|
31
|
+
// Labor Day 2023
|
|
32
|
+
(month === 9 && dayOfMonth === 4) ||
|
|
33
|
+
// Thanksgiving Day 2022
|
|
34
|
+
(month === 11 && dayOfMonth === 23) ||
|
|
35
|
+
// Friday after Thanksgiving Day 2023 (closes early at 1PM)
|
|
36
|
+
(month === 11 && dayOfMonth === 24 && hour >= 13) ||
|
|
37
|
+
// Christmas Day 2023
|
|
38
|
+
(month === 12 && dayOfMonth === 25) ||
|
|
39
|
+
// Saturday
|
|
40
|
+
weekday === 6 ||
|
|
41
|
+
// Sunday
|
|
42
|
+
weekday === 7 ||
|
|
43
|
+
// Mo-Fr Daily Opening
|
|
44
|
+
hour < 9 ||
|
|
45
|
+
(hour === 9 && minute < 30) ||
|
|
46
|
+
// Mo-Fr Daily Closing
|
|
47
|
+
hour >= 16;
|
|
48
|
+
return !isClosed;
|
|
49
|
+
};
|
|
50
|
+
exports.isStocksOpen = isStocksOpen;
|
|
51
|
+
const getUSMarketsNow = () => {
|
|
52
|
+
return luxon_1.DateTime.now().setZone(STOCKS_MARKETS_TIME_ZONE_IANA);
|
|
53
|
+
};
|
|
54
|
+
exports.getUSMarketsNow = getUSMarketsNow;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { IGNSBorrowingFees } from "../../../contracts/types/generated/GNSBorrowingFees";
|
|
2
|
-
import { BorrowingFee } from ".";
|
|
3
|
-
export declare const convertPairGroupBorrowingFee: (pairGroup: IGNSBorrowingFees.PairGroupStructOutput) => BorrowingFee.PairGroup;
|
|
4
|
-
export declare const convertPairBorrowingFee: (pair: IGNSBorrowingFees.PairStructOutput, pairOi: IGNSBorrowingFees.PairOiStructOutput) => BorrowingFee.Pair;
|
|
5
|
-
export declare const convertPairBorrowingFees: ([pairs, pairOi]: [
|
|
6
|
-
IGNSBorrowingFees.PairStructOutput[],
|
|
7
|
-
IGNSBorrowingFees.PairOiStructOutput[]
|
|
8
|
-
]) => BorrowingFee.Pair[];
|
|
9
|
-
export declare const convertGroupBorrowingFee: (group: IGNSBorrowingFees.GroupStructOutput, groupFeeExponent: number) => BorrowingFee.Group;
|
|
10
|
-
export declare const convertGroupBorrowingFees: ([groups, groupFeeExponents]: [
|
|
11
|
-
IGNSBorrowingFees.GroupStructOutput[],
|
|
12
|
-
number[]
|
|
13
|
-
]) => BorrowingFee.Group[];
|
|
1
|
+
import { IGNSBorrowingFees } from "../../../contracts/types/generated/GNSBorrowingFees";
|
|
2
|
+
import { BorrowingFee } from ".";
|
|
3
|
+
export declare const convertPairGroupBorrowingFee: (pairGroup: IGNSBorrowingFees.PairGroupStructOutput) => BorrowingFee.PairGroup;
|
|
4
|
+
export declare const convertPairBorrowingFee: (pair: IGNSBorrowingFees.PairStructOutput, pairOi: IGNSBorrowingFees.PairOiStructOutput) => BorrowingFee.Pair;
|
|
5
|
+
export declare const convertPairBorrowingFees: ([pairs, pairOi]: [
|
|
6
|
+
IGNSBorrowingFees.PairStructOutput[],
|
|
7
|
+
IGNSBorrowingFees.PairOiStructOutput[]
|
|
8
|
+
]) => BorrowingFee.Pair[];
|
|
9
|
+
export declare const convertGroupBorrowingFee: (group: IGNSBorrowingFees.GroupStructOutput, groupFeeExponent: number) => BorrowingFee.Group;
|
|
10
|
+
export declare const convertGroupBorrowingFees: ([groups, groupFeeExponents]: [
|
|
11
|
+
IGNSBorrowingFees.GroupStructOutput[],
|
|
12
|
+
number[]
|
|
13
|
+
]) => BorrowingFee.Group[];
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertGroupBorrowingFees = exports.convertGroupBorrowingFee = exports.convertPairBorrowingFees = exports.convertPairBorrowingFee = exports.convertPairGroupBorrowingFee = void 0;
|
|
4
|
-
const convertPairGroupBorrowingFee = (pairGroup) => ({
|
|
5
|
-
groupIndex: pairGroup.groupIndex,
|
|
6
|
-
initialAccFeeLong: parseFloat(pairGroup.initialAccFeeLong.toString()) / 1e10,
|
|
7
|
-
initialAccFeeShort: parseFloat(pairGroup.initialAccFeeShort.toString()) / 1e10,
|
|
8
|
-
prevGroupAccFeeLong: parseFloat(pairGroup.prevGroupAccFeeLong.toString()) / 1e10,
|
|
9
|
-
prevGroupAccFeeShort: parseFloat(pairGroup.prevGroupAccFeeShort.toString()) / 1e10,
|
|
10
|
-
pairAccFeeLong: parseFloat(pairGroup.pairAccFeeLong.toString()) / 1e10,
|
|
11
|
-
pairAccFeeShort: parseFloat(pairGroup.pairAccFeeShort.toString()) / 1e10,
|
|
12
|
-
block: pairGroup.block,
|
|
13
|
-
});
|
|
14
|
-
exports.convertPairGroupBorrowingFee = convertPairGroupBorrowingFee;
|
|
15
|
-
const convertPairBorrowingFee = (pair, pairOi) => ({
|
|
16
|
-
feePerBlock: pair.feePerBlock / 1e10,
|
|
17
|
-
accFeeLong: parseFloat(pair.accFeeLong.toString()) / 1e10,
|
|
18
|
-
accFeeShort: parseFloat(pair.accFeeShort.toString()) / 1e10,
|
|
19
|
-
accLastUpdatedBlock: pair.accLastUpdatedBlock,
|
|
20
|
-
lastAccBlockWeightedMarketCap: parseFloat(pair.lastAccBlockWeightedMarketCap.toString()) / 1e40,
|
|
21
|
-
groups: pair.groups.map(value => (0, exports.convertPairGroupBorrowingFee)(value)),
|
|
22
|
-
feeExponent: pair.feeExponent,
|
|
23
|
-
maxOi: parseFloat(pairOi.max.toString()) / 1e10,
|
|
24
|
-
});
|
|
25
|
-
exports.convertPairBorrowingFee = convertPairBorrowingFee;
|
|
26
|
-
const convertPairBorrowingFees = ([pairs, pairOi]) => pairs.map((value, ix) => (0, exports.convertPairBorrowingFee)(value, pairOi[ix]));
|
|
27
|
-
exports.convertPairBorrowingFees = convertPairBorrowingFees;
|
|
28
|
-
const convertGroupBorrowingFee = (group, groupFeeExponent) => ({
|
|
29
|
-
oiLong: parseFloat(group.oiLong.toString()) / 1e10,
|
|
30
|
-
oiShort: parseFloat(group.oiShort.toString()) / 1e10,
|
|
31
|
-
feePerBlock: group.feePerBlock / 1e10,
|
|
32
|
-
accFeeLong: parseFloat(group.accFeeLong.toString()) / 1e10,
|
|
33
|
-
accFeeShort: parseFloat(group.accFeeShort.toString()) / 1e10,
|
|
34
|
-
accLastUpdatedBlock: group.accLastUpdatedBlock,
|
|
35
|
-
lastAccBlockWeightedMarketCap: parseFloat(group.lastAccBlockWeightedMarketCap.toString()) / 1e40,
|
|
36
|
-
maxOi: parseFloat(group.maxOi.toString()) / 1e10,
|
|
37
|
-
feeExponent: groupFeeExponent,
|
|
38
|
-
});
|
|
39
|
-
exports.convertGroupBorrowingFee = convertGroupBorrowingFee;
|
|
40
|
-
const convertGroupBorrowingFees = ([groups, groupFeeExponents]) => groups.map((value, ix) => (0, exports.convertGroupBorrowingFee)(value, groupFeeExponents[ix]));
|
|
41
|
-
exports.convertGroupBorrowingFees = convertGroupBorrowingFees;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertGroupBorrowingFees = exports.convertGroupBorrowingFee = exports.convertPairBorrowingFees = exports.convertPairBorrowingFee = exports.convertPairGroupBorrowingFee = void 0;
|
|
4
|
+
const convertPairGroupBorrowingFee = (pairGroup) => ({
|
|
5
|
+
groupIndex: pairGroup.groupIndex,
|
|
6
|
+
initialAccFeeLong: parseFloat(pairGroup.initialAccFeeLong.toString()) / 1e10,
|
|
7
|
+
initialAccFeeShort: parseFloat(pairGroup.initialAccFeeShort.toString()) / 1e10,
|
|
8
|
+
prevGroupAccFeeLong: parseFloat(pairGroup.prevGroupAccFeeLong.toString()) / 1e10,
|
|
9
|
+
prevGroupAccFeeShort: parseFloat(pairGroup.prevGroupAccFeeShort.toString()) / 1e10,
|
|
10
|
+
pairAccFeeLong: parseFloat(pairGroup.pairAccFeeLong.toString()) / 1e10,
|
|
11
|
+
pairAccFeeShort: parseFloat(pairGroup.pairAccFeeShort.toString()) / 1e10,
|
|
12
|
+
block: pairGroup.block,
|
|
13
|
+
});
|
|
14
|
+
exports.convertPairGroupBorrowingFee = convertPairGroupBorrowingFee;
|
|
15
|
+
const convertPairBorrowingFee = (pair, pairOi) => ({
|
|
16
|
+
feePerBlock: pair.feePerBlock / 1e10,
|
|
17
|
+
accFeeLong: parseFloat(pair.accFeeLong.toString()) / 1e10,
|
|
18
|
+
accFeeShort: parseFloat(pair.accFeeShort.toString()) / 1e10,
|
|
19
|
+
accLastUpdatedBlock: pair.accLastUpdatedBlock,
|
|
20
|
+
lastAccBlockWeightedMarketCap: parseFloat(pair.lastAccBlockWeightedMarketCap.toString()) / 1e40,
|
|
21
|
+
groups: pair.groups.map(value => (0, exports.convertPairGroupBorrowingFee)(value)),
|
|
22
|
+
feeExponent: pair.feeExponent,
|
|
23
|
+
maxOi: parseFloat(pairOi.max.toString()) / 1e10,
|
|
24
|
+
});
|
|
25
|
+
exports.convertPairBorrowingFee = convertPairBorrowingFee;
|
|
26
|
+
const convertPairBorrowingFees = ([pairs, pairOi]) => pairs.map((value, ix) => (0, exports.convertPairBorrowingFee)(value, pairOi[ix]));
|
|
27
|
+
exports.convertPairBorrowingFees = convertPairBorrowingFees;
|
|
28
|
+
const convertGroupBorrowingFee = (group, groupFeeExponent) => ({
|
|
29
|
+
oiLong: parseFloat(group.oiLong.toString()) / 1e10,
|
|
30
|
+
oiShort: parseFloat(group.oiShort.toString()) / 1e10,
|
|
31
|
+
feePerBlock: group.feePerBlock / 1e10,
|
|
32
|
+
accFeeLong: parseFloat(group.accFeeLong.toString()) / 1e10,
|
|
33
|
+
accFeeShort: parseFloat(group.accFeeShort.toString()) / 1e10,
|
|
34
|
+
accLastUpdatedBlock: group.accLastUpdatedBlock,
|
|
35
|
+
lastAccBlockWeightedMarketCap: parseFloat(group.lastAccBlockWeightedMarketCap.toString()) / 1e40,
|
|
36
|
+
maxOi: parseFloat(group.maxOi.toString()) / 1e10,
|
|
37
|
+
feeExponent: groupFeeExponent,
|
|
38
|
+
});
|
|
39
|
+
exports.convertGroupBorrowingFee = convertGroupBorrowingFee;
|
|
40
|
+
const convertGroupBorrowingFees = ([groups, groupFeeExponents]) => groups.map((value, ix) => (0, exports.convertGroupBorrowingFee)(value, groupFeeExponents[ix]));
|
|
41
|
+
exports.convertGroupBorrowingFees = convertGroupBorrowingFees;
|