Administrator
2026-07-16 96f0ecb8b2cfc6e69e9a951cd494852fe42bcc9f
fix(gateApi): 修复网格交易中订单数量计算逻辑

- 移除对取消网格元素的依赖,直接基于累积损失计数计算数量
- 将买单数量计算改为 (accumulatedLongLossCount + 1) * quantity
- 将卖单数量计算改为 (accumulatedShortLossCount + 1) * quantity
- 消除对基础数量配置的依赖,统一使用配置的数量参数
- 简化数量获取逻辑,提高代码可读性
1 files modified
8 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java 8 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -1204,9 +1204,7 @@
                    if (newEntryGrid != null) {
                        GridElement cancelGridElement = GridElement.findById(newEntryGrid.getUpId());
                        String quantity = cancelGridElement != null
                                ? cancelGridElement.getLongTraderParam().getQuantity()
                                : config.getBaseQuantity();
                        String quantity = String.valueOf((accumulatedLongLossCount + 1) * Integer.parseInt(config.getQuantity()));
                        if (cancelGridElement != null && cancelGridElement.isHasLongOrder()) {
                            for (String longOrderId : new ArrayList<>(cancelGridElement.getLongOrderIds())) {
                                executor.cancelConditionalOrder(longOrderId, oid -> {
@@ -1256,9 +1254,7 @@
                        GridElement cancelGridElement = GridElement.findById(newEntryGrid.getDownId());
                        String quantity = cancelGridElement != null
                                ? cancelGridElement.getShortTraderParam().getQuantity()
                                : config.getBaseQuantity();
                        String quantity = String.valueOf((accumulatedShortLossCount + 1) * Integer.parseInt(config.getQuantity()));
                        /**
                         * 看是否有空仓挂单,有就取消
                         */