Fix position

This commit is contained in:
2025-04-25 01:16:48 +07:00
parent af89121c40
commit 6c385ea309
4 changed files with 18 additions and 16 deletions

View File

@@ -357,7 +357,7 @@ export class Orders extends Module {
skipSimulation: true,
indexToken: marketInfo.indexToken,
tokensData,
autoCancel: autoCancelOrdersLimit > 0,
autoCancel: autoCancelOrdersLimit > 0
});
}

View File

@@ -161,7 +161,7 @@ export const openGmxPositionImpl = async (
allowedSlippageBps: 100, // 1% slippage
leverage: leverageBps,
skipSimulation: true,
limitPrice: limitPrice,
limitPrice: null,
referralCodeForTxn: encodeReferralCode("kaigen_ai"),
stopLossPrice: stopLossPrice ? numberToBigint(stopLossPrice, 30) : undefined,
takeProfitPrice: takeProfitPrice ? numberToBigint(takeProfitPrice, 30) : undefined
@@ -440,7 +440,7 @@ export const closeGmxPositionImpl = async (
sizeDeltaInTokens: position.sizeInTokens,
collateralDeltaUsd: position.remainingCollateralAmount,
collateralDeltaAmount: position.remainingCollateralAmount,
acceptablePriceDeltaBps: 0n,
acceptablePriceDeltaBps: 30n,
recommendedAcceptablePriceDeltaBps: 0n,
estimatedPnl: 0n,
estimatedPnlPercentage: 0n,
@@ -464,7 +464,7 @@ export const closeGmxPositionImpl = async (
indexPrice: 0n,
collateralPrice: 0n,
acceptablePrice: position.markPrice,
triggerOrderType: OrderType.MarketDecrease,
triggerOrderType: OrderType.LimitDecrease,
triggerPrice: position.markPrice,
}
@@ -475,7 +475,7 @@ export const closeGmxPositionImpl = async (
marketsInfoData,
tokensData,
isLong: direction === TradeDirection.Short,
allowedSlippage: 0,
allowedSlippage: 30,
decreaseAmounts,
collateralToken: position.marketInfo.shortToken,
referralCodeForTxn: encodeReferralCode("kaigen_ai"),