package com.xcong.excoin.modules.newPrice.utils; public class OKXContants { /** * 获取交易产品基础信息 * 获取所有可交易产品的信息列表。 *

* GET /api/v5/public/instruments *
* * @param parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* instType -- String 是 产品类型 SPOT:币币 MARGIN:币币杠杆 SWAP:永续合约 FUTURES:交割合约 OPTION:期权
* uly -- String 可选 标的指数,仅适用于交割/永续/期权,期权必填
* instFamily -- String 否 交易品种,仅适用于交割/永续/期权
* instId -- String 否 产品ID
* @return String * @see * https://www.okx.com/docs-v5/zh/#rest-api-public-data-get-instruments */ 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"; /** * 查看账户余额 * 获取交易账户中资金余额信息。 *

* GET /api/v5/account/balance *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* ccy -- String 否 币种,如 BTC 支持多币种查询(不超过20个),币种之间半角逗号分隔
* @return String * @see * https://www.okx.com/docs-v5/zh/#rest-api-account-get-balance */ public static final String BALANCE = "/api/v5/account/balance"; /** * 查看持仓信息 * 获取该账户下拥有实际持仓的信息。账户为单向持仓模式会显示净持仓(net),账户为双向持仓模式下会分别返回多头(long)或空头(short)的仓位。按照仓位创建时间倒序排列。 *

* GET /api/v5/account/positions *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* instType -- String 否 产品类型 * MARGIN:币币杠杆 * SWAP:永续合约 * FUTURES:交割合约 * OPTION:期权 * instType和instId同时传入的时候会校验instId与instType是否一致。
* instId -- String 否 交易产品ID,如:BTC-USD-190927-5000-C * 支持多个instId查询(不超过10个),半角逗号分隔
* posId -- String 否 持仓ID * 支持多个posId查询(不超过20个),半角逗号分割
* @return String
* note: 如果该 instId 拥有过仓位且当前持仓量为0,传 instId 时,会返回仓位信息;不传 instId 时,仓位信息不返回。 * 逐仓交易设置中,如果设置为自主划转模式,逐仓转入保证金后,会生成一个持仓量为0的仓位
* @see * https://www.okx.com/docs-v5/zh/#rest-api-account-get-positions */ public static final String POSITIONS = "/api/v5/account/positions"; /** * 查看历史持仓信息 * 获取最近3个月有更新的仓位信息,按照仓位更新时间倒序排列。 *

* GET /api/v5/account/positions-history *
* @param * parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* instType -- String 否 产品类型 * MARGIN:币币杠杆 * SWAP:永续合约 * FUTURES:交割合约 * OPTION:期权
* instId -- String 否 交易产品ID,如:BTC-USD-SWAP
* mgnMode -- String 否 保证金模式 * cross:全仓,isolated:逐仓 * type -- String 否 平仓类型 * 1:部分平仓;2:完全平仓;3:强平;4:强减; 5:ADL自动减仓; * 状态叠加时,以最新的平仓类型为准状态为准。
* posId -- String 否 持仓ID
* after -- String 否 查询仓位更新 (uTime) 之前的内容,值为时间戳,Unix 时间戳为毫秒数格式,如 1597026383085
* before -- String 否 查询仓位更新 (uTime) 之后的内容,值为时间戳,Unix 时间戳为毫秒数格式,如 1597026383085
* limit -- String 否 分页返回结果的数量,最大为100,默认100条
* @return String * @see * https://www.okx.com/docs-v5/zh/#rest-api-account-get-positions-history */ public static final String POSITIONS_HISTORY = "/api/v5/account/positions-history"; /** * 撤单 * 撤销之前下的未完成订单。 * *

* GET /api/v5/trade/cancel-order *
* * @param parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* instId -- String 是 产品ID,如 BTC-USD-190927
* ordId -- String 可选 订单ID, ordId和clOrdId必须传一个,若传两个,以ordId为主
* clOrdId -- String 可选 用户自定义ID
* @return String * @see * https://www.okx.com/docs-v5/zh/#rest-api-trade-cancel-order */ public static final String CANCEL_ORDER = "/api/v5/trade/cancel-order"; /** * 下单 * 只有当您的账户有足够的资金才能下单。 * *

* GET /api/v5/trade/order *
* * @param parameters LinkedHashedMap of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* instId -- String 是 产品ID,如 BTC-USD-190927-5000-C
* tdMode -- String 是 交易模式 * 保证金模式:isolated:逐仓 ;cross:全仓 * 非保证金模式:cash:非保证金
* ccy -- String 否 保证金币种,仅适用于单币种保证金模式下的全仓杠杆订单
* clOrdId -- String 否 客户自定义订单ID * 字母(区分大小写)与数字的组合,可以是纯字母、纯数字且长度要在1-32位之间。
* tag -- String 否 订单标签 * 字母(区分大小写)与数字的组合,可以是纯字母、纯数字,且长度在1-16位之间。
* side -- String 是 订单方向 * buy:买, sell:卖
* posSide -- String 可选 持仓方向 * 在双向持仓模式下必填,且仅可选择 long 或 short。 仅适用交割、永续。
* ordType -- String 是 订单类型 * market:市价单 * limit:限价单 * post_only:只做maker单 * fok:全部成交或立即取消 * ioc:立即成交并取消剩余 * optimal_limit_ioc:市价委托立即成交并取消剩余(仅适用交割、永续)
* sz -- String 是 委托数量
* px -- String 可选 委托价格,仅适用于limit、post_only、fok、ioc类型的订单
* reduceOnly -- Boolean 否 是否只减仓,true 或 false,默认false * 仅适用于币币杠杆,以及买卖模式下的交割/永续 * 仅适用于单币种保证金模式和跨币种保证金模式
* tgtCcy -- String 否 市价单委托数量sz的单位,仅适用于币币市价订单 * base_ccy: 交易货币 ;quote_ccy:计价货币 * 买单默认quote_ccy, 卖单默认base_ccy
* banAmend -- Boolean 否 是否禁止币币市价改单,true 或 false,默认false * 为true时,余额不足时,系统不会改单,下单会失败,仅适用于币币市价单
* tpTriggerPx -- String 否 止盈触发价,如果填写此参数,必须填写 止盈委托价
* tpOrdPx -- String 否 止盈委托价,如果填写此参数,必须填写 止盈触发价 * 委托价格为-1时,执行市价止盈
* slTriggerPx -- String 否 止损触发价,如果填写此参数,必须填写 止损委托价
* slOrdPx -- String 否 止损委托价,如果填写此参数,必须填写 止损触发价 * 委托价格为-1时,执行市价止损
* tpTriggerPxType -- String 否 止盈触发价类型 * last:最新价格 * index:指数价格 * mark:标记价格 * 默认为last
* slTriggerPxType -- String 否 止损触发价类型 * last:最新价格 * index:指数价格 * mark:标记价格 * 默认为last
* @return String * @see * https://www.okx.com/docs-v5/zh/#rest-api-trade-place-order */ public static final String ORDER = "/api/v5/trade/order"; /** * 获取币种价格信息 */ public static final String TICKER = "/api/v5/market/ticker"; }