@gainsnetwork/sdk 0.0.0-v10.rc23 → 0.0.0-v10.rc24
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.
|
@@ -101,7 +101,7 @@ exports.getLiquidationPrice = getLiquidationPrice;
|
|
|
101
101
|
const getLiquidationPriceAfterPositionUpdate = (existingTrade, newCollateralAmount, newLeverage, isLeverageUpdate, positionSizeCollateralDelta, pnlToRealizeCollateral, context) => {
|
|
102
102
|
var _a, _b;
|
|
103
103
|
const { currentPairPrice, isCounterTrade = false } = context.liquidationSpecific;
|
|
104
|
-
// 1. Calculate closing fees on the
|
|
104
|
+
// 1. Calculate closing fees on the new position size
|
|
105
105
|
const closingFeeCollateral = (0, __1.getTotalTradeFeesCollateral)(existingTrade.collateralIndex, "", // No fee tiers applied for liquidation calculation
|
|
106
106
|
existingTrade.pairIndex, newCollateralAmount * newLeverage, isCounterTrade, {
|
|
107
107
|
fee: context.trading.fee,
|
|
@@ -131,10 +131,10 @@ const getLiquidationPriceAfterPositionUpdate = (existingTrade, newCollateralAmou
|
|
|
131
131
|
let additionalFeeCollateral;
|
|
132
132
|
let partialCloseMultiplier;
|
|
133
133
|
if (isIncrease) {
|
|
134
|
-
// For position increases: use additional fees from context (e.g., opening fees)
|
|
134
|
+
// For position increases: use additional fees from context (e.g., opening fees)
|
|
135
135
|
additionalFeeCollateral =
|
|
136
136
|
context.liquidationSpecific.additionalFeeCollateral || 0;
|
|
137
|
-
partialCloseMultiplier =
|
|
137
|
+
partialCloseMultiplier = 1; // Set to 1
|
|
138
138
|
}
|
|
139
139
|
else if (isLeverageUpdate) {
|
|
140
140
|
// For leverage decreases: additional fee includes closing fee minus PnL to realize
|