From 1b55621d4dcf3b4ee6b9c4beb81ad69e5b7a5856 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 05 Jun 2026 17:58:08 +0800
Subject: [PATCH] refactor(okxNewPrice): 优化止损管理器的挂单数量计算逻辑
---
src/main/java/com/xcong/excoin/modules/okxNewPrice/gridWs/OkxPositionsChannelHandler.java | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/okxNewPrice/gridWs/OkxPositionsChannelHandler.java b/src/main/java/com/xcong/excoin/modules/okxNewPrice/gridWs/OkxPositionsChannelHandler.java
index 41aac08..2a77f76 100644
--- a/src/main/java/com/xcong/excoin/modules/okxNewPrice/gridWs/OkxPositionsChannelHandler.java
+++ b/src/main/java/com/xcong/excoin/modules/okxNewPrice/gridWs/OkxPositionsChannelHandler.java
@@ -20,12 +20,10 @@
private static final String CHANNEL_NAME = "positions";
private final String instId;
- private final String instFamily;
private final OkxGridTradeService gridTradeService;
public OkxPositionsChannelHandler(String instId, OkxGridTradeService gridTradeService) {
this.instId = instId;
- this.instFamily = instId.contains("-") ? instId.substring(0, instId.lastIndexOf("-")) : instId;
this.gridTradeService = gridTradeService;
}
@@ -38,13 +36,20 @@
JSONObject arg = new JSONObject();
arg.put("channel", CHANNEL_NAME);
arg.put("instType", "SWAP");
- arg.put("instFamily", instFamily);
msg.put("op", "subscribe");
JSONArray args = new JSONArray();
args.add(arg);
msg.put("args", args);
ws.send(msg.toJSONString());
- log.info("[OKX-WS] {} 订阅成功, instFamily:{}", CHANNEL_NAME, instFamily);
+ log.info("[OKX-WS] {} 订阅成功", CHANNEL_NAME);
+ }
+
+ @Override
+ public void onSubscribed() {
+ log.info("[OKX-WS] {} 订阅确认", CHANNEL_NAME);
+ if (gridTradeService != null) {
+ gridTradeService.onSubscriptionConfirmed(CHANNEL_NAME);
+ }
}
@Override
@@ -53,7 +58,6 @@
JSONObject arg = new JSONObject();
arg.put("channel", CHANNEL_NAME);
arg.put("instType", "SWAP");
- arg.put("instFamily", instFamily);
msg.put("op", "unsubscribe");
JSONArray args = new JSONArray();
args.add(arg);
--
Gitblit v1.9.1