From 80e9bd1f5a167a5c7c76b2d61919aa163664076d Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Sat, 09 May 2026 13:45:40 +0800
Subject: [PATCH] fix(trade): 修复止盈订单数量设置和日志记录问题
---
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 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 5f83aea..7bc38fa 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -122,6 +122,12 @@
this.initialPrincipal = new BigDecimal(account.getTotal());
log.info("[Gate] 初始本金: {} USDT", initialPrincipal);
+ //设置持仓模式为双向持仓
+ Boolean inDualMode = account.getInDualMode();
+ if (!inDualMode) {
+ futuresApi.setDualModeCall(SETTLE,true,null);
+ }
+
if (!config.getPositionMode().equals(account.getPositionMode())) {
futuresApi.setPositionMode(SETTLE, config.getPositionMode());
}
@@ -375,7 +381,9 @@
min = min.multiply(BigDecimal.ONE.subtract(step)).setScale(1, RoundingMode.HALF_UP);
shortPriceQueue.add(min);
}
- shortPriceQueue.sort((a, b) -> b.compareTo(a));
+ shortPriceQueue.sort(BigDecimal::compareTo);
+
+ log.info("[Gate] 空队列:{}", shortPriceQueue);
}
synchronized (longPriceQueue) {
@@ -384,6 +392,8 @@
while (longPriceQueue.size() > config.getGridQueueSize()) {
longPriceQueue.remove(longPriceQueue.size() - 1);
}
+
+ log.info("[Gate] 多队列:{}", shortPriceQueue);
}
}
@@ -418,6 +428,8 @@
longPriceQueue.add(max);
}
longPriceQueue.sort(BigDecimal::compareTo);
+
+ log.info("[Gate] 多队列:{}", shortPriceQueue);
}
synchronized (shortPriceQueue) {
@@ -426,6 +438,8 @@
while (shortPriceQueue.size() > config.getGridQueueSize()) {
shortPriceQueue.remove(shortPriceQueue.size() - 1);
}
+
+ log.info("[Gate] 空队列:{}", shortPriceQueue);
}
}
--
Gitblit v1.9.1