| | |
| | | * 销毁方法,在 Spring Bean 销毁前执行。 |
| | | * 关闭 WebSocket 连接、停止心跳定时器及相关的线程资源。 |
| | | */ |
| | | // @PreDestroy |
| | | // public void destroy() { |
| | | // if (webSocketClient != null && webSocketClient.isOpen()) { |
| | | // subscribeAccountChannel(UNSUBSCRIBE); |
| | | // subscribePositionChannel(UNSUBSCRIBE); |
| | | // subscribeOrderInfoChannel(UNSUBSCRIBE); |
| | | // webSocketClient.close(); |
| | | // } |
| | | // shutdownExecutorGracefully(heartbeatExecutor); |
| | | // if (pongTimeoutFuture != null) { |
| | | // pongTimeoutFuture.cancel(true); |
| | | // } |
| | | // shutdownExecutorGracefully(sharedExecutor); |
| | | // |
| | | // // 移除了 reconnectScheduler 的关闭操作 |
| | | // } |
| | | @PreDestroy |
| | | public void destroy() { |
| | | log.info("开始销毁OkxQuantWebSocketClient"); |
| | |
| | | AccountWs.handleEvent(response, account.name()); |
| | | } else if (PositionsWs.POSITIONSWS_CHANNEL.equals(channel)) { |
| | | |
| | | List<TradeRequestParam> tradeRequestParams = PositionsWs.handleEvent(response, account.name()); |
| | | TradeOrderWs.orderZhiSunEvent(webSocketClient, tradeRequestParams); |
| | | PositionsWs.handleEvent(response, account.name()); |
| | | } else if (BalanceAndPositionWs.CHANNEL_NAME.equals(channel)) { |
| | | |
| | | BalanceAndPositionWs.handleEvent(response); |