Administrator
7 days ago 464dc564e9dce18bee16f81792833fa885a48166
src/main/java/com/xcong/excoin/modules/okxApi/OkxGridTradeService.java
@@ -614,24 +614,6 @@
            baseGridElement.setShortOrderId(baseShortTraderParam.getEntryOrderId());
            baseGridElement.setHasShortOrder(true);
            // 挂基座止盈
            {
                BigDecimal tpPrice = baseGridElement.getGridPrice().add(config.getStep());
                executor.placeTakeProfit(tpPrice, "close_long", config.getBaseQuantity(),
                        profitId -> {
                            longTakeProfitTraderIdParam(baseGridElement, profitId, true);
                            log.info("[OKX] 基座多仓止盈已挂, gridId:0, 触发价:{}, tpId:{}", tpPrice, profitId);
                        });
            }
            {
                BigDecimal tpPrice = baseGridElement.getGridPrice().subtract(config.getStep());
                executor.placeTakeProfit(tpPrice, "close_short", config.getBaseQuantity(),
                        profitId -> {
                            shortTakeProfitTraderIdParam(baseGridElement, profitId, true);
                            log.info("[OKX] 基座空仓止盈已挂, gridId:0, 触发价:{}, tpId:{}", tpPrice, profitId);
                        });
            }
            // 挂初始止损
            int stopCount = Integer.parseInt(config.getBaseQuantity()) / Integer.parseInt(config.getQuantity()) + 1;
            for (int id = 2; id <= stopCount; id++) {
@@ -663,20 +645,6 @@
                        });
            }
            log.info("[OKX] 止损单已全部挂完, 空仓止损: 2~{}, 多仓止损: -2~-{}", stopCount, stopCount);
            // 挂初始条件开仓单
            GridElement longFirst = GridElement.findById(1);
            if (longFirst != null && !longFirst.isHasLongOrder()) {
                BigDecimal triggerPrice = longFirst.getGridPrice();
                log.info("[OKX] 挂初始多仓条件单, gridId:1, trigger:{}", triggerPrice);
                placeEntryOrderWithPreFlag(longFirst, true, triggerPrice, config.getBaseQuantity());
            }
            GridElement shortFirst = GridElement.findById(-1);
            if (shortFirst != null && !shortFirst.isHasShortOrder()) {
                BigDecimal triggerPrice = shortFirst.getGridPrice();
                log.info("[OKX] 挂初始空仓条件单, gridId:-1, trigger:{}", triggerPrice);
                placeEntryOrderWithPreFlag(shortFirst, false, triggerPrice, negate(config.getBaseQuantity()));
            }
            state = StrategyState.ACTIVE;
        }