ccxt 4.2.85 → 4.2.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/ccxt.browser.js +1132 -432
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +11 -1
- package/dist/cjs/src/binance.js +14 -1
- package/dist/cjs/src/bingx.js +71 -20
- package/dist/cjs/src/bitbank.js +19 -23
- package/dist/cjs/src/bitfinex.js +3 -0
- package/dist/cjs/src/bitfinex2.js +16 -1
- package/dist/cjs/src/bitflyer.js +19 -0
- package/dist/cjs/src/bitget.js +15 -1
- package/dist/cjs/src/bitopro.js +3 -0
- package/dist/cjs/src/bitrue.js +13 -7
- package/dist/cjs/src/bitvavo.js +3 -0
- package/dist/cjs/src/btcmarkets.js +1 -1
- package/dist/cjs/src/btcturk.js +2 -1
- package/dist/cjs/src/coinex.js +576 -302
- package/dist/cjs/src/currencycom.js +1 -1
- package/dist/cjs/src/delta.js +3 -1
- package/dist/cjs/src/digifinex.js +4 -2
- package/dist/cjs/src/exmo.js +11 -12
- package/dist/cjs/src/gate.js +5 -2
- package/dist/cjs/src/hitbtc.js +26 -2
- package/dist/cjs/src/htx.js +2 -2
- package/dist/cjs/src/huobijp.js +1 -1
- package/dist/cjs/src/hyperliquid.js +249 -12
- package/dist/cjs/src/idex.js +11 -12
- package/dist/cjs/src/krakenfutures.js +2 -6
- package/dist/cjs/src/lbank.js +3 -0
- package/dist/cjs/src/oceanex.js +1 -1
- package/dist/cjs/src/okcoin.js +3 -1
- package/dist/cjs/src/okx.js +24 -10
- package/dist/cjs/src/phemex.js +3 -1
- package/dist/cjs/src/pro/bitget.js +1 -0
- package/dist/cjs/src/pro/kucoin.js +11 -6
- package/dist/cjs/src/wazirx.js +1 -1
- package/dist/cjs/src/zonda.js +3 -0
- package/examples/js/benchmark.js +104 -0
- package/examples/ts/benchmark.ts +134 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/coinex.d.ts +232 -123
- package/js/src/ascendex.d.ts +5 -12
- package/js/src/ascendex.js +11 -1
- package/js/src/base/Exchange.d.ts +13 -13
- package/js/src/base/types.d.ts +11 -0
- package/js/src/binance.d.ts +4 -11
- package/js/src/binance.js +14 -1
- package/js/src/bingx.d.ts +5 -2
- package/js/src/bingx.js +71 -20
- package/js/src/bitbank.js +19 -23
- package/js/src/bitfinex.js +3 -0
- package/js/src/bitfinex2.d.ts +3 -17
- package/js/src/bitfinex2.js +16 -1
- package/js/src/bitflyer.d.ts +1 -0
- package/js/src/bitflyer.js +20 -1
- package/js/src/bitget.d.ts +5 -12
- package/js/src/bitget.js +15 -1
- package/js/src/bitopro.js +3 -0
- package/js/src/bitrue.d.ts +3 -17
- package/js/src/bitrue.js +13 -7
- package/js/src/bitvavo.js +3 -0
- package/js/src/btcmarkets.js +1 -1
- package/js/src/btcturk.js +2 -1
- package/js/src/coinex.d.ts +5 -12
- package/js/src/coinex.js +576 -302
- package/js/src/currencycom.js +1 -1
- package/js/src/delta.d.ts +5 -37
- package/js/src/delta.js +3 -1
- package/js/src/digifinex.d.ts +5 -13
- package/js/src/digifinex.js +4 -2
- package/js/src/exmo.d.ts +5 -37
- package/js/src/exmo.js +11 -12
- package/js/src/gate.d.ts +5 -33
- package/js/src/gate.js +5 -2
- package/js/src/hitbtc.d.ts +5 -12
- package/js/src/hitbtc.js +26 -2
- package/js/src/htx.js +2 -2
- package/js/src/huobijp.js +1 -1
- package/js/src/hyperliquid.d.ts +7 -4
- package/js/src/hyperliquid.js +249 -12
- package/js/src/idex.js +11 -12
- package/js/src/krakenfutures.js +2 -6
- package/js/src/kucoinfutures.d.ts +2 -2
- package/js/src/lbank.js +3 -0
- package/js/src/mexc.d.ts +3 -3
- package/js/src/oceanex.js +1 -1
- package/js/src/okcoin.js +3 -1
- package/js/src/okx.d.ts +5 -33
- package/js/src/okx.js +24 -10
- package/js/src/phemex.d.ts +3 -11
- package/js/src/phemex.js +3 -1
- package/js/src/pro/bitget.js +1 -0
- package/js/src/pro/kucoin.js +11 -6
- package/js/src/wazirx.js +1 -1
- package/js/src/zonda.js +3 -0
- package/package.json +3 -2
- package/skip-tests.json +7 -3
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -28,6 +28,7 @@ class coinex extends coinex$1 {
|
|
|
28
28
|
// 60 per 2 seconds => 30 per second => weight = 13.334
|
|
29
29
|
// 40 per 2 seconds => 20 per second => weight = 20
|
|
30
30
|
// 20 per 2 seconds => 10 per second => weight = 40
|
|
31
|
+
// v1 is per 2 seconds and v2 is per 1 second
|
|
31
32
|
'rateLimit': 2.5,
|
|
32
33
|
'pro': true,
|
|
33
34
|
'certified': true,
|
|
@@ -134,156 +135,279 @@ class coinex extends coinex$1 {
|
|
|
134
135
|
'perpetualPrivate': 'https://api.coinex.com/perpetual',
|
|
135
136
|
},
|
|
136
137
|
'www': 'https://www.coinex.com',
|
|
137
|
-
'doc': 'https://
|
|
138
|
+
'doc': 'https://docs.coinex.com/api/v2',
|
|
138
139
|
'fees': 'https://www.coinex.com/fees',
|
|
139
140
|
'referral': 'https://www.coinex.com/register?refer_code=yw5fz',
|
|
140
141
|
},
|
|
141
142
|
'api': {
|
|
142
|
-
'
|
|
143
|
-
'
|
|
144
|
-
'
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
'private': {
|
|
161
|
-
'get': {
|
|
162
|
-
'account/amm/balance': 40,
|
|
163
|
-
'account/investment/balance': 40,
|
|
164
|
-
'account/balance/history': 40,
|
|
165
|
-
'account/market/fee': 40,
|
|
166
|
-
'balance/coin/deposit': 40,
|
|
167
|
-
'balance/coin/withdraw': 40,
|
|
168
|
-
'balance/info': 40,
|
|
169
|
-
'balance/deposit/address/{coin_type}': 40,
|
|
170
|
-
'contract/transfer/history': 40,
|
|
171
|
-
'credit/info': 40,
|
|
172
|
-
'credit/balance': 40,
|
|
173
|
-
'investment/transfer/history': 40,
|
|
174
|
-
'margin/account': 1,
|
|
175
|
-
'margin/config': 1,
|
|
176
|
-
'margin/loan/history': 40,
|
|
177
|
-
'margin/transfer/history': 40,
|
|
178
|
-
'order/deals': 40,
|
|
179
|
-
'order/finished': 40,
|
|
180
|
-
'order/pending': 8,
|
|
181
|
-
'order/status': 8,
|
|
182
|
-
'order/status/batch': 8,
|
|
183
|
-
'order/user/deals': 40,
|
|
184
|
-
'order/stop/finished': 40,
|
|
185
|
-
'order/stop/pending': 8,
|
|
186
|
-
'order/user/trade/fee': 1,
|
|
187
|
-
'order/market/trade/info': 1,
|
|
188
|
-
'sub_account/balance': 1,
|
|
189
|
-
'sub_account/transfer/history': 40,
|
|
190
|
-
'sub_account/auth/api': 40,
|
|
191
|
-
'sub_account/auth/api/{user_auth_id}': 40,
|
|
192
|
-
},
|
|
193
|
-
'post': {
|
|
194
|
-
'balance/coin/withdraw': 40,
|
|
195
|
-
'contract/balance/transfer': 40,
|
|
196
|
-
'margin/flat': 40,
|
|
197
|
-
'margin/loan': 40,
|
|
198
|
-
'margin/transfer': 40,
|
|
199
|
-
'order/limit/batch': 40,
|
|
200
|
-
'order/ioc': 13.334,
|
|
201
|
-
'order/limit': 13.334,
|
|
202
|
-
'order/market': 13.334,
|
|
203
|
-
'order/modify': 13.334,
|
|
204
|
-
'order/stop/limit': 13.334,
|
|
205
|
-
'order/stop/market': 13.334,
|
|
206
|
-
'order/stop/modify': 13.334,
|
|
207
|
-
'sub_account/transfer': 40,
|
|
208
|
-
'sub_account/register': 1,
|
|
209
|
-
'sub_account/unfrozen': 40,
|
|
210
|
-
'sub_account/frozen': 40,
|
|
211
|
-
'sub_account/auth/api': 40,
|
|
143
|
+
'v1': {
|
|
144
|
+
'public': {
|
|
145
|
+
'get': {
|
|
146
|
+
'amm/market': 1,
|
|
147
|
+
'common/currency/rate': 1,
|
|
148
|
+
'common/asset/config': 1,
|
|
149
|
+
'common/maintain/info': 1,
|
|
150
|
+
'common/temp-maintain/info': 1,
|
|
151
|
+
'margin/market': 1,
|
|
152
|
+
'market/info': 1,
|
|
153
|
+
'market/list': 1,
|
|
154
|
+
'market/ticker': 1,
|
|
155
|
+
'market/ticker/all': 1,
|
|
156
|
+
'market/depth': 1,
|
|
157
|
+
'market/deals': 1,
|
|
158
|
+
'market/kline': 1,
|
|
159
|
+
'market/detail': 1,
|
|
160
|
+
},
|
|
212
161
|
},
|
|
213
|
-
'
|
|
214
|
-
'
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
162
|
+
'private': {
|
|
163
|
+
'get': {
|
|
164
|
+
'account/amm/balance': 40,
|
|
165
|
+
'account/investment/balance': 40,
|
|
166
|
+
'account/balance/history': 40,
|
|
167
|
+
'account/market/fee': 40,
|
|
168
|
+
'balance/coin/deposit': 40,
|
|
169
|
+
'balance/coin/withdraw': 40,
|
|
170
|
+
'balance/info': 40,
|
|
171
|
+
'balance/deposit/address/{coin_type}': 40,
|
|
172
|
+
'contract/transfer/history': 40,
|
|
173
|
+
'credit/info': 40,
|
|
174
|
+
'credit/balance': 40,
|
|
175
|
+
'investment/transfer/history': 40,
|
|
176
|
+
'margin/account': 1,
|
|
177
|
+
'margin/config': 1,
|
|
178
|
+
'margin/loan/history': 40,
|
|
179
|
+
'margin/transfer/history': 40,
|
|
180
|
+
'order/deals': 40,
|
|
181
|
+
'order/finished': 40,
|
|
182
|
+
'order/pending': 8,
|
|
183
|
+
'order/status': 8,
|
|
184
|
+
'order/status/batch': 8,
|
|
185
|
+
'order/user/deals': 40,
|
|
186
|
+
'order/stop/finished': 40,
|
|
187
|
+
'order/stop/pending': 8,
|
|
188
|
+
'order/user/trade/fee': 1,
|
|
189
|
+
'order/market/trade/info': 1,
|
|
190
|
+
'sub_account/balance': 1,
|
|
191
|
+
'sub_account/transfer/history': 40,
|
|
192
|
+
'sub_account/auth/api': 40,
|
|
193
|
+
'sub_account/auth/api/{user_auth_id}': 40,
|
|
194
|
+
},
|
|
195
|
+
'post': {
|
|
196
|
+
'balance/coin/withdraw': 40,
|
|
197
|
+
'contract/balance/transfer': 40,
|
|
198
|
+
'margin/flat': 40,
|
|
199
|
+
'margin/loan': 40,
|
|
200
|
+
'margin/transfer': 40,
|
|
201
|
+
'order/limit/batch': 40,
|
|
202
|
+
'order/ioc': 13.334,
|
|
203
|
+
'order/limit': 13.334,
|
|
204
|
+
'order/market': 13.334,
|
|
205
|
+
'order/modify': 13.334,
|
|
206
|
+
'order/stop/limit': 13.334,
|
|
207
|
+
'order/stop/market': 13.334,
|
|
208
|
+
'order/stop/modify': 13.334,
|
|
209
|
+
'sub_account/transfer': 40,
|
|
210
|
+
'sub_account/register': 1,
|
|
211
|
+
'sub_account/unfrozen': 40,
|
|
212
|
+
'sub_account/frozen': 40,
|
|
213
|
+
'sub_account/auth/api': 40,
|
|
214
|
+
},
|
|
215
|
+
'put': {
|
|
216
|
+
'balance/deposit/address/{coin_type}': 40,
|
|
217
|
+
'sub_account/unfrozen': 40,
|
|
218
|
+
'sub_account/frozen': 40,
|
|
219
|
+
'sub_account/auth/api/{user_auth_id}': 40,
|
|
220
|
+
'v1/account/settings': 40,
|
|
221
|
+
},
|
|
222
|
+
'delete': {
|
|
223
|
+
'balance/coin/withdraw': 40,
|
|
224
|
+
'order/pending/batch': 40,
|
|
225
|
+
'order/pending': 13.334,
|
|
226
|
+
'order/stop/pending': 40,
|
|
227
|
+
'order/stop/pending/{id}': 13.334,
|
|
228
|
+
'order/pending/by_client_id': 40,
|
|
229
|
+
'order/stop/pending/by_client_id': 40,
|
|
230
|
+
'sub_account/auth/api/{user_auth_id}': 40,
|
|
231
|
+
'sub_account/authorize/{id}': 40,
|
|
232
|
+
},
|
|
219
233
|
},
|
|
220
|
-
'
|
|
221
|
-
'
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
234
|
+
'perpetualPublic': {
|
|
235
|
+
'get': {
|
|
236
|
+
'ping': 1,
|
|
237
|
+
'time': 1,
|
|
238
|
+
'market/list': 1,
|
|
239
|
+
'market/limit_config': 1,
|
|
240
|
+
'market/ticker': 1,
|
|
241
|
+
'market/ticker/all': 1,
|
|
242
|
+
'market/depth': 1,
|
|
243
|
+
'market/deals': 1,
|
|
244
|
+
'market/funding_history': 1,
|
|
245
|
+
'market/kline': 1,
|
|
246
|
+
},
|
|
230
247
|
},
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
248
|
+
'perpetualPrivate': {
|
|
249
|
+
'get': {
|
|
250
|
+
'market/user_deals': 1,
|
|
251
|
+
'asset/query': 40,
|
|
252
|
+
'order/pending': 8,
|
|
253
|
+
'order/finished': 40,
|
|
254
|
+
'order/stop_finished': 40,
|
|
255
|
+
'order/stop_pending': 8,
|
|
256
|
+
'order/status': 8,
|
|
257
|
+
'order/stop_status': 8,
|
|
258
|
+
'position/finished': 40,
|
|
259
|
+
'position/pending': 40,
|
|
260
|
+
'position/funding': 40,
|
|
261
|
+
'position/adl_history': 40,
|
|
262
|
+
'market/preference': 40,
|
|
263
|
+
'position/margin_history': 40,
|
|
264
|
+
'position/settle_history': 40,
|
|
265
|
+
},
|
|
266
|
+
'post': {
|
|
267
|
+
'market/adjust_leverage': 1,
|
|
268
|
+
'market/position_expect': 1,
|
|
269
|
+
'order/put_limit': 20,
|
|
270
|
+
'order/put_market': 20,
|
|
271
|
+
'order/put_stop_limit': 20,
|
|
272
|
+
'order/put_stop_market': 20,
|
|
273
|
+
'order/modify': 20,
|
|
274
|
+
'order/modify_stop': 20,
|
|
275
|
+
'order/cancel': 20,
|
|
276
|
+
'order/cancel_all': 40,
|
|
277
|
+
'order/cancel_batch': 40,
|
|
278
|
+
'order/cancel_stop': 20,
|
|
279
|
+
'order/cancel_stop_all': 40,
|
|
280
|
+
'order/close_limit': 20,
|
|
281
|
+
'order/close_market': 20,
|
|
282
|
+
'position/adjust_margin': 20,
|
|
283
|
+
'position/stop_loss': 20,
|
|
284
|
+
'position/take_profit': 20,
|
|
285
|
+
'position/market_close': 20,
|
|
286
|
+
'order/cancel/by_client_id': 20,
|
|
287
|
+
'order/cancel_stop/by_client_id': 20,
|
|
288
|
+
'market/preference': 20,
|
|
289
|
+
},
|
|
244
290
|
},
|
|
245
291
|
},
|
|
246
|
-
'
|
|
247
|
-
'
|
|
248
|
-
'
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
292
|
+
'v2': {
|
|
293
|
+
'public': {
|
|
294
|
+
'get': {
|
|
295
|
+
'maintain-info': 1,
|
|
296
|
+
'ping': 1,
|
|
297
|
+
'time': 1,
|
|
298
|
+
'spot/market': 1,
|
|
299
|
+
'spot/ticker': 1,
|
|
300
|
+
'spot/depth': 1,
|
|
301
|
+
'spot/deals': 1,
|
|
302
|
+
'spot/kline': 1,
|
|
303
|
+
'spot/index': 1,
|
|
304
|
+
'futures/market': 1,
|
|
305
|
+
'futures/ticker': 1,
|
|
306
|
+
'futures/depth': 1,
|
|
307
|
+
'futures/deals': 1,
|
|
308
|
+
'futures/kline': 1,
|
|
309
|
+
'futures/index': 1,
|
|
310
|
+
'futures/funding-rate': 1,
|
|
311
|
+
'futures/funding-rate-history': 1,
|
|
312
|
+
'futures/position-level': 1,
|
|
313
|
+
'futures/liquidation-history': 1,
|
|
314
|
+
'futures/basis-history': 1,
|
|
315
|
+
},
|
|
263
316
|
},
|
|
264
|
-
'
|
|
265
|
-
'
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
317
|
+
'private': {
|
|
318
|
+
'get': {
|
|
319
|
+
'account/subs': 1,
|
|
320
|
+
'account/subs/api-detail': 40,
|
|
321
|
+
'account/subs/info': 1,
|
|
322
|
+
'account/subs/api': 40,
|
|
323
|
+
'account/subs/transfer-history': 40,
|
|
324
|
+
'account/subs/spot-balance': 1,
|
|
325
|
+
'account/trade-fee-rate': 40,
|
|
326
|
+
'assets/spot/balance': 40,
|
|
327
|
+
'assets/futures/balance': 40,
|
|
328
|
+
'assets/margin/balance': 1,
|
|
329
|
+
'assets/financial/balance': 40,
|
|
330
|
+
'assets/amm/liquidity': 40,
|
|
331
|
+
'assets/credit/info': 40,
|
|
332
|
+
'assets/margin/borrow-history': 40,
|
|
333
|
+
'assets/margin/interest-limit': 1,
|
|
334
|
+
'assets/deposit-address': 40,
|
|
335
|
+
'assets/deposit-history': 40,
|
|
336
|
+
'assets/withdraw': 40,
|
|
337
|
+
'assets/deposit-withdraw-config': 1,
|
|
338
|
+
'assets/transfer-history': 40,
|
|
339
|
+
'spot/order-status': 8,
|
|
340
|
+
'spot/batch-order-status': 8,
|
|
341
|
+
'spot/pending-order': 8,
|
|
342
|
+
'spot/finished-order': 40,
|
|
343
|
+
'spot/pending-stop-order': 8,
|
|
344
|
+
'spot/finished-stop-order': 40,
|
|
345
|
+
'spot/user-deals': 40,
|
|
346
|
+
'spot/order-deals': 40,
|
|
347
|
+
'futures/order-status': 8,
|
|
348
|
+
'futures/batch-order-status': 1,
|
|
349
|
+
'futures/pending-order': 8,
|
|
350
|
+
'futures/finished-order': 40,
|
|
351
|
+
'futures/pending-stop-order': 8,
|
|
352
|
+
'futures/finished-stop-order': 40,
|
|
353
|
+
'futures/user-deals': 1,
|
|
354
|
+
'futures/order-deals': 1,
|
|
355
|
+
'futures/pending-position': 40,
|
|
356
|
+
'futures/finished-position': 1,
|
|
357
|
+
'futures/position-margin-history': 1,
|
|
358
|
+
'futures/position-funding-history': 40,
|
|
359
|
+
'futures/position-adl-history': 1,
|
|
360
|
+
'futures/position-settle-history': 1,
|
|
361
|
+
},
|
|
362
|
+
'post': {
|
|
363
|
+
'account/subs': 40,
|
|
364
|
+
'account/subs/frozen': 40,
|
|
365
|
+
'account/subs/unfrozen': 40,
|
|
366
|
+
'account/subs/api': 40,
|
|
367
|
+
'account/subs/edit-api': 40,
|
|
368
|
+
'account/subs/delete-api': 40,
|
|
369
|
+
'account/subs/transfer': 40,
|
|
370
|
+
'account/settings': 40,
|
|
371
|
+
'assets/margin/borrow': 40,
|
|
372
|
+
'assets/margin/repay': 40,
|
|
373
|
+
'assets/renewal-deposit-address': 40,
|
|
374
|
+
'assets/withdraw': 40,
|
|
375
|
+
'assets/cancel-withdraw': 40,
|
|
376
|
+
'assets/transfer': 40,
|
|
377
|
+
'assets/amm/add-liquidity': 1,
|
|
378
|
+
'assets/amm/remove-liquidity': 1,
|
|
379
|
+
'spot/order': 13.334,
|
|
380
|
+
'spot/stop-order': 13.334,
|
|
381
|
+
'spot/batch-order': 40,
|
|
382
|
+
'spot/batch-stop-order': 1,
|
|
383
|
+
'spot/modify-order': 13.334,
|
|
384
|
+
'spot/modify-stop-order': 13.334,
|
|
385
|
+
'spot/cancel-all-order': 1,
|
|
386
|
+
'spot/cancel-order': 6.667,
|
|
387
|
+
'spot/cancel-stop-order': 6.667,
|
|
388
|
+
'spot/cancel-batch-order': 10,
|
|
389
|
+
'spot/cancel-batch-stop-order': 10,
|
|
390
|
+
'spot/cancel-order-by-client-id': 1,
|
|
391
|
+
'spot/cancel-stop-order-by-client-id': 1,
|
|
392
|
+
'futures/order': 20,
|
|
393
|
+
'futures/stop-order': 20,
|
|
394
|
+
'futures/batch-order': 1,
|
|
395
|
+
'futures/batch-stop-order': 1,
|
|
396
|
+
'futures/modify-order': 20,
|
|
397
|
+
'futures/modify-stop-order': 20,
|
|
398
|
+
'futures/cancel-all-order': 1,
|
|
399
|
+
'futures/cancel-order': 10,
|
|
400
|
+
'futures/cancel-stop-order': 10,
|
|
401
|
+
'futures/cancel-batch-order': 20,
|
|
402
|
+
'futures/cancel-batch-stop-order': 20,
|
|
403
|
+
'futures/cancel-order-by-client-id': 1,
|
|
404
|
+
'futures/cancel-stop-order-by-client-id': 1,
|
|
405
|
+
'futures/close-position': 20,
|
|
406
|
+
'futures/adjust-position-margin': 20,
|
|
407
|
+
'futures/adjust-position-leverage': 20,
|
|
408
|
+
'futures/set-position-stop-loss': 20,
|
|
409
|
+
'futures/set-position-take-profit': 20,
|
|
410
|
+
},
|
|
287
411
|
},
|
|
288
412
|
},
|
|
289
413
|
},
|
|
@@ -354,7 +478,7 @@ class coinex extends coinex$1 {
|
|
|
354
478
|
});
|
|
355
479
|
}
|
|
356
480
|
async fetchCurrencies(params = {}) {
|
|
357
|
-
const response = await this.
|
|
481
|
+
const response = await this.v1PublicGetCommonAssetConfig(params);
|
|
358
482
|
// {
|
|
359
483
|
// "code": 0,
|
|
360
484
|
// "data": {
|
|
@@ -502,7 +626,7 @@ class coinex extends coinex$1 {
|
|
|
502
626
|
return this.arrayConcat(spotMarkets, swapMarkets);
|
|
503
627
|
}
|
|
504
628
|
async fetchSpotMarkets(params) {
|
|
505
|
-
const response = await this.
|
|
629
|
+
const response = await this.v1PublicGetMarketInfo(params);
|
|
506
630
|
//
|
|
507
631
|
// {
|
|
508
632
|
// "code": 0,
|
|
@@ -591,7 +715,7 @@ class coinex extends coinex$1 {
|
|
|
591
715
|
return result;
|
|
592
716
|
}
|
|
593
717
|
async fetchContractMarkets(params) {
|
|
594
|
-
const response = await this.
|
|
718
|
+
const response = await this.v1PerpetualPublicGetMarketList(params);
|
|
595
719
|
//
|
|
596
720
|
// {
|
|
597
721
|
// "code": 0,
|
|
@@ -773,10 +897,10 @@ class coinex extends coinex$1 {
|
|
|
773
897
|
};
|
|
774
898
|
let response = undefined;
|
|
775
899
|
if (market['swap']) {
|
|
776
|
-
response = await this.
|
|
900
|
+
response = await this.v1PerpetualPublicGetMarketTicker(this.extend(request, params));
|
|
777
901
|
}
|
|
778
902
|
else {
|
|
779
|
-
response = await this.
|
|
903
|
+
response = await this.v1PublicGetMarketTicker(this.extend(request, params));
|
|
780
904
|
}
|
|
781
905
|
//
|
|
782
906
|
// Spot
|
|
@@ -855,10 +979,10 @@ class coinex extends coinex$1 {
|
|
|
855
979
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
|
856
980
|
let response = undefined;
|
|
857
981
|
if (marketType === 'swap') {
|
|
858
|
-
response = await this.
|
|
982
|
+
response = await this.v1PerpetualPublicGetMarketTickerAll(query);
|
|
859
983
|
}
|
|
860
984
|
else {
|
|
861
|
-
response = await this.
|
|
985
|
+
response = await this.v1PublicGetMarketTickerAll();
|
|
862
986
|
}
|
|
863
987
|
//
|
|
864
988
|
// Spot
|
|
@@ -941,19 +1065,22 @@ class coinex extends coinex$1 {
|
|
|
941
1065
|
* @method
|
|
942
1066
|
* @name coinex#fetchTime
|
|
943
1067
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
944
|
-
* @see https://
|
|
1068
|
+
* @see https://docs.coinex.com/api/v2/common/http/time
|
|
945
1069
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
946
1070
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
947
1071
|
*/
|
|
948
|
-
const response = await this.
|
|
1072
|
+
const response = await this.v2PublicGetTime(params);
|
|
949
1073
|
//
|
|
950
1074
|
// {
|
|
951
|
-
// "code":
|
|
952
|
-
// "data":
|
|
1075
|
+
// "code": 0,
|
|
1076
|
+
// "data": {
|
|
1077
|
+
// "timestamp": 1711699867777
|
|
1078
|
+
// },
|
|
953
1079
|
// "message": "OK"
|
|
954
1080
|
// }
|
|
955
1081
|
//
|
|
956
|
-
|
|
1082
|
+
const data = this.safeDict(response, 'data', {});
|
|
1083
|
+
return this.safeInteger(data, 'timestamp');
|
|
957
1084
|
}
|
|
958
1085
|
async fetchOrderBook(symbol, limit = 20, params = {}) {
|
|
959
1086
|
/**
|
|
@@ -979,10 +1106,10 @@ class coinex extends coinex$1 {
|
|
|
979
1106
|
};
|
|
980
1107
|
let response = undefined;
|
|
981
1108
|
if (market['swap']) {
|
|
982
|
-
response = await this.
|
|
1109
|
+
response = await this.v1PerpetualPublicGetMarketDepth(this.extend(request, params));
|
|
983
1110
|
}
|
|
984
1111
|
else {
|
|
985
|
-
response = await this.
|
|
1112
|
+
response = await this.v1PublicGetMarketDepth(this.extend(request, params));
|
|
986
1113
|
}
|
|
987
1114
|
//
|
|
988
1115
|
// Spot
|
|
@@ -1183,10 +1310,10 @@ class coinex extends coinex$1 {
|
|
|
1183
1310
|
}
|
|
1184
1311
|
let response = undefined;
|
|
1185
1312
|
if (market['swap']) {
|
|
1186
|
-
response = await this.
|
|
1313
|
+
response = await this.v1PerpetualPublicGetMarketDeals(this.extend(request, params));
|
|
1187
1314
|
}
|
|
1188
1315
|
else {
|
|
1189
|
-
response = await this.
|
|
1316
|
+
response = await this.v1PublicGetMarketDeals(this.extend(request, params));
|
|
1190
1317
|
}
|
|
1191
1318
|
//
|
|
1192
1319
|
// Spot and Swap
|
|
@@ -1213,7 +1340,8 @@ class coinex extends coinex$1 {
|
|
|
1213
1340
|
* @method
|
|
1214
1341
|
* @name coinex#fetchTradingFee
|
|
1215
1342
|
* @description fetch the trading fees for a market
|
|
1216
|
-
* @see https://
|
|
1343
|
+
* @see https://docs.coinex.com/api/v2/spot/market/http/list-market
|
|
1344
|
+
* @see https://docs.coinex.com/api/v2/futures/market/http/list-market
|
|
1217
1345
|
* @param {string} symbol unified market symbol
|
|
1218
1346
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1219
1347
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -1223,67 +1351,132 @@ class coinex extends coinex$1 {
|
|
|
1223
1351
|
const request = {
|
|
1224
1352
|
'market': market['id'],
|
|
1225
1353
|
};
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1354
|
+
let response = undefined;
|
|
1355
|
+
if (market['spot']) {
|
|
1356
|
+
response = await this.v2PublicGetSpotMarket(this.extend(request, params));
|
|
1357
|
+
//
|
|
1358
|
+
// {
|
|
1359
|
+
// "code": 0,
|
|
1360
|
+
// "data": [
|
|
1361
|
+
// {
|
|
1362
|
+
// "base_ccy": "BTC",
|
|
1363
|
+
// "base_ccy_precision": 8,
|
|
1364
|
+
// "is_amm_available": false,
|
|
1365
|
+
// "is_margin_available": true,
|
|
1366
|
+
// "maker_fee_rate": "0.002",
|
|
1367
|
+
// "market": "BTCUSDT",
|
|
1368
|
+
// "min_amount": "0.0001",
|
|
1369
|
+
// "quote_ccy": "USDT",
|
|
1370
|
+
// "quote_ccy_precision": 2,
|
|
1371
|
+
// "taker_fee_rate": "0.002"
|
|
1372
|
+
// }
|
|
1373
|
+
// ],
|
|
1374
|
+
// "message": "OK"
|
|
1375
|
+
// }
|
|
1376
|
+
//
|
|
1377
|
+
}
|
|
1378
|
+
else {
|
|
1379
|
+
response = await this.v2PublicGetFuturesMarket(this.extend(request, params));
|
|
1380
|
+
//
|
|
1381
|
+
// {
|
|
1382
|
+
// "code": 0,
|
|
1383
|
+
// "data": [
|
|
1384
|
+
// {
|
|
1385
|
+
// "base_ccy": "BTC",
|
|
1386
|
+
// "base_ccy_precision": 8,
|
|
1387
|
+
// "contract_type": "linear",
|
|
1388
|
+
// "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
|
|
1389
|
+
// "maker_fee_rate": "0",
|
|
1390
|
+
// "market": "BTCUSDT",
|
|
1391
|
+
// "min_amount": "0.0001",
|
|
1392
|
+
// "open_interest_volume": "185.7498",
|
|
1393
|
+
// "quote_ccy": "USDT",
|
|
1394
|
+
// "quote_ccy_precision": 2,
|
|
1395
|
+
// "taker_fee_rate": "0"
|
|
1396
|
+
// }
|
|
1397
|
+
// ],
|
|
1398
|
+
// "message": "OK"
|
|
1399
|
+
// }
|
|
1400
|
+
//
|
|
1401
|
+
}
|
|
1402
|
+
const data = this.safeList(response, 'data', []);
|
|
1403
|
+
const result = this.safeDict(data, 0, {});
|
|
1404
|
+
return this.parseTradingFee(result, market);
|
|
1245
1405
|
}
|
|
1246
1406
|
async fetchTradingFees(params = {}) {
|
|
1247
1407
|
/**
|
|
1248
1408
|
* @method
|
|
1249
1409
|
* @name coinex#fetchTradingFees
|
|
1250
1410
|
* @description fetch the trading fees for multiple markets
|
|
1251
|
-
* @see https://
|
|
1411
|
+
* @see https://docs.coinex.com/api/v2/spot/market/http/list-market
|
|
1412
|
+
* @see https://docs.coinex.com/api/v2/futures/market/http/list-market
|
|
1252
1413
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1253
1414
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
1254
1415
|
*/
|
|
1255
1416
|
await this.loadMarkets();
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1417
|
+
let type = undefined;
|
|
1418
|
+
[type, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
|
|
1419
|
+
let response = undefined;
|
|
1420
|
+
if (type === 'swap') {
|
|
1421
|
+
response = await this.v2PublicGetFuturesMarket(params);
|
|
1422
|
+
//
|
|
1423
|
+
// {
|
|
1424
|
+
// "code": 0,
|
|
1425
|
+
// "data": [
|
|
1426
|
+
// {
|
|
1427
|
+
// "base_ccy": "BTC",
|
|
1428
|
+
// "base_ccy_precision": 8,
|
|
1429
|
+
// "contract_type": "linear",
|
|
1430
|
+
// "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
|
|
1431
|
+
// "maker_fee_rate": "0",
|
|
1432
|
+
// "market": "BTCUSDT",
|
|
1433
|
+
// "min_amount": "0.0001",
|
|
1434
|
+
// "open_interest_volume": "185.7498",
|
|
1435
|
+
// "quote_ccy": "USDT",
|
|
1436
|
+
// "quote_ccy_precision": 2,
|
|
1437
|
+
// "taker_fee_rate": "0"
|
|
1438
|
+
// }
|
|
1439
|
+
// ],
|
|
1440
|
+
// "message": "OK"
|
|
1441
|
+
// }
|
|
1442
|
+
//
|
|
1443
|
+
}
|
|
1444
|
+
else {
|
|
1445
|
+
response = await this.v2PublicGetSpotMarket(params);
|
|
1446
|
+
//
|
|
1447
|
+
// {
|
|
1448
|
+
// "code": 0,
|
|
1449
|
+
// "data": [
|
|
1450
|
+
// {
|
|
1451
|
+
// "base_ccy": "BTC",
|
|
1452
|
+
// "base_ccy_precision": 8,
|
|
1453
|
+
// "is_amm_available": false,
|
|
1454
|
+
// "is_margin_available": true,
|
|
1455
|
+
// "maker_fee_rate": "0.002",
|
|
1456
|
+
// "market": "BTCUSDT",
|
|
1457
|
+
// "min_amount": "0.0001",
|
|
1458
|
+
// "quote_ccy": "USDT",
|
|
1459
|
+
// "quote_ccy_precision": 2,
|
|
1460
|
+
// "taker_fee_rate": "0.002"
|
|
1461
|
+
// },
|
|
1462
|
+
// ],
|
|
1463
|
+
// "message": "OK"
|
|
1464
|
+
// }
|
|
1465
|
+
//
|
|
1466
|
+
}
|
|
1467
|
+
const data = this.safeList(response, 'data', []);
|
|
1276
1468
|
const result = {};
|
|
1277
|
-
for (let i = 0; i <
|
|
1278
|
-
const
|
|
1279
|
-
const
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1469
|
+
for (let i = 0; i < data.length; i++) {
|
|
1470
|
+
const entry = data[i];
|
|
1471
|
+
const marketId = this.safeString(entry, 'market');
|
|
1472
|
+
const market = this.safeMarket(marketId, undefined, undefined, type);
|
|
1473
|
+
const symbol = market['symbol'];
|
|
1474
|
+
result[symbol] = this.parseTradingFee(entry, market);
|
|
1282
1475
|
}
|
|
1283
1476
|
return result;
|
|
1284
1477
|
}
|
|
1285
1478
|
parseTradingFee(fee, market = undefined) {
|
|
1286
|
-
const marketId = this.safeValue(fee, '
|
|
1479
|
+
const marketId = this.safeValue(fee, 'market');
|
|
1287
1480
|
const symbol = this.safeSymbol(marketId, market);
|
|
1288
1481
|
return {
|
|
1289
1482
|
'info': fee,
|
|
@@ -1341,10 +1534,10 @@ class coinex extends coinex$1 {
|
|
|
1341
1534
|
}
|
|
1342
1535
|
let response = undefined;
|
|
1343
1536
|
if (market['swap']) {
|
|
1344
|
-
response = await this.
|
|
1537
|
+
response = await this.v1PerpetualPublicGetMarketKline(this.extend(request, params));
|
|
1345
1538
|
}
|
|
1346
1539
|
else {
|
|
1347
|
-
response = await this.
|
|
1540
|
+
response = await this.v1PublicGetMarketKline(this.extend(request, params));
|
|
1348
1541
|
}
|
|
1349
1542
|
//
|
|
1350
1543
|
// Spot
|
|
@@ -1390,7 +1583,7 @@ class coinex extends coinex$1 {
|
|
|
1390
1583
|
const request = {
|
|
1391
1584
|
'market': marketId,
|
|
1392
1585
|
};
|
|
1393
|
-
const response = await this.
|
|
1586
|
+
const response = await this.v1PrivateGetMarginAccount(this.extend(request, params));
|
|
1394
1587
|
//
|
|
1395
1588
|
// {
|
|
1396
1589
|
// "code": 0,
|
|
@@ -1457,7 +1650,7 @@ class coinex extends coinex$1 {
|
|
|
1457
1650
|
}
|
|
1458
1651
|
async fetchSpotBalance(params = {}) {
|
|
1459
1652
|
await this.loadMarkets();
|
|
1460
|
-
const response = await this.
|
|
1653
|
+
const response = await this.v1PrivateGetBalanceInfo(params);
|
|
1461
1654
|
//
|
|
1462
1655
|
// {
|
|
1463
1656
|
// "code": 0,
|
|
@@ -1494,7 +1687,7 @@ class coinex extends coinex$1 {
|
|
|
1494
1687
|
}
|
|
1495
1688
|
async fetchSwapBalance(params = {}) {
|
|
1496
1689
|
await this.loadMarkets();
|
|
1497
|
-
const response = await this.
|
|
1690
|
+
const response = await this.v1PerpetualPrivateGetAssetQuery(params);
|
|
1498
1691
|
//
|
|
1499
1692
|
// {
|
|
1500
1693
|
// "code": 0,
|
|
@@ -1528,7 +1721,7 @@ class coinex extends coinex$1 {
|
|
|
1528
1721
|
}
|
|
1529
1722
|
async fetchFinancialBalance(params = {}) {
|
|
1530
1723
|
await this.loadMarkets();
|
|
1531
|
-
const response = await this.
|
|
1724
|
+
const response = await this.v1PrivateGetAccountInvestmentBalance(params);
|
|
1532
1725
|
//
|
|
1533
1726
|
// {
|
|
1534
1727
|
// "code": 0,
|
|
@@ -2168,53 +2361,53 @@ class coinex extends coinex$1 {
|
|
|
2168
2361
|
if (market['spot']) {
|
|
2169
2362
|
if (isTriggerOrder) {
|
|
2170
2363
|
if (type === 'limit') {
|
|
2171
|
-
response = await this.
|
|
2364
|
+
response = await this.v1PrivatePostOrderStopLimit(request);
|
|
2172
2365
|
}
|
|
2173
2366
|
else {
|
|
2174
|
-
response = await this.
|
|
2367
|
+
response = await this.v1PrivatePostOrderStopMarket(request);
|
|
2175
2368
|
}
|
|
2176
2369
|
}
|
|
2177
2370
|
else {
|
|
2178
2371
|
if (type === 'limit') {
|
|
2179
|
-
response = await this.
|
|
2372
|
+
response = await this.v1PrivatePostOrderLimit(request);
|
|
2180
2373
|
}
|
|
2181
2374
|
else {
|
|
2182
|
-
response = await this.
|
|
2375
|
+
response = await this.v1PrivatePostOrderMarket(request);
|
|
2183
2376
|
}
|
|
2184
2377
|
}
|
|
2185
2378
|
}
|
|
2186
2379
|
else {
|
|
2187
2380
|
if (isTriggerOrder) {
|
|
2188
2381
|
if (type === 'limit') {
|
|
2189
|
-
response = await this.
|
|
2382
|
+
response = await this.v1PerpetualPrivatePostOrderPutStopLimit(request);
|
|
2190
2383
|
}
|
|
2191
2384
|
else {
|
|
2192
|
-
response = await this.
|
|
2385
|
+
response = await this.v1PerpetualPrivatePostOrderPutStopMarket(request);
|
|
2193
2386
|
}
|
|
2194
2387
|
}
|
|
2195
2388
|
else if (isStopLossOrTakeProfitTrigger) {
|
|
2196
2389
|
if (isStopLossTriggerOrder) {
|
|
2197
|
-
response = await this.
|
|
2390
|
+
response = await this.v1PerpetualPrivatePostPositionStopLoss(request);
|
|
2198
2391
|
}
|
|
2199
2392
|
else if (isTakeProfitTriggerOrder) {
|
|
2200
|
-
response = await this.
|
|
2393
|
+
response = await this.v1PerpetualPrivatePostPositionTakeProfit(request);
|
|
2201
2394
|
}
|
|
2202
2395
|
}
|
|
2203
2396
|
else {
|
|
2204
2397
|
if (reduceOnly) {
|
|
2205
2398
|
if (type === 'limit') {
|
|
2206
|
-
response = await this.
|
|
2399
|
+
response = await this.v1PerpetualPrivatePostOrderCloseLimit(request);
|
|
2207
2400
|
}
|
|
2208
2401
|
else {
|
|
2209
|
-
response = await this.
|
|
2402
|
+
response = await this.v1PerpetualPrivatePostOrderCloseMarket(request);
|
|
2210
2403
|
}
|
|
2211
2404
|
}
|
|
2212
2405
|
else {
|
|
2213
2406
|
if (type === 'limit') {
|
|
2214
|
-
response = await this.
|
|
2407
|
+
response = await this.v1PerpetualPrivatePostOrderPutLimit(request);
|
|
2215
2408
|
}
|
|
2216
2409
|
else {
|
|
2217
|
-
response = await this.
|
|
2410
|
+
response = await this.v1PerpetualPrivatePostOrderPutMarket(request);
|
|
2218
2411
|
}
|
|
2219
2412
|
}
|
|
2220
2413
|
}
|
|
@@ -2342,7 +2535,7 @@ class coinex extends coinex$1 {
|
|
|
2342
2535
|
'market': market['id'],
|
|
2343
2536
|
'batch_orders': this.json(ordersRequests),
|
|
2344
2537
|
};
|
|
2345
|
-
const response = await this.
|
|
2538
|
+
const response = await this.v1PrivatePostOrderLimitBatch(request);
|
|
2346
2539
|
//
|
|
2347
2540
|
// {
|
|
2348
2541
|
// "code": 0,
|
|
@@ -2425,11 +2618,11 @@ class coinex extends coinex$1 {
|
|
|
2425
2618
|
let response = undefined;
|
|
2426
2619
|
if (market['spot']) {
|
|
2427
2620
|
request['batch_ids'] = idsString;
|
|
2428
|
-
response = await this.
|
|
2621
|
+
response = await this.v1PrivateDeleteOrderPendingBatch(this.extend(request, params));
|
|
2429
2622
|
}
|
|
2430
2623
|
else {
|
|
2431
2624
|
request['order_ids'] = idsString;
|
|
2432
|
-
response = await this.
|
|
2625
|
+
response = await this.v1PerpetualPrivatePostOrderCancelBatch(this.extend(request, params));
|
|
2433
2626
|
}
|
|
2434
2627
|
//
|
|
2435
2628
|
// spot
|
|
@@ -2566,7 +2759,7 @@ class coinex extends coinex$1 {
|
|
|
2566
2759
|
if (price !== undefined) {
|
|
2567
2760
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
2568
2761
|
}
|
|
2569
|
-
const response = await this.
|
|
2762
|
+
const response = await this.v1PrivatePostOrderModify(this.extend(request, params));
|
|
2570
2763
|
//
|
|
2571
2764
|
// {
|
|
2572
2765
|
// "code": 0,
|
|
@@ -2647,18 +2840,18 @@ class coinex extends coinex$1 {
|
|
|
2647
2840
|
request['client_id'] = clientOrderId;
|
|
2648
2841
|
if (stop) {
|
|
2649
2842
|
if (swap) {
|
|
2650
|
-
response = await this.
|
|
2843
|
+
response = await this.v1PerpetualPrivatePostOrderCancelStopByClientId(this.extend(request, query));
|
|
2651
2844
|
}
|
|
2652
2845
|
else {
|
|
2653
|
-
response = await this.
|
|
2846
|
+
response = await this.v1PrivateDeleteOrderStopPendingByClientId(this.extend(request, query));
|
|
2654
2847
|
}
|
|
2655
2848
|
}
|
|
2656
2849
|
else {
|
|
2657
2850
|
if (swap) {
|
|
2658
|
-
response = await this.
|
|
2851
|
+
response = await this.v1PerpetualPrivatePostOrderCancelByClientId(this.extend(request, query));
|
|
2659
2852
|
}
|
|
2660
2853
|
else {
|
|
2661
|
-
response = await this.
|
|
2854
|
+
response = await this.v1PrivateDeleteOrderPendingByClientId(this.extend(request, query));
|
|
2662
2855
|
}
|
|
2663
2856
|
}
|
|
2664
2857
|
}
|
|
@@ -2667,18 +2860,18 @@ class coinex extends coinex$1 {
|
|
|
2667
2860
|
request[idRequest] = id;
|
|
2668
2861
|
if (stop) {
|
|
2669
2862
|
if (swap) {
|
|
2670
|
-
response = await this.
|
|
2863
|
+
response = await this.v1PerpetualPrivatePostOrderCancelStop(this.extend(request, query));
|
|
2671
2864
|
}
|
|
2672
2865
|
else {
|
|
2673
|
-
response = await this.
|
|
2866
|
+
response = await this.v1PrivateDeleteOrderStopPendingId(this.extend(request, query));
|
|
2674
2867
|
}
|
|
2675
2868
|
}
|
|
2676
2869
|
else {
|
|
2677
2870
|
if (swap) {
|
|
2678
|
-
response = await this.
|
|
2871
|
+
response = await this.v1PerpetualPrivatePostOrderCancel(this.extend(request, query));
|
|
2679
2872
|
}
|
|
2680
2873
|
else {
|
|
2681
|
-
response = await this.
|
|
2874
|
+
response = await this.v1PrivateDeleteOrderPending(this.extend(request, query));
|
|
2682
2875
|
}
|
|
2683
2876
|
}
|
|
2684
2877
|
}
|
|
@@ -2822,19 +3015,19 @@ class coinex extends coinex$1 {
|
|
|
2822
3015
|
let response = undefined;
|
|
2823
3016
|
if (swap) {
|
|
2824
3017
|
if (stop) {
|
|
2825
|
-
response = await this.
|
|
3018
|
+
response = await this.v1PerpetualPrivatePostOrderCancelStopAll(this.extend(request, params));
|
|
2826
3019
|
}
|
|
2827
3020
|
else {
|
|
2828
|
-
response = await this.
|
|
3021
|
+
response = await this.v1PerpetualPrivatePostOrderCancelAll(this.extend(request, params));
|
|
2829
3022
|
}
|
|
2830
3023
|
}
|
|
2831
3024
|
else {
|
|
2832
3025
|
request['account_id'] = accountId;
|
|
2833
3026
|
if (stop) {
|
|
2834
|
-
response = await this.
|
|
3027
|
+
response = await this.v1PrivateDeleteOrderStopPending(this.extend(request, params));
|
|
2835
3028
|
}
|
|
2836
3029
|
else {
|
|
2837
|
-
response = await this.
|
|
3030
|
+
response = await this.v1PrivateDeleteOrderPending(this.extend(request, params));
|
|
2838
3031
|
}
|
|
2839
3032
|
}
|
|
2840
3033
|
//
|
|
@@ -2878,14 +3071,14 @@ class coinex extends coinex$1 {
|
|
|
2878
3071
|
let response = undefined;
|
|
2879
3072
|
if (swap) {
|
|
2880
3073
|
if (stop) {
|
|
2881
|
-
response = await this.
|
|
3074
|
+
response = await this.v1PerpetualPrivateGetOrderStopStatus(this.extend(request, params));
|
|
2882
3075
|
}
|
|
2883
3076
|
else {
|
|
2884
|
-
response = await this.
|
|
3077
|
+
response = await this.v1PerpetualPrivateGetOrderStatus(this.extend(request, params));
|
|
2885
3078
|
}
|
|
2886
3079
|
}
|
|
2887
3080
|
else {
|
|
2888
|
-
response = await this.
|
|
3081
|
+
response = await this.v1PrivateGetOrderStatus(this.extend(request, params));
|
|
2889
3082
|
}
|
|
2890
3083
|
//
|
|
2891
3084
|
// Spot
|
|
@@ -3029,14 +3222,14 @@ class coinex extends coinex$1 {
|
|
|
3029
3222
|
}
|
|
3030
3223
|
request['offset'] = 0;
|
|
3031
3224
|
if (stop) {
|
|
3032
|
-
response = await this.
|
|
3225
|
+
response = await this.v1PerpetualPrivateGetOrderStopPending(this.extend(request, params));
|
|
3033
3226
|
}
|
|
3034
3227
|
else {
|
|
3035
3228
|
if (status === 'finished') {
|
|
3036
|
-
response = await this.
|
|
3229
|
+
response = await this.v1PerpetualPrivateGetOrderFinished(this.extend(request, params));
|
|
3037
3230
|
}
|
|
3038
3231
|
else if (status === 'pending') {
|
|
3039
|
-
response = await this.
|
|
3232
|
+
response = await this.v1PerpetualPrivateGetOrderPending(this.extend(request, params));
|
|
3040
3233
|
}
|
|
3041
3234
|
}
|
|
3042
3235
|
}
|
|
@@ -3044,18 +3237,18 @@ class coinex extends coinex$1 {
|
|
|
3044
3237
|
request['page'] = 1;
|
|
3045
3238
|
if (status === 'finished') {
|
|
3046
3239
|
if (stop) {
|
|
3047
|
-
response = await this.
|
|
3240
|
+
response = await this.v1PrivateGetOrderStopFinished(this.extend(request, params));
|
|
3048
3241
|
}
|
|
3049
3242
|
else {
|
|
3050
|
-
response = await this.
|
|
3243
|
+
response = await this.v1PrivateGetOrderFinished(this.extend(request, params));
|
|
3051
3244
|
}
|
|
3052
3245
|
}
|
|
3053
3246
|
else if (status === 'pending') {
|
|
3054
3247
|
if (stop) {
|
|
3055
|
-
response = await this.
|
|
3248
|
+
response = await this.v1PrivateGetOrderStopPending(this.extend(request, params));
|
|
3056
3249
|
}
|
|
3057
3250
|
else {
|
|
3058
|
-
response = await this.
|
|
3251
|
+
response = await this.v1PrivateGetOrderPending(this.extend(request, params));
|
|
3059
3252
|
}
|
|
3060
3253
|
}
|
|
3061
3254
|
}
|
|
@@ -3267,7 +3460,7 @@ class coinex extends coinex$1 {
|
|
|
3267
3460
|
params = this.omit(params, 'network');
|
|
3268
3461
|
request['smart_contract_name'] = network;
|
|
3269
3462
|
}
|
|
3270
|
-
const response = await this.
|
|
3463
|
+
const response = await this.v1PrivatePutBalanceDepositAddressCoinType(this.extend(request, params));
|
|
3271
3464
|
//
|
|
3272
3465
|
// {
|
|
3273
3466
|
// "code": 0,
|
|
@@ -3311,7 +3504,7 @@ class coinex extends coinex$1 {
|
|
|
3311
3504
|
if (network !== undefined) {
|
|
3312
3505
|
request['smart_contract_name'] = network;
|
|
3313
3506
|
}
|
|
3314
|
-
const response = await this.
|
|
3507
|
+
const response = await this.v1PrivateGetBalanceDepositAddressCoinType(this.extend(request, params));
|
|
3315
3508
|
//
|
|
3316
3509
|
// {
|
|
3317
3510
|
// "code": 0,
|
|
@@ -3427,11 +3620,11 @@ class coinex extends coinex$1 {
|
|
|
3427
3620
|
request['start_time'] = since;
|
|
3428
3621
|
}
|
|
3429
3622
|
request['side'] = 0;
|
|
3430
|
-
response = await this.
|
|
3623
|
+
response = await this.v1PerpetualPrivateGetMarketUserDeals(this.extend(request, params));
|
|
3431
3624
|
}
|
|
3432
3625
|
else {
|
|
3433
3626
|
request['page'] = 1;
|
|
3434
|
-
response = await this.
|
|
3627
|
+
response = await this.v1PrivateGetOrderUserDeals(this.extend(request, params));
|
|
3435
3628
|
}
|
|
3436
3629
|
//
|
|
3437
3630
|
// Spot and Margin
|
|
@@ -3525,8 +3718,8 @@ class coinex extends coinex$1 {
|
|
|
3525
3718
|
*/
|
|
3526
3719
|
await this.loadMarkets();
|
|
3527
3720
|
let defaultMethod = undefined;
|
|
3528
|
-
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', '
|
|
3529
|
-
const isHistory = (defaultMethod === '
|
|
3721
|
+
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'v1PerpetualPrivateGetPositionPending');
|
|
3722
|
+
const isHistory = (defaultMethod === 'v1PerpetualPrivateGetPositionFinished');
|
|
3530
3723
|
symbols = this.marketSymbols(symbols);
|
|
3531
3724
|
const request = {};
|
|
3532
3725
|
let market = undefined;
|
|
@@ -3555,11 +3748,11 @@ class coinex extends coinex$1 {
|
|
|
3555
3748
|
request['side'] = this.safeInteger(params, 'side', 0); // 0: All, 1: Sell, 2: Buy
|
|
3556
3749
|
}
|
|
3557
3750
|
let response = undefined;
|
|
3558
|
-
if (defaultMethod === '
|
|
3559
|
-
response = await this.
|
|
3751
|
+
if (defaultMethod === 'v1PerpetualPrivateGetPositionPending') {
|
|
3752
|
+
response = await this.v1PerpetualPrivateGetPositionPending(this.extend(request, params));
|
|
3560
3753
|
}
|
|
3561
3754
|
else {
|
|
3562
|
-
response = await this.
|
|
3755
|
+
response = await this.v1PerpetualPrivateGetPositionFinished(this.extend(request, params));
|
|
3563
3756
|
}
|
|
3564
3757
|
//
|
|
3565
3758
|
// {
|
|
@@ -3642,7 +3835,7 @@ class coinex extends coinex$1 {
|
|
|
3642
3835
|
const request = {
|
|
3643
3836
|
'market': market['id'],
|
|
3644
3837
|
};
|
|
3645
|
-
const response = await this.
|
|
3838
|
+
const response = await this.v1PerpetualPrivateGetPositionPending(this.extend(request, params));
|
|
3646
3839
|
//
|
|
3647
3840
|
// {
|
|
3648
3841
|
// "code": 0,
|
|
@@ -3856,7 +4049,7 @@ class coinex extends coinex$1 {
|
|
|
3856
4049
|
'leverage': leverage.toString(),
|
|
3857
4050
|
'position_type': positionType, // 1: isolated, 2: cross
|
|
3858
4051
|
};
|
|
3859
|
-
return await this.
|
|
4052
|
+
return await this.v1PerpetualPrivatePostMarketAdjustLeverage(this.extend(request, params));
|
|
3860
4053
|
}
|
|
3861
4054
|
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
3862
4055
|
/**
|
|
@@ -3897,7 +4090,7 @@ class coinex extends coinex$1 {
|
|
|
3897
4090
|
'leverage': leverage.toString(),
|
|
3898
4091
|
'position_type': positionType, // 1: isolated, 2: cross
|
|
3899
4092
|
};
|
|
3900
|
-
return await this.
|
|
4093
|
+
return await this.v1PerpetualPrivatePostMarketAdjustLeverage(this.extend(request, params));
|
|
3901
4094
|
}
|
|
3902
4095
|
async fetchLeverageTiers(symbols = undefined, params = {}) {
|
|
3903
4096
|
/**
|
|
@@ -3910,7 +4103,7 @@ class coinex extends coinex$1 {
|
|
|
3910
4103
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
3911
4104
|
*/
|
|
3912
4105
|
await this.loadMarkets();
|
|
3913
|
-
const response = await this.
|
|
4106
|
+
const response = await this.v1PerpetualPublicGetMarketLimitConfig(params);
|
|
3914
4107
|
//
|
|
3915
4108
|
// {
|
|
3916
4109
|
// "code": 0,
|
|
@@ -3988,7 +4181,7 @@ class coinex extends coinex$1 {
|
|
|
3988
4181
|
'amount': this.amountToPrecision(symbol, amount),
|
|
3989
4182
|
'type': addOrReduce,
|
|
3990
4183
|
};
|
|
3991
|
-
const response = await this.
|
|
4184
|
+
const response = await this.v1PerpetualPrivatePostPositionAdjustMargin(this.extend(request, params));
|
|
3992
4185
|
//
|
|
3993
4186
|
// {
|
|
3994
4187
|
// "code": 0,
|
|
@@ -4055,13 +4248,72 @@ class coinex extends coinex$1 {
|
|
|
4055
4248
|
});
|
|
4056
4249
|
}
|
|
4057
4250
|
parseMarginModification(data, market = undefined) {
|
|
4251
|
+
//
|
|
4252
|
+
// addMargin/reduceMargin
|
|
4253
|
+
//
|
|
4254
|
+
// {
|
|
4255
|
+
// "adl_sort": 1,
|
|
4256
|
+
// "adl_sort_val": "0.00004320",
|
|
4257
|
+
// "amount": "0.0005",
|
|
4258
|
+
// "amount_max": "0.0005",
|
|
4259
|
+
// "amount_max_margin": "6.57352000000000000000",
|
|
4260
|
+
// "bkr_price": "16294.08000000000000011090",
|
|
4261
|
+
// "bkr_price_imply": "0.00000000000000000000",
|
|
4262
|
+
// "close_left": "0.0005",
|
|
4263
|
+
// "create_time": 1651202571.320778,
|
|
4264
|
+
// "deal_all": "19.72000000000000000000",
|
|
4265
|
+
// "deal_asset_fee": "0.00000000000000000000",
|
|
4266
|
+
// "fee_asset": "",
|
|
4267
|
+
// "finish_type": 1,
|
|
4268
|
+
// "first_price": "39441.12",
|
|
4269
|
+
// "insurance": "0.00000000000000000000",
|
|
4270
|
+
// "latest_price": "39441.12",
|
|
4271
|
+
// "leverage": "3",
|
|
4272
|
+
// "liq_amount": "0.00000000000000000000",
|
|
4273
|
+
// "liq_order_price": "0",
|
|
4274
|
+
// "liq_order_time": 0,
|
|
4275
|
+
// "liq_price": "16491.28560000000000011090",
|
|
4276
|
+
// "liq_price_imply": "0.00000000000000000000",
|
|
4277
|
+
// "liq_profit": "0.00000000000000000000",
|
|
4278
|
+
// "liq_time": 0,
|
|
4279
|
+
// "mainten_margin": "0.005",
|
|
4280
|
+
// "mainten_margin_amount": "0.09860280000000000000",
|
|
4281
|
+
// "maker_fee": "0.00000000000000000000",
|
|
4282
|
+
// "margin_amount": "11.57352000000000000000",
|
|
4283
|
+
// "market": "BTCUSDT",
|
|
4284
|
+
// "open_margin": "0.58687582908396110455",
|
|
4285
|
+
// "open_margin_imply": "0.00000000000000000000",
|
|
4286
|
+
// "open_price": "39441.12000000000000000000",
|
|
4287
|
+
// "open_val": "19.72056000000000000000",
|
|
4288
|
+
// "open_val_max": "19.72056000000000000000",
|
|
4289
|
+
// "position_id": 65171206,
|
|
4290
|
+
// "profit_clearing": "-0.00986028000000000000",
|
|
4291
|
+
// "profit_real": "-0.00986028000000000000",
|
|
4292
|
+
// "profit_unreal": "0.00",
|
|
4293
|
+
// "side": 2,
|
|
4294
|
+
// "stop_loss_price": "0.00000000000000000000",
|
|
4295
|
+
// "stop_loss_type": 0,
|
|
4296
|
+
// "sys": 0,
|
|
4297
|
+
// "take_profit_price": "0.00000000000000000000",
|
|
4298
|
+
// "take_profit_type": 0,
|
|
4299
|
+
// "taker_fee": "0.00000000000000000000",
|
|
4300
|
+
// "total": 3464,
|
|
4301
|
+
// "type": 1,
|
|
4302
|
+
// "update_time": 1651202638.911212,
|
|
4303
|
+
// "user_id": 3620173
|
|
4304
|
+
// }
|
|
4305
|
+
//
|
|
4306
|
+
const timestamp = this.safeIntegerProduct(data, 'update_time', 1000);
|
|
4058
4307
|
return {
|
|
4059
4308
|
'info': data,
|
|
4309
|
+
'symbol': this.safeSymbol(undefined, market),
|
|
4060
4310
|
'type': undefined,
|
|
4061
|
-
'amount':
|
|
4311
|
+
'amount': this.safeNumber(data, 'margin_amount'),
|
|
4312
|
+
'total': undefined,
|
|
4062
4313
|
'code': market['quote'],
|
|
4063
|
-
'symbol': this.safeSymbol(undefined, market),
|
|
4064
4314
|
'status': undefined,
|
|
4315
|
+
'timestamp': timestamp,
|
|
4316
|
+
'datetime': this.iso8601(timestamp),
|
|
4065
4317
|
};
|
|
4066
4318
|
}
|
|
4067
4319
|
async addMargin(symbol, amount, params = {}) {
|
|
@@ -4118,7 +4370,7 @@ class coinex extends coinex$1 {
|
|
|
4118
4370
|
if (since !== undefined) {
|
|
4119
4371
|
request['start_time'] = since;
|
|
4120
4372
|
}
|
|
4121
|
-
const response = await this.
|
|
4373
|
+
const response = await this.v1PerpetualPrivateGetPositionFunding(this.extend(request, params));
|
|
4122
4374
|
//
|
|
4123
4375
|
// {
|
|
4124
4376
|
// "code": 0,
|
|
@@ -4184,7 +4436,7 @@ class coinex extends coinex$1 {
|
|
|
4184
4436
|
const request = {
|
|
4185
4437
|
'market': market['id'],
|
|
4186
4438
|
};
|
|
4187
|
-
const response = await this.
|
|
4439
|
+
const response = await this.v1PerpetualPublicGetMarketTicker(this.extend(request, params));
|
|
4188
4440
|
//
|
|
4189
4441
|
// {
|
|
4190
4442
|
// "code": 0,
|
|
@@ -4295,7 +4547,7 @@ class coinex extends coinex$1 {
|
|
|
4295
4547
|
throw new errors.BadSymbol(this.id + ' fetchFundingRates() supports swap contracts only');
|
|
4296
4548
|
}
|
|
4297
4549
|
}
|
|
4298
|
-
const response = await this.
|
|
4550
|
+
const response = await this.v1PerpetualPublicGetMarketTickerAll(params);
|
|
4299
4551
|
//
|
|
4300
4552
|
// {
|
|
4301
4553
|
// "code": 0,
|
|
@@ -4377,7 +4629,7 @@ class coinex extends coinex$1 {
|
|
|
4377
4629
|
if (networkCode !== undefined) {
|
|
4378
4630
|
request['smart_contract_name'] = this.networkCodeToId(networkCode);
|
|
4379
4631
|
}
|
|
4380
|
-
const response = await this.
|
|
4632
|
+
const response = await this.v1PrivatePostBalanceCoinWithdraw(this.extend(request, params));
|
|
4381
4633
|
//
|
|
4382
4634
|
// {
|
|
4383
4635
|
// "code": 0,
|
|
@@ -4449,7 +4701,7 @@ class coinex extends coinex$1 {
|
|
|
4449
4701
|
request['start_time'] = since;
|
|
4450
4702
|
}
|
|
4451
4703
|
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
4452
|
-
const response = await this.
|
|
4704
|
+
const response = await this.v1PerpetualPublicGetMarketFundingHistory(this.extend(request, params));
|
|
4453
4705
|
//
|
|
4454
4706
|
// {
|
|
4455
4707
|
// "code": 0,
|
|
@@ -4626,11 +4878,11 @@ class coinex extends coinex$1 {
|
|
|
4626
4878
|
let response = undefined;
|
|
4627
4879
|
if ((fromAccount === 'spot') && (toAccount === 'swap')) {
|
|
4628
4880
|
request['transfer_side'] = 'in'; // 'in' spot to swap, 'out' swap to spot
|
|
4629
|
-
response = await this.
|
|
4881
|
+
response = await this.v1PrivatePostContractBalanceTransfer(this.extend(request, params));
|
|
4630
4882
|
}
|
|
4631
4883
|
else if ((fromAccount === 'swap') && (toAccount === 'spot')) {
|
|
4632
4884
|
request['transfer_side'] = 'out'; // 'in' spot to swap, 'out' swap to spot
|
|
4633
|
-
response = await this.
|
|
4885
|
+
response = await this.v1PrivatePostContractBalanceTransfer(this.extend(request, params));
|
|
4634
4886
|
}
|
|
4635
4887
|
else {
|
|
4636
4888
|
const accountsById = this.safeValue(this.options, 'accountsById', {});
|
|
@@ -4640,7 +4892,7 @@ class coinex extends coinex$1 {
|
|
|
4640
4892
|
// spot is 0, use fetchBalance() to find the margin account id
|
|
4641
4893
|
request['from_account'] = parseInt(fromId);
|
|
4642
4894
|
request['to_account'] = parseInt(toId);
|
|
4643
|
-
response = await this.
|
|
4895
|
+
response = await this.v1PrivatePostMarginTransfer(this.extend(request, params));
|
|
4644
4896
|
}
|
|
4645
4897
|
//
|
|
4646
4898
|
// {"code": 0, "data": null, "message": "Success"}
|
|
@@ -4763,10 +5015,10 @@ class coinex extends coinex$1 {
|
|
|
4763
5015
|
[marginMode, params] = this.handleMarginModeAndParams('fetchTransfers', params);
|
|
4764
5016
|
let response = undefined;
|
|
4765
5017
|
if (marginMode !== undefined) {
|
|
4766
|
-
response = await this.
|
|
5018
|
+
response = await this.v1PrivateGetMarginTransferHistory(this.extend(request, params));
|
|
4767
5019
|
}
|
|
4768
5020
|
else {
|
|
4769
|
-
response = await this.
|
|
5021
|
+
response = await this.v1PrivateGetContractTransferHistory(this.extend(request, params));
|
|
4770
5022
|
}
|
|
4771
5023
|
//
|
|
4772
5024
|
// Swap
|
|
@@ -4838,7 +5090,7 @@ class coinex extends coinex$1 {
|
|
|
4838
5090
|
if (limit !== undefined) {
|
|
4839
5091
|
request['Limit'] = limit;
|
|
4840
5092
|
}
|
|
4841
|
-
const response = await this.
|
|
5093
|
+
const response = await this.v1PrivateGetBalanceCoinWithdraw(this.extend(request, params));
|
|
4842
5094
|
//
|
|
4843
5095
|
// {
|
|
4844
5096
|
// "code": 0,
|
|
@@ -4905,7 +5157,7 @@ class coinex extends coinex$1 {
|
|
|
4905
5157
|
if (limit !== undefined) {
|
|
4906
5158
|
request['Limit'] = limit;
|
|
4907
5159
|
}
|
|
4908
|
-
const response = await this.
|
|
5160
|
+
const response = await this.v1PrivateGetBalanceCoinDeposit(this.extend(request, params));
|
|
4909
5161
|
//
|
|
4910
5162
|
// {
|
|
4911
5163
|
// "code": 0,
|
|
@@ -4998,7 +5250,7 @@ class coinex extends coinex$1 {
|
|
|
4998
5250
|
const request = {
|
|
4999
5251
|
'market': market['id'],
|
|
5000
5252
|
};
|
|
5001
|
-
const response = await this.
|
|
5253
|
+
const response = await this.v1PrivateGetMarginConfig(this.extend(request, params));
|
|
5002
5254
|
//
|
|
5003
5255
|
// {
|
|
5004
5256
|
// "code": 0,
|
|
@@ -5032,7 +5284,7 @@ class coinex extends coinex$1 {
|
|
|
5032
5284
|
* @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
5033
5285
|
*/
|
|
5034
5286
|
await this.loadMarkets();
|
|
5035
|
-
const response = await this.
|
|
5287
|
+
const response = await this.v1PrivateGetMarginConfig(params);
|
|
5036
5288
|
//
|
|
5037
5289
|
// {
|
|
5038
5290
|
// "code": 0,
|
|
@@ -5073,7 +5325,7 @@ class coinex extends coinex$1 {
|
|
|
5073
5325
|
if (limit !== undefined) {
|
|
5074
5326
|
request['limit'] = limit;
|
|
5075
5327
|
}
|
|
5076
|
-
const response = await this.
|
|
5328
|
+
const response = await this.v1PrivateGetMarginLoanHistory(this.extend(request, params));
|
|
5077
5329
|
//
|
|
5078
5330
|
// {
|
|
5079
5331
|
// "code": 0,
|
|
@@ -5169,7 +5421,7 @@ class coinex extends coinex$1 {
|
|
|
5169
5421
|
'coin_type': currency['id'],
|
|
5170
5422
|
'amount': this.currencyToPrecision(code, amount),
|
|
5171
5423
|
};
|
|
5172
|
-
const response = await this.
|
|
5424
|
+
const response = await this.v1PrivatePostMarginLoan(this.extend(request, params));
|
|
5173
5425
|
//
|
|
5174
5426
|
// {
|
|
5175
5427
|
// "code": 0,
|
|
@@ -5207,7 +5459,7 @@ class coinex extends coinex$1 {
|
|
|
5207
5459
|
'coin_type': currency['id'],
|
|
5208
5460
|
'amount': this.currencyToPrecision(code, amount),
|
|
5209
5461
|
};
|
|
5210
|
-
const response = await this.
|
|
5462
|
+
const response = await this.v1PrivatePostMarginFlat(this.extend(request, params));
|
|
5211
5463
|
//
|
|
5212
5464
|
// {
|
|
5213
5465
|
// "code": 0,
|
|
@@ -5265,7 +5517,7 @@ class coinex extends coinex$1 {
|
|
|
5265
5517
|
request['coin_type'] = this.safeValue(codes, 0);
|
|
5266
5518
|
}
|
|
5267
5519
|
}
|
|
5268
|
-
const response = await this.
|
|
5520
|
+
const response = await this.v1PublicGetCommonAssetConfig(this.extend(request, params));
|
|
5269
5521
|
//
|
|
5270
5522
|
// {
|
|
5271
5523
|
// "code": 0,
|
|
@@ -5365,7 +5617,7 @@ class coinex extends coinex$1 {
|
|
|
5365
5617
|
if (marketType !== 'spot') {
|
|
5366
5618
|
throw new errors.NotSupported(this.id + ' fetchLeverages() supports spot margin markets only');
|
|
5367
5619
|
}
|
|
5368
|
-
const response = await this.
|
|
5620
|
+
const response = await this.v1PrivateGetMarginConfig(params);
|
|
5369
5621
|
//
|
|
5370
5622
|
// {
|
|
5371
5623
|
// "code": 0,
|
|
@@ -5424,9 +5676,11 @@ class coinex extends coinex$1 {
|
|
|
5424
5676
|
nonce() {
|
|
5425
5677
|
return this.milliseconds();
|
|
5426
5678
|
}
|
|
5427
|
-
sign(path, api =
|
|
5679
|
+
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
5428
5680
|
path = this.implodeParams(path, params);
|
|
5429
|
-
|
|
5681
|
+
const version = api[0];
|
|
5682
|
+
const requestUrl = api[1];
|
|
5683
|
+
let url = this.urls['api'][requestUrl] + '/' + version + '/' + path;
|
|
5430
5684
|
let query = this.omit(params, this.extractParams(path));
|
|
5431
5685
|
const nonce = this.nonce().toString();
|
|
5432
5686
|
if (method === 'POST') {
|
|
@@ -5455,7 +5709,7 @@ class coinex extends coinex$1 {
|
|
|
5455
5709
|
}
|
|
5456
5710
|
}
|
|
5457
5711
|
}
|
|
5458
|
-
if (
|
|
5712
|
+
if (requestUrl === 'perpetualPrivate') {
|
|
5459
5713
|
this.checkRequiredCredentials();
|
|
5460
5714
|
query = this.extend({
|
|
5461
5715
|
'access_id': this.apiKey,
|
|
@@ -5476,29 +5730,49 @@ class coinex extends coinex$1 {
|
|
|
5476
5730
|
body = urlencoded;
|
|
5477
5731
|
}
|
|
5478
5732
|
}
|
|
5479
|
-
else if (
|
|
5733
|
+
else if (requestUrl === 'public' || requestUrl === 'perpetualPublic') {
|
|
5480
5734
|
if (Object.keys(query).length) {
|
|
5481
5735
|
url += '?' + this.urlencode(query);
|
|
5482
5736
|
}
|
|
5483
5737
|
}
|
|
5484
5738
|
else {
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5739
|
+
if (version === 'v1') {
|
|
5740
|
+
this.checkRequiredCredentials();
|
|
5741
|
+
query = this.extend({
|
|
5742
|
+
'access_id': this.apiKey,
|
|
5743
|
+
'tonce': nonce,
|
|
5744
|
+
}, query);
|
|
5745
|
+
query = this.keysort(query);
|
|
5746
|
+
const urlencoded = this.rawencode(query);
|
|
5747
|
+
const signature = this.hash(this.encode(urlencoded + '&secret_key=' + this.secret), md5.md5);
|
|
5748
|
+
headers = {
|
|
5749
|
+
'Authorization': signature.toUpperCase(),
|
|
5750
|
+
'Content-Type': 'application/json',
|
|
5751
|
+
};
|
|
5752
|
+
if ((method === 'GET') || (method === 'DELETE') || (method === 'PUT')) {
|
|
5753
|
+
url += '?' + urlencoded;
|
|
5754
|
+
}
|
|
5755
|
+
else {
|
|
5756
|
+
body = this.json(query);
|
|
5757
|
+
}
|
|
5499
5758
|
}
|
|
5500
|
-
else {
|
|
5501
|
-
|
|
5759
|
+
else if (version === 'v2') {
|
|
5760
|
+
this.checkRequiredCredentials();
|
|
5761
|
+
query = this.keysort(query);
|
|
5762
|
+
const urlencoded = this.rawencode(query);
|
|
5763
|
+
const preparedString = method + '/' + version + '/' + path + '?' + urlencoded + nonce + this.secret;
|
|
5764
|
+
const signature = this.hash(this.encode(preparedString), sha256.sha256);
|
|
5765
|
+
headers = {
|
|
5766
|
+
'X-COINEX-KEY': this.apiKey,
|
|
5767
|
+
'X-COINEX-SIGN': signature,
|
|
5768
|
+
'X-COINEX-TIMESTAMP': nonce,
|
|
5769
|
+
};
|
|
5770
|
+
if ((method === 'GET') || (method === 'DELETE') || (method === 'PUT')) {
|
|
5771
|
+
url += '?' + urlencoded;
|
|
5772
|
+
}
|
|
5773
|
+
else {
|
|
5774
|
+
body = this.json(query);
|
|
5775
|
+
}
|
|
5502
5776
|
}
|
|
5503
5777
|
}
|
|
5504
5778
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|