From db026d855da7b0be0c3f5bad5cfbc5a5c84c2009 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Thu, 21 May 2026 20:59:14 +0800
Subject: [PATCH] chore(gateApi): 注释掉调试日志和相关参数调用
---
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java | 44 +++++++++++++++++++++++++++++---------------
1 files changed, 29 insertions(+), 15 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 b3354d1..028c22c 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -342,6 +342,16 @@
lastKlinePrice = closePrice;
updateUnrealizedPnl();
if (state == StrategyState.STOPPED) {
+ try {
+ futuresApi.cancelPriceTriggeredOrderList(SETTLE, config.getContract());
+ } catch (ApiException e) {
+ e.printStackTrace();
+ }
+ closeExistingPositions();
+
+ BigDecimal totalPnl = cumulativePnl.add(unrealizedPnl);
+ log.info("[Gate] 已实现:{}, 未实现:{}, 合计:{}",
+ cumulativePnl, unrealizedPnl, totalPnl);
return;
}
@@ -517,13 +527,17 @@
return;
}
cumulativePnl = cumulativePnl.add(pnl);
- log.info("[Gate] 盈亏累加:{}, 方向:{}, 累计:{}", pnl, side, cumulativePnl);
+ BigDecimal totalPnl = cumulativePnl.add(unrealizedPnl);
+ log.info("[Gate] 已实现:{}, 未实现:{}, 合计:{}",
+ cumulativePnl, unrealizedPnl, totalPnl);
- if (cumulativePnl.compareTo(config.getOverallTp()) >= 0) {
- log.info("[Gate] 已达止盈目标 {}→已停止", cumulativePnl);
+ if (totalPnl.compareTo(config.getOverallTp()) >= 0) {
+ log.info("[Gate] 已达止盈目标(合计{})→已停止, 已实现:{}, 未实现:{}",
+ totalPnl, cumulativePnl, unrealizedPnl);
state = StrategyState.STOPPED;
- } else if (cumulativePnl.compareTo(config.getMaxLoss().negate()) <= 0) {
- log.info("[Gate] 已达亏损上限 {}→已停止", cumulativePnl);
+ } else if (totalPnl.compareTo(config.getMaxLoss().negate()) <= 0) {
+ log.info("[Gate] 已达亏损上限(合计{})→已停止, 已实现:{}, 未实现:{}",
+ totalPnl, cumulativePnl, unrealizedPnl);
state = StrategyState.STOPPED;
}
}
@@ -676,11 +690,11 @@
null,
false
);
- longEntryTraderIdParam(
- byLongTakeProfitOrderId,
- null,
- false
- );
+// longEntryTraderIdParam(
+// byLongTakeProfitOrderId,
+// null,
+// false
+// );
}
GridElement byShortTakeProfitOrderId = GridElement.findByShortTakeProfitOrderId(orderId);
if (byShortTakeProfitOrderId != null){
@@ -689,11 +703,11 @@
null,
false
);
- shortEntryTraderIdParam(
- byShortTakeProfitOrderId,
- null,
- false
- );
+// shortEntryTraderIdParam(
+// byShortTakeProfitOrderId,
+// null,
+// false
+// );
}
/**
--
Gitblit v1.9.1