From 24bd0399d73a2d48e50233326fca7d9526f06259 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 29 Dec 2025 14:15:59 +0800
Subject: [PATCH] refactor(trading): 重构MACD策略交易信号生成逻辑

---
 src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java
index be64554..c00f893 100644
--- a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java
+++ b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxWebSocketClientManager.java
@@ -3,8 +3,6 @@
 import com.xcong.excoin.modules.okxNewPrice.celue.CaoZuoService;
 import com.xcong.excoin.modules.okxNewPrice.okxWs.enums.ExchangeInfoEnum;
 import com.xcong.excoin.modules.okxNewPrice.okxWs.wanggeList.WangGeListService;
-import com.xcong.excoin.modules.okxNewPrice.wangge.WangGeService;
-import com.xcong.excoin.rabbit.pricequeue.WebsocketPriceService;
 import com.xcong.excoin.utils.RedisUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,7 +32,8 @@
     private final Map<String, OkxQuantWebSocketClient> quantClientMap = new ConcurrentHashMap<>();
     
     // 存储OkxNewPriceWebSocketClient实例
-    private OkxNewPriceWebSocketClient newPriceClient;
+    private OkxKlineWebSocketClient klinePriceClient;
+
 
     /**
      * 初始化方法,在Spring Bean构造完成后执行
@@ -46,8 +45,8 @@
         
         // 初始化价格WebSocket客户端
         try {
-            newPriceClient = new OkxNewPriceWebSocketClient(redisUtils, caoZuoService, this, wangGeListService);
-            newPriceClient.init();
+            klinePriceClient = new OkxKlineWebSocketClient(redisUtils, caoZuoService, this, wangGeListService);
+            klinePriceClient.init();
             log.info("已初始化OkxNewPriceWebSocketClient");
         } catch (Exception e) {
             log.error("初始化OkxNewPriceWebSocketClient失败", e);
@@ -59,7 +58,7 @@
         // 为每个账号创建一个WebSocket客户端实例
         for (ExchangeInfoEnum account : accounts) {
             try {
-                OkxQuantWebSocketClient client = new OkxQuantWebSocketClient(account, redisUtils);
+                OkxQuantWebSocketClient client = new OkxQuantWebSocketClient(account, caoZuoService, redisUtils);
                 quantClientMap.put(account.name(), client);
                 client.init();
                 log.info("已初始化账号 {} 的WebSocket客户端", account.name());
@@ -80,9 +79,9 @@
         log.info("开始销毁OkxWebSocketClientManager");
         
         // 关闭价格WebSocket客户端
-        if (newPriceClient != null) {
+        if (klinePriceClient != null) {
             try {
-                newPriceClient.destroy();
+                klinePriceClient.destroy();
                 log.info("已销毁OkxNewPriceWebSocketClient");
             } catch (Exception e) {
                 log.error("销毁OkxNewPriceWebSocketClient失败", e);
@@ -127,7 +126,7 @@
      * 获取OkxNewPriceWebSocketClient实例
      * @return 价格WebSocket客户端实例
      */
-    public OkxNewPriceWebSocketClient getNewPriceClient() {
-        return newPriceClient;
+    public OkxKlineWebSocketClient getKlineWebSocketClient() {
+        return klinePriceClient;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1