From ec7a3e6d2bd050f89047079d2c1d71e8f51e0c47 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 12 Dec 2025 14:49:24 +0800
Subject: [PATCH] fix(okxNewPrice): 优化订单信息处理逻辑

---
 src/main/java/com/xcong/excoin/modules/okxNewPrice/celue/CaoZuoServiceImpl.java |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/okxNewPrice/celue/CaoZuoServiceImpl.java b/src/main/java/com/xcong/excoin/modules/okxNewPrice/celue/CaoZuoServiceImpl.java
index 8258f37..3a42d27 100644
--- a/src/main/java/com/xcong/excoin/modules/okxNewPrice/celue/CaoZuoServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/okxNewPrice/celue/CaoZuoServiceImpl.java
@@ -105,17 +105,18 @@
             }
         }
 
-        if (PositionsWs.POSITIONSWSMAP.get("imr") == null){
+        if (PositionsWs.POSITIONSWSMAP.get("pos") == null){
             log.error("没有获取到持仓信息,等待初始化......");
             return null;
         }
-        BigDecimal ordFrozImr = PositionsWs.POSITIONSWSMAP.get("imr");
-        if (BigDecimal.ZERO.compareTo( ordFrozImr) >= 0) {
-            log.error("占用保证金为零,进行初始化订单");
+        BigDecimal pos = PositionsWs.POSITIONSWSMAP.get("pos");
+        if (BigDecimal.ZERO.compareTo( pos) >= 0) {
+            log.error("持仓数量为零,进行初始化订单");
             WsMapBuild.saveStringToMap(InstrumentsWs.INSTRUMENTSWSMAP, CoinEnums.STATE.name(), OrderParamEnums.STATE_4.getValue());
             return OrderParamEnums.INIT.getValue();
         }
         // 判断是否保证金超标
+        BigDecimal ordFrozImr = PositionsWs.POSITIONSWSMAP.get("imr");
         BigDecimal totalOrderUsdt = WsMapBuild.parseBigDecimalSafe(AccountWs.ACCOUNTWSMAP.get(CoinEnums.TOTAL_ORDER_USDT.name()));
         if (ordFrozImr.compareTo(totalOrderUsdt) >= 0){
             log.error("已满仓......");
@@ -148,7 +149,6 @@
                 DescBigDecimal kaiCang = queueKaiCang.peek();
                 if (kaiCang != null && markPx.compareTo(kaiCang.getValue()) <= 0 && avgPx.compareTo(kaiCang.getValue()) >= 0) {
                     log.info("开始加仓...开仓队列价格大于当前价格{}>{}", kaiCang.getValue(), markPx);
-                    WsMapBuild.saveStringToMap(OrderInfoWs.ORDERINFOWSMAP, "orderPrice",String.valueOf(kaiCang.getValue()));
                     WsMapBuild.saveStringToMap(InstrumentsWs.INSTRUMENTSWSMAP, CoinEnums.STATE.name(), OrderParamEnums.STATE_4.getValue());
                     return OrderParamEnums.BUY.getValue();
                 } else {
@@ -165,7 +165,6 @@
                 AscBigDecimal pingCang = queuePingCang.peek();
                 if (pingCang != null && markPx.compareTo(pingCang.getValue()) >= 0 && avgPx.compareTo(pingCang.getValue()) < 0) {
                     log.info("开始减仓...平仓队列价格小于当前价格{}<={}", pingCang.getValue(), markPx);
-                    WsMapBuild.saveStringToMap(OrderInfoWs.ORDERINFOWSMAP, "orderPrice",String.valueOf(pingCang.getValue()));
 
                     // 判断当前是否盈利
                     BigDecimal uplValue = PositionsWs.POSITIONSWSMAP.get("upl");

--
Gitblit v1.9.1