Administrator
yesterday 900c9b20cca19df60d14b9ea61d336ba640250f0
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -305,17 +305,20 @@
            if (hasPosition) {
                longActive = true;
                longEntryPrice = entryPrice;
                longPositionSize = size;
                if (!baseLongOpened) {
                    longPositionSize = size;
                    longBaseEntryPrice = entryPrice;
                    baseLongOpened = true;
                    log.info("[Gate] 基底多成交价: {}", longBaseEntryPrice);
                    tryGenerateQueues();
                } else {
                } else if (size.compareTo(longPositionSize) > 0) {
                    longPositionSize = size;
                    BigDecimal tpPrice = entryPrice.multiply(BigDecimal.ONE.add(config.getGridRate())).setScale(1, RoundingMode.HALF_UP);
                    executor.placeTakeProfit(tpPrice,
                            FuturesPriceTrigger.RuleEnum.NUMBER_1, ORDER_TYPE_CLOSE_LONG, negate(config.getQuantity()));
                    log.info("[Gate] 多单止盈已设, entry:{}, tp:{}, size:{}", entryPrice, tpPrice, negate(config.getQuantity()));
                } else {
                    longPositionSize = size;
                }
            } else {
                longActive = false;
@@ -325,17 +328,20 @@
            if (hasPosition) {
                shortActive = true;
                shortEntryPrice = entryPrice;
                shortPositionSize = size.abs();
                if (!baseShortOpened) {
                    shortPositionSize = size.abs();
                    shortBaseEntryPrice = entryPrice;
                    baseShortOpened = true;
                    log.info("[Gate] 基底空成交价: {}", shortBaseEntryPrice);
                    tryGenerateQueues();
                } else {
                } else if (size.abs().compareTo(shortPositionSize) > 0) {
                    shortPositionSize = size.abs();
                    BigDecimal tpPrice = entryPrice.multiply(BigDecimal.ONE.subtract(config.getGridRate())).setScale(1, RoundingMode.HALF_UP);
                    executor.placeTakeProfit(tpPrice,
                            FuturesPriceTrigger.RuleEnum.NUMBER_2, ORDER_TYPE_CLOSE_SHORT, config.getQuantity());
                    log.info("[Gate] 空单止盈已设, entry:{}, tp:{}, size:{}", entryPrice, tpPrice, config.getQuantity());
                } else {
                    shortPositionSize = size.abs();
                }
            } else {
                shortActive = false;