Administrator
2026-05-28 b3b9edaf5eb570a899ce90d05310f6a1aef11807
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -731,7 +731,7 @@
                    null,
                    false
            );
//            TPonUserTradeShortEntry(byShortTakeProfitOrderId);
            TPonUserTradeShortEntry(byShortTakeProfitOrderId);
        }
        GridElement byLongTakeProfitOrderId = GridElement.findByLongTakeProfitOrderId(orderId);
        if (byLongTakeProfitOrderId != null){
@@ -745,7 +745,7 @@
                    null,
                    false
            );
//            TPonUserTradeLongEntry(byLongTakeProfitOrderId);
            TPonUserTradeLongEntry(byLongTakeProfitOrderId);
        }
        /**
@@ -806,43 +806,20 @@
        if (!isMarginSafe()) {
            log.warn("[Gate] 保证金超限,跳过挂条件单");
        } else {
            /**
             * 下一个开仓位置
             *      获取队列第一个元素的价格对应的网格
             *      判断网格是否能开空仓,如果不能则跳过
             *      前进方向挂空仓条件单
             *      后置方向挂多空条件单
             */
            //下一个开仓位置
            BigDecimal gridPrice = gridElement.getGridPrice();
            // 判断网格是否能开空仓,如果不能则跳过
            if (gridElement != null) {
                TraderParam downShortTraderParam = gridElement.getShortTraderParam();
            // 判断网格是否能开多仓,如果不能则跳过
            GridElement upGridElement = GridElement.findById(gridElement.getUpId());
            if (upGridElement != null){
                BigDecimal upGridPrice = upGridElement.getGridPrice();
                TraderParam downLongTraderParam = upGridElement.getLongTraderParam();
                if (
                        !gridElement.isHasShortOrder() &&
                                gridPrice.compareTo(longEntryPrice) <= 0 &&
                                gridPrice.compareTo(shortEntryPrice) >= 0
                        !upGridElement.isHasLongOrder() &&
                                upGridPrice.compareTo(longEntryPrice) <= 0
                ){
                    placeEntryOrderWithPreFlag(gridElement, false,
                            downShortTraderParam.getEntryPrice(),
                            FuturesPriceTrigger.RuleEnum.NUMBER_1,
                            negate(downShortTraderParam.getQuantity()));
                }
                TraderParam downLongTraderParam = gridElement.getLongTraderParam();
                if (
                        !gridElement.isHasLongOrder() &&
                                gridPrice.compareTo(longEntryPrice) <= 0
                ){
                    placeEntryOrderWithPreFlag(gridElement, true,
                    placeEntryOrderWithPreFlag(upGridElement, true,
                            downLongTraderParam.getEntryPrice(),
                            FuturesPriceTrigger.RuleEnum.NUMBER_1,
                            downLongTraderParam.getQuantity());
                }
            }
        }
    }
@@ -851,31 +828,18 @@
        if (!isMarginSafe()) {
            log.warn("[Gate] 保证金超限,跳过挂条件单");
        } else {
            BigDecimal newLongFirst = gridElement.getGridPrice() ;
            // 判断网格是否能开空仓,如果不能则跳过
            GridElement downGridElement = GridElement.findById(gridElement.getDownId());
            if (downGridElement != null){
            // 判断网格是否能开多空仓,如果不能则跳过
            if (gridElement != null) {
                BigDecimal downGridPrice = downGridElement.getGridPrice();
//                TraderParam downLongTraderParam = gridElement.getLongTraderParam();
//                if (
//                        !gridElement.isHasLongOrder() &&
//                                newLongFirst.compareTo(shortEntryPrice) >= 0 &&
//                                newLongFirst.compareTo(longEntryPrice) <= 0
//                ){
//                    placeEntryOrderWithPreFlag(gridElement, true,
//                            downLongTraderParam.getEntryPrice(),
//                            FuturesPriceTrigger.RuleEnum.NUMBER_2,
//                            config.getQuantity());
//
//                }
                TraderParam shortTraderParam = gridElement.getShortTraderParam();
                TraderParam shortTraderParam = downGridElement.getShortTraderParam();
                if (
                        !gridElement.isHasShortOrder() &&
                                newLongFirst.compareTo(shortEntryPrice) >= 0
                        !downGridElement.isHasShortOrder() &&
                                downGridPrice.compareTo(shortEntryPrice) >= 0
                ){
                    placeEntryOrderWithPreFlag(gridElement, false,
                    placeEntryOrderWithPreFlag(downGridElement, false,
                            shortTraderParam.getEntryPrice(),
                            FuturesPriceTrigger.RuleEnum.NUMBER_2,
                            negate(config.getQuantity()));