Administrator
2026-06-02 19ee15d053a2d239abd3ab1c7440fddd12a05af3
src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java
@@ -2,6 +2,7 @@
import com.xcong.excoin.modules.okxNewPrice.gridWs.OkxAlgoOrdersChannelHandler;
import com.xcong.excoin.modules.okxNewPrice.gridWs.OkxKlineChannelHandler;
import com.xcong.excoin.modules.okxNewPrice.gridWs.OkxOrdersChannelHandler;
import com.xcong.excoin.modules.okxNewPrice.gridWs.OkxPositionsChannelHandler;
import com.xcong.excoin.modules.okxNewPrice.okxpi.config.OKXAccount;
import com.xcong.excoin.modules.okxNewPrice.okxpi.config.enums.DefaultUrls;
@@ -105,18 +106,18 @@
            gridTradeService.init();
            // 4. 创建 WS 客户端并注册频道处理器
            // 业务 WS(/v5/business):candle1m + orders-algo(K线 + 条件单)
            // 业务 WS(/v5/business):candle1m
            gridWsClientPublic = new OkxGridWsClient(primaryAccount, true);
            gridWsClientPublic.addChannelHandler(new OkxKlineChannelHandler(okxConfig.getInstId(), gridTradeService));
            gridWsClientPublic.addChannelHandler(new OkxAlgoOrdersChannelHandler(okxConfig.getInstId(), gridTradeService));
            gridWsClientPublic.init();
            // 私有 WS(/v5/private):positions(持仓)
            // 私有 WS(/v5/private):positions + orders(algo触发后订单fill带algoId可匹配)
            gridWsClientPrivate = new OkxGridWsClient(primaryAccount, false);
            gridWsClientPrivate.addChannelHandler(new OkxPositionsChannelHandler(okxConfig.getInstId(), gridTradeService));
            gridWsClientPrivate.addChannelHandler(new OkxOrdersChannelHandler(okxConfig.getInstId(), gridTradeService));
            gridWsClientPrivate.init();
            log.info("[OKX-Manager] WS已连接, business: candle1m/orders-algo, private: positions");
            log.info("[OKX-Manager] WS已连接, business: candle1m, private: positions/orders");
            // 5. 激活策略,等待首根 K 线触发基底双开
            gridTradeService.startGrid();