Administrator
2025-12-10 6933ef2edc3911311976cfc0f077c395be510f34
src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java
@@ -24,32 +24,36 @@
    public static void orderEvent(WebSocketClient webSocketClient, RedisUtils redisUtils, String side) {
        String buyCnt = null;
        String ctval = getRedisValue(redisUtils, InstrumentsWs.INSTRUMENTSWS_CHANNEL, ":ctVal");
        String buyCntNormal = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":buyCnt");
        String pos = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":pos");
        if (OrderParamEnums.ORDERING.getValue().equals(side)) {
            return;
        } else if (OrderParamEnums.HOLDING.getValue().equals(side)) {
            return;
        } else if (OrderParamEnums.INIT.getValue().equals(side)) {
            side = OrderParamEnums.BUY.getValue();
            String buyCntNormal = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":buyCnt");
            if (StrUtil.isNotBlank(buyCntNormal) && new BigDecimal(buyCntNormal).compareTo(BigDecimal.ZERO) > 0) {
            if (StrUtil.isNotBlank(buyCntNormal) && BigDecimal.ZERO.compareTo(new BigDecimal(buyCntNormal)) > 0) {
                buyCnt = buyCntNormal;
            }else{
                buyCnt = getRedisValue(redisUtils, InstrumentsWs.INSTRUMENTSWS_CHANNEL, ":ctVal");
                buyCnt = ctval;
            }
        } else if (OrderParamEnums.OUT.getValue().equals(side)) {
            side = OrderParamEnums.SELL.getValue();
            buyCnt = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":pos");
        } else {
            if (OrderParamEnums.BUY.getValue().equals(side)){
                String buyCntNormal = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":buyCnt");
                if (StrUtil.isNotBlank(buyCntNormal)) {
            buyCnt = pos;
        } else if (OrderParamEnums.BUY.getValue().equals(side)){
            side = OrderParamEnums.BUY.getValue();
            if (StrUtil.isNotBlank(buyCntNormal) && BigDecimal.ZERO.compareTo(new BigDecimal(buyCntNormal)) > 0) {
                    buyCnt = buyCntNormal;
                }
            }else{
                buyCnt = ctval;
            }
        }else if (OrderParamEnums.SELL.getValue().equals(side)){
                side = OrderParamEnums.SELL.getValue();
                buyCnt = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":pos");
            }
        }else{
            log.warn("操作信号异常,请检查下单操作...");
            return;
        }
        // 校验必要参数