From e26b4fe8d8b76e77e051b82a81cbab1c2f3f8d6a Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Wed, 10 Dec 2025 15:07:34 +0800
Subject: [PATCH] fix(okxWs): 修复买入数量判断逻辑
---
src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java b/src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java
index e2f7ac1..2f51d39 100644
--- a/src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java
+++ b/src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/TradeOrderWs.java
@@ -23,33 +23,45 @@
public static void orderEvent(WebSocketClient webSocketClient, RedisUtils redisUtils, String side) {
- String buyCnt = null;
+ log.info("开始执行TradeOrderWs......");
+ if (StrUtil.isBlank( side)){
+ log.warn("止损了,下次再战...");
+ return;
+ }
+ String buyCnt = null;
+ String ctval = getRedisValue(redisUtils, InstrumentsWs.INSTRUMENTSWS_CHANNEL, ":ctVal");
+ String buyCntNormal = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":buyCnt");
+ String pos = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":pos");
if (OrderParamEnums.ORDERING.getValue().equals(side)) {
+ log.warn("正在下单中,等待下单结束...");
return;
} else if (OrderParamEnums.HOLDING.getValue().equals(side)) {
return;
} else if (OrderParamEnums.INIT.getValue().equals(side)) {
side = OrderParamEnums.BUY.getValue();
- String buyCntNormal = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":buyCnt");
if (StrUtil.isNotBlank(buyCntNormal) && new BigDecimal(buyCntNormal).compareTo(BigDecimal.ZERO) > 0) {
buyCnt = buyCntNormal;
}else{
- buyCnt = getRedisValue(redisUtils, InstrumentsWs.INSTRUMENTSWS_CHANNEL, ":ctVal");
+ buyCnt = ctval;
}
} else if (OrderParamEnums.OUT.getValue().equals(side)) {
+ log.info(OrderParamEnums.getNameByValue(OrderParamEnums.OUT.getValue()));
+ side = OrderParamEnums.SELL.getValue();
+ buyCnt = pos;
+ } else if (OrderParamEnums.BUY.getValue().equals(side)){
+ side = OrderParamEnums.BUY.getValue();
+ if (StrUtil.isNotBlank(buyCntNormal) && BigDecimal.ZERO.compareTo(new BigDecimal(buyCntNormal)) > 0) {
+ buyCnt = buyCntNormal;
+ }else{
+ buyCnt = ctval;
+ }
+ }else if (OrderParamEnums.SELL.getValue().equals(side)){
side = OrderParamEnums.SELL.getValue();
buyCnt = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":pos");
- } else {
- if (OrderParamEnums.BUY.getValue().equals(side)){
- String buyCntNormal = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":buyCnt");
- if (StrUtil.isNotBlank(buyCntNormal)) {
- buyCnt = buyCntNormal;
- }
- }else{
- side = OrderParamEnums.SELL.getValue();
- buyCnt = getRedisValue(redisUtils, PositionsWs.POSITIONSWS_CHANNEL, ":pos");
- }
+ }else{
+ log.warn("操作信号异常,请检查下单操作...");
+ return;
}
// 校验必要参数
--
Gitblit v1.9.1