Administrator
2025-12-10 bede2aecbc1f3ce5d607081eec64d4cb2ab31b03
feat(okxWs): 添加账户和持仓WebSocket更新间隔配置

- 在AccountWs中新增updateInterval参数,支持定时推送数据
- 在CoinEnums中新增UPDATEINTERVAL枚举,定义推送时间间隔
- 调整PositionsWs中的参数结构,统一使用extraParams传递更新间隔
- 设置默认更新间隔为2000毫秒,提高数据推送频率
- 优化WebSocket连接参数配置逻辑,增强可维护性
3 files modified
16 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/AccountWs.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/PositionsWs.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/enums/CoinEnums.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/AccountWs.java
@@ -53,6 +53,9 @@
            JSONObject args = new JSONObject();
            args.put("channel", ACCOUNTWS_CHANNEL);
            args.put(CCY_KEY, CoinEnums.USDT.getCode());
            JSONObject updateInterval = new JSONObject();
            updateInterval.put("updateInterval",CoinEnums.UPDATEINTERVAL.getCode());
            args.put("extraParams", updateInterval);
            argsArray.add(args);
            String connId = MallUtils.getOrderNum(ACCOUNTWS_CHANNEL);
src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/PositionsWs.java
@@ -33,8 +33,8 @@
            args.put("instType", CoinEnums.INSTTYPE_SWAP.getCode());
            args.put("instId", CoinEnums.HE_YUE.getCode());
            JSONObject updateInterval = new JSONObject();
            updateInterval.put("updateInterval","2000");
            args.put("updateInterval", updateInterval);
            updateInterval.put("updateInterval",CoinEnums.UPDATEINTERVAL.getCode());
            args.put("extraParams", updateInterval);
            argsArray.add(args);
            String connId = MallUtils.getOrderNum(POSITIONSWS_CHANNEL);
src/main/java/com/xcong/excoin/modules/okxNewPrice/okxWs/enums/CoinEnums.java
@@ -8,6 +8,15 @@
@Getter
public enum CoinEnums {
    /**
     * 0: 仅根据持仓事件推送数据
     * 2000, 3000, 4000: 根据持仓事件推送,且根据设置的时间间隔定时推送(ms)
     *
     * 若不添加该字段或将其设置为上述合法值以外的其他值,数据将根据事件推送并大约每 5 秒定期推送一次
     */
    UPDATEINTERVAL("2000",
            "2000"),
    ORDER_FILLED("filled",
            "filled"),