Administrator
2026-05-26 fe567e81a50a00beb1a26f70e69e923ecb3d6bb3
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -426,14 +426,19 @@
                    tryGenerateQueues();
                }else {
                    longPositionSize = size;
                    //取消多仓位线以上的开空仓挂单
                    List<GridElement> allShortOrders = GridElement.findAllShortOrders(longEntryPrice);
                    List<GridElement> allShortOrders = GridElement.findAllLongOrders(longEntryPrice);
                    if (CollUtil.isNotEmpty(allShortOrders)){
                        GridElement keep = allShortOrders.stream()
                                .max((a, b) -> a.getGridPrice().compareTo(b.getGridPrice()))
                                .orElse(null);
                        for (GridElement e : allShortOrders) {
                            if (e == keep) {
                                continue;
                            }
                            executor.cancelConditionalOrder(
                                    e.getShortOrderId(),
                                    e.getLongOrderId(),
                                    orderId -> {
                                        shortEntryTraderIdParam(
                                        longEntryTraderIdParam(
                                                e,
                                                null,
                                                false
@@ -441,11 +446,11 @@
                                    }
                            );
                            if (e.getShortTakeProfitOrderId() != null){
                            if (e.getLongTakeProfitOrderId() != null){
                                executor.cancelConditionalOrder(
                                        e.getShortTakeProfitOrderId(),
                                        e.getLongTakeProfitOrderId(),
                                        orderId -> {
                                            shortTakeProfitTraderIdParam(
                                            longTakeProfitTraderIdParam(
                                                    e,
                                                    null,
                                                    false
@@ -472,25 +477,30 @@
                    tryGenerateQueues();
                }else {
                    shortPositionSize = size.abs();
                    //取消空仓仓位线以下的开多仓挂单
                    List<GridElement> allLongOrders = GridElement.findAllLongOrders(shortEntryPrice);
                    List<GridElement> allLongOrders = GridElement.findAllShortOrders(shortEntryPrice);
                    if (CollUtil.isNotEmpty(allLongOrders)){
                        GridElement keep = allLongOrders.stream()
                                .min((a, b) -> a.getGridPrice().compareTo(b.getGridPrice()))
                                .orElse(null);
                        for (GridElement e : allLongOrders) {
                            if (e == keep) {
                                continue;
                            }
                            executor.cancelConditionalOrder(
                                    e.getLongOrderId(),
                                    e.getShortOrderId(),
                                    orderId -> {
                                        longEntryTraderIdParam(
                                        shortEntryTraderIdParam(
                                                e,
                                                null,
                                                false
                                        );
                                    }
                            );
                            if (e.getLongTakeProfitOrderId() != null){
                            if (e.getShortTakeProfitOrderId() != null){
                                executor.cancelConditionalOrder(
                                        e.getLongTakeProfitOrderId(),
                                        e.getShortTakeProfitOrderId(),
                                        orderId -> {
                                            longTakeProfitTraderIdParam(
                                            shortTakeProfitTraderIdParam(
                                                    e,
                                                    null,
                                                    false