From 9eed388bf3c07dc0ea24fb0637b4964c8e387437 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 22 Dec 2025 16:45:43 +0800
Subject: [PATCH] fix(symbols): 修复K线数据获取逻辑

---
 src/main/java/com/xcong/excoin/modules/newPrice/utils/OKXContants.java |  185 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 185 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/newPrice/utils/OKXContants.java b/src/main/java/com/xcong/excoin/modules/newPrice/utils/OKXContants.java
new file mode 100644
index 0000000..6e211ad
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/newPrice/utils/OKXContants.java
@@ -0,0 +1,185 @@
+package com.xcong.excoin.modules.newPrice.utils;
+
+public class OKXContants {
+    /**
+     * 获取交易产品基础信息
+     * 获取所有可交易产品的信息列表。
+     * <br><br>
+     * GET /api/v5/public/instruments
+     * <br>
+     *
+     * @param parameters LinkedHashedMap of String,Object pair
+     *                   where String is the name of the parameter and Object is the value of the parameter
+     *                   <br><br>
+     *                   instType	-- String	是	产品类型 SPOT:币币 MARGIN:币币杠杆 SWAP:永续合约 FUTURES:交割合约 OPTION:期权 <br>
+     *                   uly      -- String	可选	标的指数,仅适用于交割/永续/期权,期权必填 <br>
+     *                   instFamily -- String	否	交易品种,仅适用于交割/永续/期权 <br>
+     *                   instId -- String	否	产品ID <br>
+     * @return String
+     * @see <a href="https://www.okx.com/docs-v5/zh/#rest-api-public-data-get-instruments">
+     * https://www.okx.com/docs-v5/zh/#rest-api-public-data-get-instruments</a>
+     */
+    public static final String INSTRUMENTS = "/api/v5/public/instruments";
+    public static final String K_LINE_HISTORY = "/api/v5/market/history-candles";
+//    public static final String K_LINE_HISTORY = "/api/v5/market/history-mark-price-candles";
+    /**
+     * 查看账户余额
+     * 获取交易账户中资金余额信息。
+     * <br><br>
+     * GET /api/v5/account/balance
+     * <br>
+     * @param
+     * parameters LinkedHashedMap of String,Object pair
+     *            where String is the name of the parameter and Object is the value of the parameter
+     * <br><br>
+     * ccy -- String	否	币种,如 BTC 支持多币种查询(不超过20个),币种之间半角逗号分隔 <br>
+     * @return String
+     * @see <a href="https://www.okx.com/docs-v5/zh/#rest-api-account-get-balance">
+     *     https://www.okx.com/docs-v5/zh/#rest-api-account-get-balance</a>
+     */
+    public static final String BALANCE = "/api/v5/account/balance";
+    /**
+     * 查看持仓信息
+     * 获取该账户下拥有实际持仓的信息。账户为单向持仓模式会显示净持仓(net),账户为双向持仓模式下会分别返回多头(long)或空头(short)的仓位。按照仓位创建时间倒序排列。
+     * <br><br>
+     * GET /api/v5/account/positions
+     * <br>
+     * @param
+     * parameters LinkedHashedMap of String,Object pair
+     *            where String is the name of the parameter and Object is the value of the parameter
+     * <br><br>
+     * instType -- String	否	产品类型
+     * MARGIN:币币杠杆
+     * SWAP:永续合约
+     * FUTURES:交割合约
+     * OPTION:期权
+     * instType和instId同时传入的时候会校验instId与instType是否一致。<br>
+     * instId -- String	否	交易产品ID,如:BTC-USD-190927-5000-C
+     * 支持多个instId查询(不超过10个),半角逗号分隔<br>
+     * posId --	String	否	持仓ID
+     * 支持多个posId查询(不超过20个),半角逗号分割<br>
+     * @return String <br>
+     * note: 如果该 instId 拥有过仓位且当前持仓量为0,传 instId 时,会返回仓位信息;不传 instId 时,仓位信息不返回。
+     *  逐仓交易设置中,如果设置为自主划转模式,逐仓转入保证金后,会生成一个持仓量为0的仓位 <br>
+     * @see <a href="https://www.okx.com/docs-v5/zh/#rest-api-account-get-positions">
+     *     https://www.okx.com/docs-v5/zh/#rest-api-account-get-positions</a>
+     */
+    public static final String POSITIONS = "/api/v5/account/positions";
+    /**
+     * 查看历史持仓信息
+     * 获取最近3个月有更新的仓位信息,按照仓位更新时间倒序排列。
+     * <br><br>
+     * GET /api/v5/account/positions-history
+     * <br>
+     * @param
+     * parameters LinkedHashedMap of String,Object pair
+     *            where String is the name of the parameter and Object is the value of the parameter
+     * <br><br>
+     * instType -- String	否	产品类型
+     * MARGIN:币币杠杆
+     * SWAP:永续合约
+     * FUTURES:交割合约
+     * OPTION:期权 <br>
+     * instId -- String	否	交易产品ID,如:BTC-USD-SWAP <br>
+     * mgnMode -- String	否	保证金模式
+     * cross:全仓,isolated:逐仓
+     * type -- String	否	平仓类型
+     * 1:部分平仓;2:完全平仓;3:强平;4:强减; 5:ADL自动减仓;
+     * 状态叠加时,以最新的平仓类型为准状态为准。 <br>
+     * posId --	String	否	持仓ID <br>
+     * after --	String	否	查询仓位更新 (uTime) 之前的内容,值为时间戳,Unix 时间戳为毫秒数格式,如 1597026383085 <br>
+     * before -- String	否	查询仓位更新 (uTime) 之后的内容,值为时间戳,Unix 时间戳为毫秒数格式,如 1597026383085 <br>
+     * limit --	String	否	分页返回结果的数量,最大为100,默认100条 <br>
+     * @return String
+     * @see <a href="https://www.okx.com/docs-v5/zh/#rest-api-account-get-positions-history">
+     *     https://www.okx.com/docs-v5/zh/#rest-api-account-get-positions-history</a>
+     */
+    public static final String POSITIONS_HISTORY = "/api/v5/account/positions-history";
+    /**
+     * 撤单
+     * 撤销之前下的未完成订单。
+     *
+     * <br><br>
+     * GET /api/v5/trade/cancel-order
+     * <br>
+     *
+     * @param parameters LinkedHashedMap of String,Object pair
+     *                   where String is the name of the parameter and Object is the value of the parameter
+     *                   <br><br>
+     *                   instId -- String	是	产品ID,如 BTC-USD-190927 <br>
+     *                   ordId --	String	可选	订单ID, ordId和clOrdId必须传一个,若传两个,以ordId为主 <br>
+     *                   clOrdId -- String	可选	用户自定义ID <br>
+     * @return String
+     * @see <a href="https://www.okx.com/docs-v5/zh/#rest-api-trade-cancel-order">
+     * https://www.okx.com/docs-v5/zh/#rest-api-trade-cancel-order</a>
+     */
+    public static final String CANCEL_ORDER = "/api/v5/trade/cancel-order";
+    /**
+     * 下单
+     * 只有当您的账户有足够的资金才能下单。
+     *
+     * <br><br>
+     * GET /api/v5/trade/order
+     * <br>
+     *
+     * @param parameters LinkedHashedMap of String,Object pair
+     *                   where String is the name of the parameter and Object is the value of the parameter
+     *                   <br><br>
+     *                   instId -- String	是	产品ID,如 BTC-USD-190927-5000-C <br>
+     *                   tdMode -- String	是	交易模式
+     *                   保证金模式:isolated:逐仓 ;cross:全仓
+     *                   非保证金模式:cash:非保证金 <br>
+     *                   ccy -- String	否	保证金币种,仅适用于单币种保证金模式下的全仓杠杆订单 <br>
+     *                   clOrdId -- String	否	客户自定义订单ID
+     *                   字母(区分大小写)与数字的组合,可以是纯字母、纯数字且长度要在1-32位之间。<br>
+     *                   tag -- String	否	订单标签
+     *                   字母(区分大小写)与数字的组合,可以是纯字母、纯数字,且长度在1-16位之间。 <br>
+     *                   side -- String	是	订单方向
+     *                   buy:买, sell:卖 <br>
+     *                   posSide -- String	可选	持仓方向
+     *                   在双向持仓模式下必填,且仅可选择 long 或 short。 仅适用交割、永续。 <br>
+     *                   ordType -- String	是	订单类型
+     *                   market:市价单
+     *                   limit:限价单
+     *                   post_only:只做maker单
+     *                   fok:全部成交或立即取消
+     *                   ioc:立即成交并取消剩余
+     *                   optimal_limit_ioc:市价委托立即成交并取消剩余(仅适用交割、永续) <br>
+     *                   sz -- String	是	委托数量 <br>
+     *                   px -- String	可选	委托价格,仅适用于limit、post_only、fok、ioc类型的订单 <br>
+     *                   reduceOnly -- Boolean	否	是否只减仓,true 或 false,默认false
+     *                   仅适用于币币杠杆,以及买卖模式下的交割/永续
+     *                   仅适用于单币种保证金模式和跨币种保证金模式 <br>
+     *                   tgtCcy -- String	否	市价单委托数量sz的单位,仅适用于币币市价订单
+     *                   base_ccy: 交易货币 ;quote_ccy:计价货币
+     *                   买单默认quote_ccy, 卖单默认base_ccy <br>
+     *                   banAmend -- Boolean	否	是否禁止币币市价改单,true 或 false,默认false
+     *                   为true时,余额不足时,系统不会改单,下单会失败,仅适用于币币市价单 <br>
+     *                   tpTriggerPx -- String	否	止盈触发价,如果填写此参数,必须填写 止盈委托价 <br>
+     *                   tpOrdPx -- String	否	止盈委托价,如果填写此参数,必须填写 止盈触发价
+     *                   委托价格为-1时,执行市价止盈 <br>
+     *                   slTriggerPx -- String	否	止损触发价,如果填写此参数,必须填写 止损委托价 <br>
+     *                   slOrdPx -- String	否	止损委托价,如果填写此参数,必须填写 止损触发价
+     *                   委托价格为-1时,执行市价止损 <br>
+     *                   tpTriggerPxType -- String	否	止盈触发价类型
+     *                   last:最新价格
+     *                   index:指数价格
+     *                   mark:标记价格
+     *                   默认为last <br>
+     *                   slTriggerPxType -- String	否	止损触发价类型
+     *                   last:最新价格
+     *                   index:指数价格
+     *                   mark:标记价格
+     *                   默认为last <br>
+     * @return String
+     * @see <a href="https://www.okx.com/docs-v5/zh/#rest-api-trade-place-order">
+     * https://www.okx.com/docs-v5/zh/#rest-api-trade-place-order</a>
+     */
+    public static final String ORDER = "/api/v5/trade/order";
+
+    /**
+     * 获取币种价格信息
+     */
+    public static final String TICKER = "/api/v5/market/ticker";
+
+}

--
Gitblit v1.9.1