From dbe8df6934a22aee1457916adaee0eb182bdb79b Mon Sep 17 00:00:00 2001 From: discountry Date: Wed, 8 Oct 2025 19:55:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=B9=B3=E4=BB=93?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86=E8=AE=A2=E5=8D=95=E6=95=B0=E9=87=8F=E5=B9=B6?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BA=A4=E6=98=93=E6=89=80=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=95=B4=E4=B8=AA=E4=BB=93=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/order-coordinator.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/order-coordinator.ts b/src/core/order-coordinator.ts index aa81965..b3adb80 100644 --- a/src/core/order-coordinator.ts +++ b/src/core/order-coordinator.ts @@ -338,12 +338,16 @@ export async function marketClose( if (isOperating(locks, type)) return; if (!enforceMarkPriceGuard(side, guard?.expectedPrice ?? null, guard, log, "市价平仓")) return; const qtyStep = opts?.qtyStep ?? 0.001; + const roundedQty = roundQtyDownToStep(quantity, qtyStep); + const safeQty = roundedQty > 0 ? roundedQty : quantity; const params: CreateOrderParams = { symbol, side, type, - quantity: roundQtyDownToStep(quantity, qtyStep), + quantity: safeQty, reduceOnly: "true", + // Hint exchanges (like Paradex) to close the whole position and tolerate omitted size + closePosition: "true", }; await deduplicateOrders(adapter, symbol, openOrders, locks, timers, pendings, type, side, log); lockOperating(locks, timers, pendings, type, log);