Administrator
2026-05-19 7491d19c0412712080f23c389eb2f1bfa2924e09
src/main/java/com/xcong/excoin/modules/gateApi/GateWebSocketClientManager.java
@@ -1,9 +1,11 @@
package com.xcong.excoin.modules.gateApi;
import com.xcong.excoin.modules.gateApi.wsHandler.handler.AutoOrdersChannelHandler;
import com.xcong.excoin.modules.gateApi.wsHandler.handler.CandlestickChannelHandler;
import com.xcong.excoin.modules.gateApi.wsHandler.handler.OrdersChannelHandler;
import com.xcong.excoin.modules.gateApi.wsHandler.handler.PositionClosesChannelHandler;
import com.xcong.excoin.modules.gateApi.wsHandler.handler.PositionsChannelHandler;
import com.xcong.excoin.modules.gateApi.wsHandler.handler.UserTradesChannelHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -61,6 +63,7 @@
                    .overallTp(new BigDecimal("5"))
                    .maxLoss(new BigDecimal("15"))
                    .quantity("1")
                    .priceScale(1)
                    .contractMultiplier(new BigDecimal("0.01"))
                    .unrealizedPnlPriceMode(GateConfig.PnLPriceMode.LAST_PRICE)
                    .isProduction(false)
@@ -97,8 +100,12 @@
                    config.getApiKey(), config.getApiSecret(), config.getContract(), gridTradeService));
            wsClient.addChannelHandler(new OrdersChannelHandler(
                    config.getApiKey(), config.getApiSecret(), config.getContract(), gridTradeService));
            wsClient.addChannelHandler(new UserTradesChannelHandler(
                    config.getApiKey(), config.getApiSecret(), config.getContract(), gridTradeService));
            wsClient.addChannelHandler(new AutoOrdersChannelHandler(
                    config.getApiKey(), config.getApiSecret(), config.getContract(), gridTradeService));
            wsClient.init();
            log.info("[管理器] WS已连接, 已注册 4 个频道处理器");
            log.info("[管理器] WS已连接, 已注册 6 个频道处理器");
            // 3. 激活策略,等待首根 K 线触发基底双开
            gridTradeService.startGrid();