| | |
| | | |
| | | 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; |
| | |
| | | private CaoZuoService caoZuoService; |
| | | @Autowired |
| | | private RedisUtils redisUtils; |
| | | @Autowired |
| | | private WangGeListService wangGeListService; |
| | | |
| | | // 存储所有OkxQuantWebSocketClient实例,key为账号类型名称 |
| | | private final Map<String, OkxQuantWebSocketClient> quantClientMap = new ConcurrentHashMap<>(); |
| | |
| | | |
| | | // 初始化价格WebSocket客户端 |
| | | try { |
| | | newPriceClient = new OkxNewPriceWebSocketClient(redisUtils, caoZuoService, this); |
| | | newPriceClient = new OkxNewPriceWebSocketClient(redisUtils, caoZuoService, this, wangGeListService); |
| | | newPriceClient.init(); |
| | | log.info("已初始化OkxNewPriceWebSocketClient"); |
| | | } catch (Exception e) { |
| | |
| | | // 为每个账号创建一个WebSocket客户端实例 |
| | | for (ExchangeInfoEnum account : accounts) { |
| | | try { |
| | | OkxQuantWebSocketClient client = new OkxQuantWebSocketClient(account, redisUtils); |
| | | OkxQuantWebSocketClient client = new OkxQuantWebSocketClient(account, redisUtils, caoZuoService, wangGeListService); |
| | | quantClientMap.put(account.name(), client); |
| | | client.init(); |
| | | log.info("已初始化账号 {} 的WebSocket客户端", account.name()); |