@gainsnetwork/sdk 1.0.0-rc1 → 1.0.0-rc2
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.
|
@@ -18,7 +18,7 @@ exports.transformGlobalTradingVariables = void 0;
|
|
|
18
18
|
const converter_1 = require("./converter");
|
|
19
19
|
const trade_1 = require("../../trade");
|
|
20
20
|
const transformGlobalTradingVariables = (rawData) => {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
22
22
|
const globalTradingVariables = {
|
|
23
23
|
collaterals: (0, converter_1.convertCollaterals)(rawData.collaterals),
|
|
24
24
|
pairs: (0, converter_1.convertTradingPairs)(rawData.pairs),
|
|
@@ -47,11 +47,11 @@ const transformGlobalTradingVariables = (rawData) => {
|
|
|
47
47
|
: [],
|
|
48
48
|
feeTiers: (0, converter_1.convertFeeTiers)(rawData.feeTiers),
|
|
49
49
|
liquidationParams: {
|
|
50
|
-
groups: ((_c = rawData.liquidationParams) === null || _c === void 0 ? void 0 : _c.groups.map(liqParams => (0, trade_1.convertLiquidationParams)(liqParams))) || [],
|
|
51
|
-
pairs: ((
|
|
50
|
+
groups: ((_d = (_c = rawData.liquidationParams) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.map(liqParams => (0, trade_1.convertLiquidationParams)(liqParams))) || [],
|
|
51
|
+
pairs: ((_f = (_e = rawData.liquidationParams) === null || _e === void 0 ? void 0 : _e.pairs) === null || _f === void 0 ? void 0 : _f.map(liqParams => (0, trade_1.convertLiquidationParams)(liqParams))) || [],
|
|
52
52
|
},
|
|
53
53
|
counterTradeSettings: (0, trade_1.convertCounterTradeSettingsArray)(rawData.counterTradeSettings),
|
|
54
|
-
pairFactors: ((
|
|
54
|
+
pairFactors: ((_h = (_g = rawData.pairInfos) === null || _g === void 0 ? void 0 : _g.pairFactors) === null || _h === void 0 ? void 0 : _h.map(factor => (0, converter_1.convertPairFactor)(factor))) || [],
|
|
55
55
|
globalTradeFeeParams: rawData.globalTradeFeeParams
|
|
56
56
|
? (0, converter_1.convertGlobalTradeFeeParams)(rawData.globalTradeFeeParams)
|
|
57
57
|
: undefined,
|
|
@@ -60,7 +60,7 @@ const transformGlobalTradingVariables = (rawData) => {
|
|
|
60
60
|
const currentBlock = (rawData.currentBlock > -1 && rawData.currentBlock) || undefined;
|
|
61
61
|
const l1BlockNumber = (rawData.currentL1Block > -1 && rawData.currentL1Block) || undefined;
|
|
62
62
|
const pairIndexes = {};
|
|
63
|
-
for (let i = 0; i < ((
|
|
63
|
+
for (let i = 0; i < ((_j = rawData.pairs) === null || _j === void 0 ? void 0 : _j.length); i++) {
|
|
64
64
|
pairIndexes[rawData.pairs[i].from + "/" + rawData.pairs[i].to] = i;
|
|
65
65
|
}
|
|
66
66
|
if (globalTradingVariables.collaterals !== undefined) {
|
|
@@ -63,9 +63,9 @@ const getPairHoldingFeeRates = (input) => {
|
|
|
63
63
|
let currentBorrowingRatePerSecondP = 0;
|
|
64
64
|
if (borrowingParams && borrowingData) {
|
|
65
65
|
currentBorrowingRatePerSecondP = borrowingParams.borrowingRatePerSecondP;
|
|
66
|
-
// Borrowing rate * seconds per hour
|
|
66
|
+
// Borrowing rate * seconds per hour / 100
|
|
67
67
|
borrowingFeeHourlyRate =
|
|
68
|
-
(currentBorrowingRatePerSecondP * SECONDS_PER_HOUR
|
|
68
|
+
(currentBorrowingRatePerSecondP * SECONDS_PER_HOUR) /
|
|
69
69
|
PERCENTAGE_PRECISION;
|
|
70
70
|
}
|
|
71
71
|
// Total holding fees (funding can be negative/positive, borrowing always positive cost)
|