From 1b55621d4dcf3b4ee6b9c4beb81ad69e5b7a5856 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 05 Jun 2026 17:58:08 +0800
Subject: [PATCH] refactor(okxNewPrice): 优化止损管理器的挂单数量计算逻辑

---
 src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridTradeService.java |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridTradeService.java b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridTradeService.java
index 84a5e49..31db4aa 100644
--- a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridTradeService.java
@@ -215,6 +215,7 @@
         longPriceQueue.clear();
         currentLongOrderIds.clear();
         currentShortOrderIds.clear();
+        stopLossManager.resetAllEntryQuantities();
 
         // 每次重启重新获取当前本金,确保盈亏对比基准正确
         refreshInitialPrincipal();
@@ -432,6 +433,7 @@
         if (shortGridElement != null && shortGridElement.isHasShortOrder()) {
             int filledQty = Integer.parseInt(shortGridElement.getShortTraderParam().getQuantity());
             stopLossManager.clearShortEntryState(shortGridElement);
+            stopLossManager.resetShortEntryQty();
             stopLossManager.extendShortStopLoss(filledQty);
             log.info("[OKX] 空单成交 gridId:{}, qty:{}, 追挂止损", shortGridElement.getId(), filledQty);
             return;
@@ -440,6 +442,7 @@
         if (longGridElement != null && longGridElement.isHasLongOrder()) {
             int filledQty = Integer.parseInt(longGridElement.getLongTraderParam().getQuantity());
             stopLossManager.clearLongEntryState(longGridElement);
+            stopLossManager.resetLongEntryQty();
             stopLossManager.extendLongStopLoss(filledQty);
             log.info("[OKX] 多单成交 gridId:{}, qty:{}, 追挂止损", longGridElement.getId(), filledQty);
             return;

--
Gitblit v1.9.1