From 5c7fa04ebbe54d7bf5050c7f02d3dfadd0fbaf7d Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Tue, 19 May 2026 10:40:14 +0800
Subject: [PATCH] feat(ws): 添加订单更新ID日志记录功能

---
 src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
index 86e4763..0206cd3 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -600,6 +600,25 @@
         }
     }
 
+    /**
+     * 用户私有成交回调。由 {@link com.xcong.excoin.modules.gateApi.wsHandler.handler.UserTradesChannelHandler}
+     * 在收到 {@code futures.usertrades} 推送时调用。
+     *
+     * @param contract 合约名称
+     * @param orderId  订单 ID
+     * @param price    成交价格
+     * @param size     成交数量
+     * @param role     用户角色(maker / taker)
+     * @param fee      手续费
+     */
+    public void onUserTrade(String contract, String orderId, BigDecimal price, String size, String role, BigDecimal fee) {
+        if (state == StrategyState.STOPPED) {
+            return;
+        }
+        log.info("[Gate] 成交明细, 合约:{}, 订单ID:{}, 价格:{}, 数量:{}, 角色:{}, 手续费:{}",
+                contract, orderId, price, size, role, fee);
+    }
+
     // ---- 网格队列处理 ----
 
     /**
@@ -631,6 +650,7 @@
             GridElement baseGridElement = GridElement.findById(0);
             TraderParam baseLongTraderParam = config.getBaseLongTraderParam();
             baseGridElement.setLongOrderId(baseLongTraderParam.getEntryOrderId());
+            baseGridElement.setHasLongOrder(true);
             //0位置的网格的多单止盈
             BigDecimal upTakeProfitPrice = baseGridElement.getLongTraderParam().getTakeProfitPrice();
             executor.placeTakeProfit(
@@ -649,6 +669,7 @@
             //0位置的网格的空单止盈
             TraderParam baseShortTraderParam = config.getBaseShortTraderParam();
             baseGridElement.setShortOrderId(baseShortTraderParam.getEntryOrderId());
+            baseGridElement.setHasShortOrder(true);
             BigDecimal downTakeProfitPrice = baseGridElement.getShortTraderParam().getTakeProfitPrice();
             executor.placeTakeProfit(
                     downTakeProfitPrice,

--
Gitblit v1.9.1