From 49d5d4f3b8885e62bf273707e3cab8eb8441af83 Mon Sep 17 00:00:00 2001 From: discountry Date: Fri, 26 Sep 2025 23:35:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E8=B6=8B=E5=8A=BF=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BC=98=E5=8C=96=E6=AD=A2?= =?UTF-8?q?=E6=8D=9F=E5=A4=84=E7=90=86=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=BB=93=E6=9E=9C=E5=AF=B9=E8=B1=A1=E4=BB=A5=E6=8C=87?= =?UTF-8?q?=E7=A4=BA=E5=B9=B3=E4=BB=93=E7=8A=B6=E6=80=81=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E4=BA=A4=E6=98=93=E7=AD=96=E7=95=A5=E7=9A=84=E5=8F=AF?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA=E6=80=A7=E5=92=8C=E7=A8=B3=E5=AE=9A=E6=80=A7?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/trend-engine.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/trend-engine.ts b/src/core/trend-engine.ts index e97eed0..a940750 100644 --- a/src/core/trend-engine.ts +++ b/src/core/trend-engine.ts @@ -579,6 +579,7 @@ export class TrendEngine { ); if (derivedLoss || snapshotLoss) { + const result = { closed: false, pnl }; try { if (this.openOrders.length > 0) { const orderIdList = this.openOrders.map((order) => order.orderId); @@ -636,6 +637,7 @@ export class TrendEngine { }, { qtyStep: this.config.qtyStep } ); + result.closed = true; this.tradeLog.push("close", `止损平仓: ${direction === "long" ? "SELL" : "BUY"}`); // 记录止损时间以便短期内抑制再次入场 this.lastStopLossAt = Date.now(); @@ -645,8 +647,9 @@ export class TrendEngine { } else { this.tradeLog.push("error", `止损平仓失败: ${String(err)}`); } + return result; } - return { closed: true, pnl }; + return result; } return { closed: false, pnl };