Administrator
2025-12-19 7e2bea36ff56e4fb2ce462ea556ea62469b99de6
src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxQuantWebSocketClient.java
@@ -31,8 +31,6 @@
 */
@Slf4j
public class OkxQuantWebSocketClient {
    private final WangGeService wangGeService;
    private final CaoZuoService caoZuoService;
    private final RedisUtils redisUtils;
    private final ExchangeInfoEnum account;
@@ -45,11 +43,25 @@
    private final AtomicBoolean isConnected = new AtomicBoolean(false);
    private final AtomicBoolean isConnecting = new AtomicBoolean(false);
    
    public OkxQuantWebSocketClient(ExchangeInfoEnum account, WangGeService wangGeService,
                                   CaoZuoService caoZuoService, RedisUtils redisUtils) {
    /**
     * 获取WebSocketClient实例
     * @return WebSocketClient实例
     */
    public WebSocketClient getWebSocketClient() {
        return webSocketClient;
    }
    /**
     * 获取账号名称
     * @return 账号名称
     */
    public String getAccountName() {
        return account.name();
    }
    public OkxQuantWebSocketClient(ExchangeInfoEnum account,
                                   RedisUtils redisUtils) {
        this.account = account;
        this.wangGeService = wangGeService;
        this.caoZuoService = caoZuoService;
        this.redisUtils = redisUtils;
    }
@@ -174,7 +186,6 @@
        
        try {
            InstrumentsWs.handleEvent(account.name());
            wangGeService.initWangGe();
            SSLConfig.configureSSL();
            System.setProperty("https.protocols", "TLSv1.2,TLSv1.3");
            String WS_URL = WS_URL_MONIPAN;
@@ -373,8 +384,8 @@
            OrderInfoWs.handleEvent(response, redisUtils, account.name());
        }else if (AccountWs.ACCOUNTWS_CHANNEL.equals(channel)) {
            AccountWs.handleEvent(response, account.name());
            String side = caoZuoService.caoZuo(account.name());
            TradeOrderWs.orderEvent(webSocketClient, side, account.name());
//            String side = caoZuoService.caoZuo(account.name());
//            TradeOrderWs.orderEvent(webSocketClient, side, account.name());
        } else if (PositionsWs.POSITIONSWS_CHANNEL.equals(channel)) {
            PositionsWs.handleEvent(response, account.name());
        } else if (BalanceAndPositionWs.CHANNEL_NAME.equals(channel)) {
@@ -474,7 +485,7 @@
        }
        
        int attempt = 0;
        int maxAttempts = 5;
        int maxAttempts = 3;
        long delayMs = 1000;
        while (attempt < maxAttempts && !isConnected.get()) {