Administrator
14 hours ago 3d1469b456ba56421b0dcdad26f0a335550c174f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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";
 
}