Administrator
2025-12-13 03da5e83f4d7ad60bab3223079ecfd0dc06e4c9c
src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/PositionsWs.java
@@ -41,6 +41,12 @@
        }
    }
    public static void initEvent(JSONObject response) {
        log.info("订阅成功,数据初始化: {}", response.getJSONObject("arg"));
        JSONObject arg = response.getJSONObject("arg");
        initParam(arg);
    }
    public static void handleEvent(JSONObject response) {
@@ -50,7 +56,7 @@
            if (dataArray == null || dataArray.isEmpty()) {
                log.info("账户持仓频道数据为空,已当前价买入,并且初始化网格");
                JSONObject posData = new JSONObject();
                processPositionData(posData);
                initParam(posData);
                return;
            }
@@ -91,7 +97,7 @@
                            markPx
                    );
                    processPositionData(posData);
                    initParam(posData);
                }
            }
        } catch (Exception e) {
@@ -99,7 +105,7 @@
        }
    }
    private static void processPositionData(JSONObject posData) {
    private static void initParam(JSONObject posData) {
        WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "avgPx", WsMapBuild.parseBigDecimalSafe(posData.getString("avgPx")));
        WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "pos", WsMapBuild.parseBigDecimalSafe(posData.getString("pos")));
        WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "upl", WsMapBuild.parseBigDecimalSafe(posData.getString("upl")));
@@ -109,5 +115,6 @@
        WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "bePx", WsMapBuild.parseBigDecimalSafe(posData.getString("bePx")));
        WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, "realizedPnl", WsMapBuild.parseBigDecimalSafe(posData.getString("realizedPnl")));
        WsMapBuild.saveBigDecimalToMap(POSITIONSWSMAP, CoinEnums.READY_STATE.name(), WsMapBuild.parseBigDecimalSafe(CoinEnums.READY_STATE_YES.getCode()));
    }
}