Administrator
2026-06-06 d6f40e6fa650201180d1af8ec11fee6b45d18828
fix(gateApi): 修复网格交易止损单数量配置问题

- 根据基础数量配置动态计算空仓止损订单数量
- 根据基础数量配置动态计算多仓止损订单数量
- 更新日志信息显示实际止损单范围而非固定值
- 移除硬编码的止损单数量限制(原为2~11和-2~-11)
- 通过配置参数控制止损单循环次数
- 确保止损单数量与基础配置保持一致
1 files modified
9 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -928,7 +928,8 @@
            baseGridElement.setShortOrderId(baseShortTraderParam.getEntryOrderId());
            baseGridElement.setHasShortOrder(true);
            for (int id = 2; id <= 11; id++) {
            int shortTime = Integer.parseInt(config.getBaseQuantity()) + 1;
            for (int id = 2; id <= shortTime; id++) {
                GridElement elem = GridElement.findById(id);
                if (elem == null) {
                    continue;
@@ -948,7 +949,9 @@
                );
            }
            for (int id = -2; id >= -11; id--) {
            int longTime = Integer.parseInt(config.getBaseQuantity()) + 1;
            for (int id = -2; id >= -longTime; id--) {
                GridElement elem = GridElement.findById(id);
                if (elem == null) {
                    continue;
@@ -968,7 +971,7 @@
                );
            }
            log.info("[Gate] 止损单已全部挂完, 空仓止损: 2~11, 多仓止损: -2~-11");
            log.info("[Gate] 止损单已全部挂完, 空仓止损: 2~{}, 多仓止损: -2~-{}", shortTime, longTime);
            state = StrategyState.ACTIVE;
        }
    }