@strkfarm/sdk 2.0.0-dev.3 → 2.0.0-dev.4
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.
|
@@ -92555,11 +92555,12 @@ spurious results.`);
|
|
|
92555
92555
|
logger2.error(`error getting extended position: extendedHoldings=${extendedHoldings}, latestPosition=${latestPosition}`);
|
|
92556
92556
|
return null;
|
|
92557
92557
|
}
|
|
92558
|
-
const positionValueInUSD = latestPosition.value;
|
|
92558
|
+
const positionValueInUSD = new Web3Number(latestPosition.value, USDC_TOKEN_DECIMALS);
|
|
92559
92559
|
const equity = extendedHoldings.data.equity;
|
|
92560
|
-
const deposit =
|
|
92561
|
-
return new Web3Number(
|
|
92560
|
+
const deposit = positionValueInUSD.dividedBy(extended_leverage).minus(equity).toFixed(2);
|
|
92561
|
+
return new Web3Number(deposit, USDC_TOKEN_DECIMALS);
|
|
92562
92562
|
} catch (err2) {
|
|
92563
|
+
logger2.error(`error calculating amount deposit on extended when incurring losses: ${err2}`);
|
|
92563
92564
|
return null;
|
|
92564
92565
|
}
|
|
92565
92566
|
};
|
package/dist/index.browser.mjs
CHANGED
|
@@ -28526,11 +28526,12 @@ var calculateAmountDepositOnExtendedWhenIncurringLosses = async (client) => {
|
|
|
28526
28526
|
logger.error(`error getting extended position: extendedHoldings=${extendedHoldings}, latestPosition=${latestPosition}`);
|
|
28527
28527
|
return null;
|
|
28528
28528
|
}
|
|
28529
|
-
const positionValueInUSD = latestPosition.value;
|
|
28529
|
+
const positionValueInUSD = new Web3Number(latestPosition.value, USDC_TOKEN_DECIMALS);
|
|
28530
28530
|
const equity = extendedHoldings.data.equity;
|
|
28531
|
-
const deposit =
|
|
28532
|
-
return new Web3Number(
|
|
28531
|
+
const deposit = positionValueInUSD.dividedBy(extended_leverage).minus(equity).toFixed(2);
|
|
28532
|
+
return new Web3Number(deposit, USDC_TOKEN_DECIMALS);
|
|
28533
28533
|
} catch (err) {
|
|
28534
|
+
logger.error(`error calculating amount deposit on extended when incurring losses: ${err}`);
|
|
28534
28535
|
return null;
|
|
28535
28536
|
}
|
|
28536
28537
|
};
|
package/dist/index.js
CHANGED
|
@@ -28343,11 +28343,12 @@ var calculateAmountDepositOnExtendedWhenIncurringLosses = async (client) => {
|
|
|
28343
28343
|
logger.error(`error getting extended position: extendedHoldings=${extendedHoldings}, latestPosition=${latestPosition}`);
|
|
28344
28344
|
return null;
|
|
28345
28345
|
}
|
|
28346
|
-
const positionValueInUSD = latestPosition.value;
|
|
28346
|
+
const positionValueInUSD = new Web3Number(latestPosition.value, USDC_TOKEN_DECIMALS);
|
|
28347
28347
|
const equity = extendedHoldings.data.equity;
|
|
28348
|
-
const deposit =
|
|
28349
|
-
return new Web3Number(
|
|
28348
|
+
const deposit = positionValueInUSD.dividedBy(extended_leverage).minus(equity).toFixed(2);
|
|
28349
|
+
return new Web3Number(deposit, USDC_TOKEN_DECIMALS);
|
|
28350
28350
|
} catch (err) {
|
|
28351
|
+
logger.error(`error calculating amount deposit on extended when incurring losses: ${err}`);
|
|
28351
28352
|
return null;
|
|
28352
28353
|
}
|
|
28353
28354
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -28201,11 +28201,12 @@ var calculateAmountDepositOnExtendedWhenIncurringLosses = async (client) => {
|
|
|
28201
28201
|
logger.error(`error getting extended position: extendedHoldings=${extendedHoldings}, latestPosition=${latestPosition}`);
|
|
28202
28202
|
return null;
|
|
28203
28203
|
}
|
|
28204
|
-
const positionValueInUSD = latestPosition.value;
|
|
28204
|
+
const positionValueInUSD = new Web3Number(latestPosition.value, USDC_TOKEN_DECIMALS);
|
|
28205
28205
|
const equity = extendedHoldings.data.equity;
|
|
28206
|
-
const deposit =
|
|
28207
|
-
return new Web3Number(
|
|
28206
|
+
const deposit = positionValueInUSD.dividedBy(extended_leverage).minus(equity).toFixed(2);
|
|
28207
|
+
return new Web3Number(deposit, USDC_TOKEN_DECIMALS);
|
|
28208
28208
|
} catch (err) {
|
|
28209
|
+
logger.error(`error calculating amount deposit on extended when incurring losses: ${err}`);
|
|
28209
28210
|
return null;
|
|
28210
28211
|
}
|
|
28211
28212
|
};
|
package/package.json
CHANGED
|
@@ -309,12 +309,12 @@ export const calculateAmountDepositOnExtendedWhenIncurringLosses = async (
|
|
|
309
309
|
logger.error(`error getting extended position: extendedHoldings=${extendedHoldings}, latestPosition=${latestPosition}`);
|
|
310
310
|
return null;
|
|
311
311
|
}
|
|
312
|
-
const positionValueInUSD = latestPosition.value;
|
|
312
|
+
const positionValueInUSD = new Web3Number(latestPosition.value, USDC_TOKEN_DECIMALS);
|
|
313
313
|
const equity = extendedHoldings.data.equity;
|
|
314
|
-
const deposit =
|
|
315
|
-
|
|
316
|
-
return new Web3Number(Math.floor(deposit / 0.2) * 0.2, USDC_TOKEN_DECIMALS);
|
|
314
|
+
const deposit = positionValueInUSD.dividedBy(extended_leverage).minus(equity).toFixed(2);
|
|
315
|
+
return new Web3Number(deposit, USDC_TOKEN_DECIMALS);
|
|
317
316
|
} catch (err) {
|
|
317
|
+
logger.error(`error calculating amount deposit on extended when incurring losses: ${err}`);
|
|
318
318
|
return null;
|
|
319
319
|
}
|
|
320
320
|
};
|