From b36c1dce0f4bea07346a560dc9aed5c49697ef38 Mon Sep 17 00:00:00 2001 From: discountry Date: Wed, 8 Oct 2025 20:00:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96Paradex=E7=BD=91?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E8=AE=A2=E5=8D=95=E9=87=91=E9=A2=9D=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D=E5=9C=A8?= =?UTF-8?q?=E5=B9=B3=E4=BB=93=E6=97=B6=E4=BB=85=E5=AF=B9=E5=B8=82=E5=9C=BA?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=9C=81=E7=95=A5=E9=87=91=E9=A2=9D=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/exchanges/paradex/gateway.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/exchanges/paradex/gateway.ts b/src/exchanges/paradex/gateway.ts index 5c63594..d222c66 100644 --- a/src/exchanges/paradex/gateway.ts +++ b/src/exchanges/paradex/gateway.ts @@ -586,8 +586,8 @@ export class ParadexGateway { } } - // Quantize to exchange precision if helper is available - if (!isClosePosition && typeof (this.exchange as any).amountToPrecision === "function" && Number.isFinite(Number(amount))) { + // Quantize to exchange precision if helper is available (safe for STOP orders) + if (typeof (this.exchange as any).amountToPrecision === "function" && Number.isFinite(Number(amount))) { amount = Number((this.exchange as any).amountToPrecision(symbol, amount)); } } catch (_normalizeError) { @@ -596,9 +596,9 @@ export class ParadexGateway { try { const isClosePosition = (extraParams as any).closePosition === true; - // When closePosition is true, many exchanges (incl. Paradex) accept omitting amount - // and will close the entire position. Passing a larger min amount may violate reduceOnly. - const amountArg: any = isClosePosition ? undefined : amount; + // Only omit amount for MARKET close-position orders; STOP requires explicit size + const shouldOmitAmount = isClosePosition && type === "market"; + const amountArg: any = shouldOmitAmount ? undefined : amount; const order = (await this.exchange.createOrder( symbol, type,