ccxt 4.2.85 → 4.2.86
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/build.sh +1 -1
- package/dist/ccxt.browser.js +465 -306
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bingx.js +34 -19
- package/dist/cjs/src/bitbank.js +19 -23
- package/dist/cjs/src/coinex.js +397 -251
- package/dist/cjs/src/idex.js +10 -11
- package/dist/cjs/src/okcoin.js +3 -1
- package/dist/cjs/src/pro/bitget.js +1 -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/base/Exchange.d.ts +9 -9
- package/js/src/bingx.js +34 -19
- package/js/src/bitbank.js +19 -23
- package/js/src/coinex.d.ts +1 -1
- package/js/src/coinex.js +397 -251
- package/js/src/idex.js +10 -11
- package/js/src/okcoin.js +3 -1
- package/js/src/pro/bitget.js +1 -0
- package/package.json +1 -1
- package/skip-tests.json +4 -0
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
|
|
@@ -945,7 +1069,7 @@ class coinex extends coinex$1 {
|
|
|
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.v1PerpetualPublicGetTime(params);
|
|
949
1073
|
//
|
|
950
1074
|
// {
|
|
951
1075
|
// "code": "0",
|
|
@@ -979,10 +1103,10 @@ class coinex extends coinex$1 {
|
|
|
979
1103
|
};
|
|
980
1104
|
let response = undefined;
|
|
981
1105
|
if (market['swap']) {
|
|
982
|
-
response = await this.
|
|
1106
|
+
response = await this.v1PerpetualPublicGetMarketDepth(this.extend(request, params));
|
|
983
1107
|
}
|
|
984
1108
|
else {
|
|
985
|
-
response = await this.
|
|
1109
|
+
response = await this.v1PublicGetMarketDepth(this.extend(request, params));
|
|
986
1110
|
}
|
|
987
1111
|
//
|
|
988
1112
|
// Spot
|
|
@@ -1183,10 +1307,10 @@ class coinex extends coinex$1 {
|
|
|
1183
1307
|
}
|
|
1184
1308
|
let response = undefined;
|
|
1185
1309
|
if (market['swap']) {
|
|
1186
|
-
response = await this.
|
|
1310
|
+
response = await this.v1PerpetualPublicGetMarketDeals(this.extend(request, params));
|
|
1187
1311
|
}
|
|
1188
1312
|
else {
|
|
1189
|
-
response = await this.
|
|
1313
|
+
response = await this.v1PublicGetMarketDeals(this.extend(request, params));
|
|
1190
1314
|
}
|
|
1191
1315
|
//
|
|
1192
1316
|
// Spot and Swap
|
|
@@ -1223,7 +1347,7 @@ class coinex extends coinex$1 {
|
|
|
1223
1347
|
const request = {
|
|
1224
1348
|
'market': market['id'],
|
|
1225
1349
|
};
|
|
1226
|
-
const response = await this.
|
|
1350
|
+
const response = await this.v1PublicGetMarketDetail(this.extend(request, params));
|
|
1227
1351
|
//
|
|
1228
1352
|
// {
|
|
1229
1353
|
// "code": 0,
|
|
@@ -1253,7 +1377,7 @@ class coinex extends coinex$1 {
|
|
|
1253
1377
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
1254
1378
|
*/
|
|
1255
1379
|
await this.loadMarkets();
|
|
1256
|
-
const response = await this.
|
|
1380
|
+
const response = await this.v1PublicGetMarketInfo(params);
|
|
1257
1381
|
//
|
|
1258
1382
|
// {
|
|
1259
1383
|
// "code": 0,
|
|
@@ -1341,10 +1465,10 @@ class coinex extends coinex$1 {
|
|
|
1341
1465
|
}
|
|
1342
1466
|
let response = undefined;
|
|
1343
1467
|
if (market['swap']) {
|
|
1344
|
-
response = await this.
|
|
1468
|
+
response = await this.v1PerpetualPublicGetMarketKline(this.extend(request, params));
|
|
1345
1469
|
}
|
|
1346
1470
|
else {
|
|
1347
|
-
response = await this.
|
|
1471
|
+
response = await this.v1PublicGetMarketKline(this.extend(request, params));
|
|
1348
1472
|
}
|
|
1349
1473
|
//
|
|
1350
1474
|
// Spot
|
|
@@ -1390,7 +1514,7 @@ class coinex extends coinex$1 {
|
|
|
1390
1514
|
const request = {
|
|
1391
1515
|
'market': marketId,
|
|
1392
1516
|
};
|
|
1393
|
-
const response = await this.
|
|
1517
|
+
const response = await this.v1PrivateGetMarginAccount(this.extend(request, params));
|
|
1394
1518
|
//
|
|
1395
1519
|
// {
|
|
1396
1520
|
// "code": 0,
|
|
@@ -1457,7 +1581,7 @@ class coinex extends coinex$1 {
|
|
|
1457
1581
|
}
|
|
1458
1582
|
async fetchSpotBalance(params = {}) {
|
|
1459
1583
|
await this.loadMarkets();
|
|
1460
|
-
const response = await this.
|
|
1584
|
+
const response = await this.v1PrivateGetBalanceInfo(params);
|
|
1461
1585
|
//
|
|
1462
1586
|
// {
|
|
1463
1587
|
// "code": 0,
|
|
@@ -1494,7 +1618,7 @@ class coinex extends coinex$1 {
|
|
|
1494
1618
|
}
|
|
1495
1619
|
async fetchSwapBalance(params = {}) {
|
|
1496
1620
|
await this.loadMarkets();
|
|
1497
|
-
const response = await this.
|
|
1621
|
+
const response = await this.v1PerpetualPrivateGetAssetQuery(params);
|
|
1498
1622
|
//
|
|
1499
1623
|
// {
|
|
1500
1624
|
// "code": 0,
|
|
@@ -1528,7 +1652,7 @@ class coinex extends coinex$1 {
|
|
|
1528
1652
|
}
|
|
1529
1653
|
async fetchFinancialBalance(params = {}) {
|
|
1530
1654
|
await this.loadMarkets();
|
|
1531
|
-
const response = await this.
|
|
1655
|
+
const response = await this.v1PrivateGetAccountInvestmentBalance(params);
|
|
1532
1656
|
//
|
|
1533
1657
|
// {
|
|
1534
1658
|
// "code": 0,
|
|
@@ -2168,53 +2292,53 @@ class coinex extends coinex$1 {
|
|
|
2168
2292
|
if (market['spot']) {
|
|
2169
2293
|
if (isTriggerOrder) {
|
|
2170
2294
|
if (type === 'limit') {
|
|
2171
|
-
response = await this.
|
|
2295
|
+
response = await this.v1PrivatePostOrderStopLimit(request);
|
|
2172
2296
|
}
|
|
2173
2297
|
else {
|
|
2174
|
-
response = await this.
|
|
2298
|
+
response = await this.v1PrivatePostOrderStopMarket(request);
|
|
2175
2299
|
}
|
|
2176
2300
|
}
|
|
2177
2301
|
else {
|
|
2178
2302
|
if (type === 'limit') {
|
|
2179
|
-
response = await this.
|
|
2303
|
+
response = await this.v1PrivatePostOrderLimit(request);
|
|
2180
2304
|
}
|
|
2181
2305
|
else {
|
|
2182
|
-
response = await this.
|
|
2306
|
+
response = await this.v1PrivatePostOrderMarket(request);
|
|
2183
2307
|
}
|
|
2184
2308
|
}
|
|
2185
2309
|
}
|
|
2186
2310
|
else {
|
|
2187
2311
|
if (isTriggerOrder) {
|
|
2188
2312
|
if (type === 'limit') {
|
|
2189
|
-
response = await this.
|
|
2313
|
+
response = await this.v1PerpetualPrivatePostOrderPutStopLimit(request);
|
|
2190
2314
|
}
|
|
2191
2315
|
else {
|
|
2192
|
-
response = await this.
|
|
2316
|
+
response = await this.v1PerpetualPrivatePostOrderPutStopMarket(request);
|
|
2193
2317
|
}
|
|
2194
2318
|
}
|
|
2195
2319
|
else if (isStopLossOrTakeProfitTrigger) {
|
|
2196
2320
|
if (isStopLossTriggerOrder) {
|
|
2197
|
-
response = await this.
|
|
2321
|
+
response = await this.v1PerpetualPrivatePostPositionStopLoss(request);
|
|
2198
2322
|
}
|
|
2199
2323
|
else if (isTakeProfitTriggerOrder) {
|
|
2200
|
-
response = await this.
|
|
2324
|
+
response = await this.v1PerpetualPrivatePostPositionTakeProfit(request);
|
|
2201
2325
|
}
|
|
2202
2326
|
}
|
|
2203
2327
|
else {
|
|
2204
2328
|
if (reduceOnly) {
|
|
2205
2329
|
if (type === 'limit') {
|
|
2206
|
-
response = await this.
|
|
2330
|
+
response = await this.v1PerpetualPrivatePostOrderCloseLimit(request);
|
|
2207
2331
|
}
|
|
2208
2332
|
else {
|
|
2209
|
-
response = await this.
|
|
2333
|
+
response = await this.v1PerpetualPrivatePostOrderCloseMarket(request);
|
|
2210
2334
|
}
|
|
2211
2335
|
}
|
|
2212
2336
|
else {
|
|
2213
2337
|
if (type === 'limit') {
|
|
2214
|
-
response = await this.
|
|
2338
|
+
response = await this.v1PerpetualPrivatePostOrderPutLimit(request);
|
|
2215
2339
|
}
|
|
2216
2340
|
else {
|
|
2217
|
-
response = await this.
|
|
2341
|
+
response = await this.v1PerpetualPrivatePostOrderPutMarket(request);
|
|
2218
2342
|
}
|
|
2219
2343
|
}
|
|
2220
2344
|
}
|
|
@@ -2342,7 +2466,7 @@ class coinex extends coinex$1 {
|
|
|
2342
2466
|
'market': market['id'],
|
|
2343
2467
|
'batch_orders': this.json(ordersRequests),
|
|
2344
2468
|
};
|
|
2345
|
-
const response = await this.
|
|
2469
|
+
const response = await this.v1PrivatePostOrderLimitBatch(request);
|
|
2346
2470
|
//
|
|
2347
2471
|
// {
|
|
2348
2472
|
// "code": 0,
|
|
@@ -2425,11 +2549,11 @@ class coinex extends coinex$1 {
|
|
|
2425
2549
|
let response = undefined;
|
|
2426
2550
|
if (market['spot']) {
|
|
2427
2551
|
request['batch_ids'] = idsString;
|
|
2428
|
-
response = await this.
|
|
2552
|
+
response = await this.v1PrivateDeleteOrderPendingBatch(this.extend(request, params));
|
|
2429
2553
|
}
|
|
2430
2554
|
else {
|
|
2431
2555
|
request['order_ids'] = idsString;
|
|
2432
|
-
response = await this.
|
|
2556
|
+
response = await this.v1PerpetualPrivatePostOrderCancelBatch(this.extend(request, params));
|
|
2433
2557
|
}
|
|
2434
2558
|
//
|
|
2435
2559
|
// spot
|
|
@@ -2566,7 +2690,7 @@ class coinex extends coinex$1 {
|
|
|
2566
2690
|
if (price !== undefined) {
|
|
2567
2691
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
2568
2692
|
}
|
|
2569
|
-
const response = await this.
|
|
2693
|
+
const response = await this.v1PrivatePostOrderModify(this.extend(request, params));
|
|
2570
2694
|
//
|
|
2571
2695
|
// {
|
|
2572
2696
|
// "code": 0,
|
|
@@ -2647,18 +2771,18 @@ class coinex extends coinex$1 {
|
|
|
2647
2771
|
request['client_id'] = clientOrderId;
|
|
2648
2772
|
if (stop) {
|
|
2649
2773
|
if (swap) {
|
|
2650
|
-
response = await this.
|
|
2774
|
+
response = await this.v1PerpetualPrivatePostOrderCancelStopByClientId(this.extend(request, query));
|
|
2651
2775
|
}
|
|
2652
2776
|
else {
|
|
2653
|
-
response = await this.
|
|
2777
|
+
response = await this.v1PrivateDeleteOrderStopPendingByClientId(this.extend(request, query));
|
|
2654
2778
|
}
|
|
2655
2779
|
}
|
|
2656
2780
|
else {
|
|
2657
2781
|
if (swap) {
|
|
2658
|
-
response = await this.
|
|
2782
|
+
response = await this.v1PerpetualPrivatePostOrderCancelByClientId(this.extend(request, query));
|
|
2659
2783
|
}
|
|
2660
2784
|
else {
|
|
2661
|
-
response = await this.
|
|
2785
|
+
response = await this.v1PrivateDeleteOrderPendingByClientId(this.extend(request, query));
|
|
2662
2786
|
}
|
|
2663
2787
|
}
|
|
2664
2788
|
}
|
|
@@ -2667,18 +2791,18 @@ class coinex extends coinex$1 {
|
|
|
2667
2791
|
request[idRequest] = id;
|
|
2668
2792
|
if (stop) {
|
|
2669
2793
|
if (swap) {
|
|
2670
|
-
response = await this.
|
|
2794
|
+
response = await this.v1PerpetualPrivatePostOrderCancelStop(this.extend(request, query));
|
|
2671
2795
|
}
|
|
2672
2796
|
else {
|
|
2673
|
-
response = await this.
|
|
2797
|
+
response = await this.v1PrivateDeleteOrderStopPendingId(this.extend(request, query));
|
|
2674
2798
|
}
|
|
2675
2799
|
}
|
|
2676
2800
|
else {
|
|
2677
2801
|
if (swap) {
|
|
2678
|
-
response = await this.
|
|
2802
|
+
response = await this.v1PerpetualPrivatePostOrderCancel(this.extend(request, query));
|
|
2679
2803
|
}
|
|
2680
2804
|
else {
|
|
2681
|
-
response = await this.
|
|
2805
|
+
response = await this.v1PrivateDeleteOrderPending(this.extend(request, query));
|
|
2682
2806
|
}
|
|
2683
2807
|
}
|
|
2684
2808
|
}
|
|
@@ -2822,19 +2946,19 @@ class coinex extends coinex$1 {
|
|
|
2822
2946
|
let response = undefined;
|
|
2823
2947
|
if (swap) {
|
|
2824
2948
|
if (stop) {
|
|
2825
|
-
response = await this.
|
|
2949
|
+
response = await this.v1PerpetualPrivatePostOrderCancelStopAll(this.extend(request, params));
|
|
2826
2950
|
}
|
|
2827
2951
|
else {
|
|
2828
|
-
response = await this.
|
|
2952
|
+
response = await this.v1PerpetualPrivatePostOrderCancelAll(this.extend(request, params));
|
|
2829
2953
|
}
|
|
2830
2954
|
}
|
|
2831
2955
|
else {
|
|
2832
2956
|
request['account_id'] = accountId;
|
|
2833
2957
|
if (stop) {
|
|
2834
|
-
response = await this.
|
|
2958
|
+
response = await this.v1PrivateDeleteOrderStopPending(this.extend(request, params));
|
|
2835
2959
|
}
|
|
2836
2960
|
else {
|
|
2837
|
-
response = await this.
|
|
2961
|
+
response = await this.v1PrivateDeleteOrderPending(this.extend(request, params));
|
|
2838
2962
|
}
|
|
2839
2963
|
}
|
|
2840
2964
|
//
|
|
@@ -2878,14 +3002,14 @@ class coinex extends coinex$1 {
|
|
|
2878
3002
|
let response = undefined;
|
|
2879
3003
|
if (swap) {
|
|
2880
3004
|
if (stop) {
|
|
2881
|
-
response = await this.
|
|
3005
|
+
response = await this.v1PerpetualPrivateGetOrderStopStatus(this.extend(request, params));
|
|
2882
3006
|
}
|
|
2883
3007
|
else {
|
|
2884
|
-
response = await this.
|
|
3008
|
+
response = await this.v1PerpetualPrivateGetOrderStatus(this.extend(request, params));
|
|
2885
3009
|
}
|
|
2886
3010
|
}
|
|
2887
3011
|
else {
|
|
2888
|
-
response = await this.
|
|
3012
|
+
response = await this.v1PrivateGetOrderStatus(this.extend(request, params));
|
|
2889
3013
|
}
|
|
2890
3014
|
//
|
|
2891
3015
|
// Spot
|
|
@@ -3029,14 +3153,14 @@ class coinex extends coinex$1 {
|
|
|
3029
3153
|
}
|
|
3030
3154
|
request['offset'] = 0;
|
|
3031
3155
|
if (stop) {
|
|
3032
|
-
response = await this.
|
|
3156
|
+
response = await this.v1PerpetualPrivateGetOrderStopPending(this.extend(request, params));
|
|
3033
3157
|
}
|
|
3034
3158
|
else {
|
|
3035
3159
|
if (status === 'finished') {
|
|
3036
|
-
response = await this.
|
|
3160
|
+
response = await this.v1PerpetualPrivateGetOrderFinished(this.extend(request, params));
|
|
3037
3161
|
}
|
|
3038
3162
|
else if (status === 'pending') {
|
|
3039
|
-
response = await this.
|
|
3163
|
+
response = await this.v1PerpetualPrivateGetOrderPending(this.extend(request, params));
|
|
3040
3164
|
}
|
|
3041
3165
|
}
|
|
3042
3166
|
}
|
|
@@ -3044,18 +3168,18 @@ class coinex extends coinex$1 {
|
|
|
3044
3168
|
request['page'] = 1;
|
|
3045
3169
|
if (status === 'finished') {
|
|
3046
3170
|
if (stop) {
|
|
3047
|
-
response = await this.
|
|
3171
|
+
response = await this.v1PrivateGetOrderStopFinished(this.extend(request, params));
|
|
3048
3172
|
}
|
|
3049
3173
|
else {
|
|
3050
|
-
response = await this.
|
|
3174
|
+
response = await this.v1PrivateGetOrderFinished(this.extend(request, params));
|
|
3051
3175
|
}
|
|
3052
3176
|
}
|
|
3053
3177
|
else if (status === 'pending') {
|
|
3054
3178
|
if (stop) {
|
|
3055
|
-
response = await this.
|
|
3179
|
+
response = await this.v1PrivateGetOrderStopPending(this.extend(request, params));
|
|
3056
3180
|
}
|
|
3057
3181
|
else {
|
|
3058
|
-
response = await this.
|
|
3182
|
+
response = await this.v1PrivateGetOrderPending(this.extend(request, params));
|
|
3059
3183
|
}
|
|
3060
3184
|
}
|
|
3061
3185
|
}
|
|
@@ -3267,7 +3391,7 @@ class coinex extends coinex$1 {
|
|
|
3267
3391
|
params = this.omit(params, 'network');
|
|
3268
3392
|
request['smart_contract_name'] = network;
|
|
3269
3393
|
}
|
|
3270
|
-
const response = await this.
|
|
3394
|
+
const response = await this.v1PrivatePutBalanceDepositAddressCoinType(this.extend(request, params));
|
|
3271
3395
|
//
|
|
3272
3396
|
// {
|
|
3273
3397
|
// "code": 0,
|
|
@@ -3311,7 +3435,7 @@ class coinex extends coinex$1 {
|
|
|
3311
3435
|
if (network !== undefined) {
|
|
3312
3436
|
request['smart_contract_name'] = network;
|
|
3313
3437
|
}
|
|
3314
|
-
const response = await this.
|
|
3438
|
+
const response = await this.v1PrivateGetBalanceDepositAddressCoinType(this.extend(request, params));
|
|
3315
3439
|
//
|
|
3316
3440
|
// {
|
|
3317
3441
|
// "code": 0,
|
|
@@ -3427,11 +3551,11 @@ class coinex extends coinex$1 {
|
|
|
3427
3551
|
request['start_time'] = since;
|
|
3428
3552
|
}
|
|
3429
3553
|
request['side'] = 0;
|
|
3430
|
-
response = await this.
|
|
3554
|
+
response = await this.v1PerpetualPrivateGetMarketUserDeals(this.extend(request, params));
|
|
3431
3555
|
}
|
|
3432
3556
|
else {
|
|
3433
3557
|
request['page'] = 1;
|
|
3434
|
-
response = await this.
|
|
3558
|
+
response = await this.v1PrivateGetOrderUserDeals(this.extend(request, params));
|
|
3435
3559
|
}
|
|
3436
3560
|
//
|
|
3437
3561
|
// Spot and Margin
|
|
@@ -3525,8 +3649,8 @@ class coinex extends coinex$1 {
|
|
|
3525
3649
|
*/
|
|
3526
3650
|
await this.loadMarkets();
|
|
3527
3651
|
let defaultMethod = undefined;
|
|
3528
|
-
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', '
|
|
3529
|
-
const isHistory = (defaultMethod === '
|
|
3652
|
+
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'v1PerpetualPrivateGetPositionPending');
|
|
3653
|
+
const isHistory = (defaultMethod === 'v1PerpetualPrivateGetPositionFinished');
|
|
3530
3654
|
symbols = this.marketSymbols(symbols);
|
|
3531
3655
|
const request = {};
|
|
3532
3656
|
let market = undefined;
|
|
@@ -3555,11 +3679,11 @@ class coinex extends coinex$1 {
|
|
|
3555
3679
|
request['side'] = this.safeInteger(params, 'side', 0); // 0: All, 1: Sell, 2: Buy
|
|
3556
3680
|
}
|
|
3557
3681
|
let response = undefined;
|
|
3558
|
-
if (defaultMethod === '
|
|
3559
|
-
response = await this.
|
|
3682
|
+
if (defaultMethod === 'v1PerpetualPrivateGetPositionPending') {
|
|
3683
|
+
response = await this.v1PerpetualPrivateGetPositionPending(this.extend(request, params));
|
|
3560
3684
|
}
|
|
3561
3685
|
else {
|
|
3562
|
-
response = await this.
|
|
3686
|
+
response = await this.v1PerpetualPrivateGetPositionFinished(this.extend(request, params));
|
|
3563
3687
|
}
|
|
3564
3688
|
//
|
|
3565
3689
|
// {
|
|
@@ -3642,7 +3766,7 @@ class coinex extends coinex$1 {
|
|
|
3642
3766
|
const request = {
|
|
3643
3767
|
'market': market['id'],
|
|
3644
3768
|
};
|
|
3645
|
-
const response = await this.
|
|
3769
|
+
const response = await this.v1PerpetualPrivateGetPositionPending(this.extend(request, params));
|
|
3646
3770
|
//
|
|
3647
3771
|
// {
|
|
3648
3772
|
// "code": 0,
|
|
@@ -3856,7 +3980,7 @@ class coinex extends coinex$1 {
|
|
|
3856
3980
|
'leverage': leverage.toString(),
|
|
3857
3981
|
'position_type': positionType, // 1: isolated, 2: cross
|
|
3858
3982
|
};
|
|
3859
|
-
return await this.
|
|
3983
|
+
return await this.v1PerpetualPrivatePostMarketAdjustLeverage(this.extend(request, params));
|
|
3860
3984
|
}
|
|
3861
3985
|
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
3862
3986
|
/**
|
|
@@ -3897,7 +4021,7 @@ class coinex extends coinex$1 {
|
|
|
3897
4021
|
'leverage': leverage.toString(),
|
|
3898
4022
|
'position_type': positionType, // 1: isolated, 2: cross
|
|
3899
4023
|
};
|
|
3900
|
-
return await this.
|
|
4024
|
+
return await this.v1PerpetualPrivatePostMarketAdjustLeverage(this.extend(request, params));
|
|
3901
4025
|
}
|
|
3902
4026
|
async fetchLeverageTiers(symbols = undefined, params = {}) {
|
|
3903
4027
|
/**
|
|
@@ -3910,7 +4034,7 @@ class coinex extends coinex$1 {
|
|
|
3910
4034
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
3911
4035
|
*/
|
|
3912
4036
|
await this.loadMarkets();
|
|
3913
|
-
const response = await this.
|
|
4037
|
+
const response = await this.v1PerpetualPublicGetMarketLimitConfig(params);
|
|
3914
4038
|
//
|
|
3915
4039
|
// {
|
|
3916
4040
|
// "code": 0,
|
|
@@ -3988,7 +4112,7 @@ class coinex extends coinex$1 {
|
|
|
3988
4112
|
'amount': this.amountToPrecision(symbol, amount),
|
|
3989
4113
|
'type': addOrReduce,
|
|
3990
4114
|
};
|
|
3991
|
-
const response = await this.
|
|
4115
|
+
const response = await this.v1PerpetualPrivatePostPositionAdjustMargin(this.extend(request, params));
|
|
3992
4116
|
//
|
|
3993
4117
|
// {
|
|
3994
4118
|
// "code": 0,
|
|
@@ -4118,7 +4242,7 @@ class coinex extends coinex$1 {
|
|
|
4118
4242
|
if (since !== undefined) {
|
|
4119
4243
|
request['start_time'] = since;
|
|
4120
4244
|
}
|
|
4121
|
-
const response = await this.
|
|
4245
|
+
const response = await this.v1PerpetualPrivateGetPositionFunding(this.extend(request, params));
|
|
4122
4246
|
//
|
|
4123
4247
|
// {
|
|
4124
4248
|
// "code": 0,
|
|
@@ -4184,7 +4308,7 @@ class coinex extends coinex$1 {
|
|
|
4184
4308
|
const request = {
|
|
4185
4309
|
'market': market['id'],
|
|
4186
4310
|
};
|
|
4187
|
-
const response = await this.
|
|
4311
|
+
const response = await this.v1PerpetualPublicGetMarketTicker(this.extend(request, params));
|
|
4188
4312
|
//
|
|
4189
4313
|
// {
|
|
4190
4314
|
// "code": 0,
|
|
@@ -4295,7 +4419,7 @@ class coinex extends coinex$1 {
|
|
|
4295
4419
|
throw new errors.BadSymbol(this.id + ' fetchFundingRates() supports swap contracts only');
|
|
4296
4420
|
}
|
|
4297
4421
|
}
|
|
4298
|
-
const response = await this.
|
|
4422
|
+
const response = await this.v1PerpetualPublicGetMarketTickerAll(params);
|
|
4299
4423
|
//
|
|
4300
4424
|
// {
|
|
4301
4425
|
// "code": 0,
|
|
@@ -4377,7 +4501,7 @@ class coinex extends coinex$1 {
|
|
|
4377
4501
|
if (networkCode !== undefined) {
|
|
4378
4502
|
request['smart_contract_name'] = this.networkCodeToId(networkCode);
|
|
4379
4503
|
}
|
|
4380
|
-
const response = await this.
|
|
4504
|
+
const response = await this.v1PrivatePostBalanceCoinWithdraw(this.extend(request, params));
|
|
4381
4505
|
//
|
|
4382
4506
|
// {
|
|
4383
4507
|
// "code": 0,
|
|
@@ -4449,7 +4573,7 @@ class coinex extends coinex$1 {
|
|
|
4449
4573
|
request['start_time'] = since;
|
|
4450
4574
|
}
|
|
4451
4575
|
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
4452
|
-
const response = await this.
|
|
4576
|
+
const response = await this.v1PerpetualPublicGetMarketFundingHistory(this.extend(request, params));
|
|
4453
4577
|
//
|
|
4454
4578
|
// {
|
|
4455
4579
|
// "code": 0,
|
|
@@ -4626,11 +4750,11 @@ class coinex extends coinex$1 {
|
|
|
4626
4750
|
let response = undefined;
|
|
4627
4751
|
if ((fromAccount === 'spot') && (toAccount === 'swap')) {
|
|
4628
4752
|
request['transfer_side'] = 'in'; // 'in' spot to swap, 'out' swap to spot
|
|
4629
|
-
response = await this.
|
|
4753
|
+
response = await this.v1PrivatePostContractBalanceTransfer(this.extend(request, params));
|
|
4630
4754
|
}
|
|
4631
4755
|
else if ((fromAccount === 'swap') && (toAccount === 'spot')) {
|
|
4632
4756
|
request['transfer_side'] = 'out'; // 'in' spot to swap, 'out' swap to spot
|
|
4633
|
-
response = await this.
|
|
4757
|
+
response = await this.v1PrivatePostContractBalanceTransfer(this.extend(request, params));
|
|
4634
4758
|
}
|
|
4635
4759
|
else {
|
|
4636
4760
|
const accountsById = this.safeValue(this.options, 'accountsById', {});
|
|
@@ -4640,7 +4764,7 @@ class coinex extends coinex$1 {
|
|
|
4640
4764
|
// spot is 0, use fetchBalance() to find the margin account id
|
|
4641
4765
|
request['from_account'] = parseInt(fromId);
|
|
4642
4766
|
request['to_account'] = parseInt(toId);
|
|
4643
|
-
response = await this.
|
|
4767
|
+
response = await this.v1PrivatePostMarginTransfer(this.extend(request, params));
|
|
4644
4768
|
}
|
|
4645
4769
|
//
|
|
4646
4770
|
// {"code": 0, "data": null, "message": "Success"}
|
|
@@ -4763,10 +4887,10 @@ class coinex extends coinex$1 {
|
|
|
4763
4887
|
[marginMode, params] = this.handleMarginModeAndParams('fetchTransfers', params);
|
|
4764
4888
|
let response = undefined;
|
|
4765
4889
|
if (marginMode !== undefined) {
|
|
4766
|
-
response = await this.
|
|
4890
|
+
response = await this.v1PrivateGetMarginTransferHistory(this.extend(request, params));
|
|
4767
4891
|
}
|
|
4768
4892
|
else {
|
|
4769
|
-
response = await this.
|
|
4893
|
+
response = await this.v1PrivateGetContractTransferHistory(this.extend(request, params));
|
|
4770
4894
|
}
|
|
4771
4895
|
//
|
|
4772
4896
|
// Swap
|
|
@@ -4838,7 +4962,7 @@ class coinex extends coinex$1 {
|
|
|
4838
4962
|
if (limit !== undefined) {
|
|
4839
4963
|
request['Limit'] = limit;
|
|
4840
4964
|
}
|
|
4841
|
-
const response = await this.
|
|
4965
|
+
const response = await this.v1PrivateGetBalanceCoinWithdraw(this.extend(request, params));
|
|
4842
4966
|
//
|
|
4843
4967
|
// {
|
|
4844
4968
|
// "code": 0,
|
|
@@ -4905,7 +5029,7 @@ class coinex extends coinex$1 {
|
|
|
4905
5029
|
if (limit !== undefined) {
|
|
4906
5030
|
request['Limit'] = limit;
|
|
4907
5031
|
}
|
|
4908
|
-
const response = await this.
|
|
5032
|
+
const response = await this.v1PrivateGetBalanceCoinDeposit(this.extend(request, params));
|
|
4909
5033
|
//
|
|
4910
5034
|
// {
|
|
4911
5035
|
// "code": 0,
|
|
@@ -4998,7 +5122,7 @@ class coinex extends coinex$1 {
|
|
|
4998
5122
|
const request = {
|
|
4999
5123
|
'market': market['id'],
|
|
5000
5124
|
};
|
|
5001
|
-
const response = await this.
|
|
5125
|
+
const response = await this.v1PrivateGetMarginConfig(this.extend(request, params));
|
|
5002
5126
|
//
|
|
5003
5127
|
// {
|
|
5004
5128
|
// "code": 0,
|
|
@@ -5032,7 +5156,7 @@ class coinex extends coinex$1 {
|
|
|
5032
5156
|
* @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
5033
5157
|
*/
|
|
5034
5158
|
await this.loadMarkets();
|
|
5035
|
-
const response = await this.
|
|
5159
|
+
const response = await this.v1PrivateGetMarginConfig(params);
|
|
5036
5160
|
//
|
|
5037
5161
|
// {
|
|
5038
5162
|
// "code": 0,
|
|
@@ -5073,7 +5197,7 @@ class coinex extends coinex$1 {
|
|
|
5073
5197
|
if (limit !== undefined) {
|
|
5074
5198
|
request['limit'] = limit;
|
|
5075
5199
|
}
|
|
5076
|
-
const response = await this.
|
|
5200
|
+
const response = await this.v1PrivateGetMarginLoanHistory(this.extend(request, params));
|
|
5077
5201
|
//
|
|
5078
5202
|
// {
|
|
5079
5203
|
// "code": 0,
|
|
@@ -5169,7 +5293,7 @@ class coinex extends coinex$1 {
|
|
|
5169
5293
|
'coin_type': currency['id'],
|
|
5170
5294
|
'amount': this.currencyToPrecision(code, amount),
|
|
5171
5295
|
};
|
|
5172
|
-
const response = await this.
|
|
5296
|
+
const response = await this.v1PrivatePostMarginLoan(this.extend(request, params));
|
|
5173
5297
|
//
|
|
5174
5298
|
// {
|
|
5175
5299
|
// "code": 0,
|
|
@@ -5207,7 +5331,7 @@ class coinex extends coinex$1 {
|
|
|
5207
5331
|
'coin_type': currency['id'],
|
|
5208
5332
|
'amount': this.currencyToPrecision(code, amount),
|
|
5209
5333
|
};
|
|
5210
|
-
const response = await this.
|
|
5334
|
+
const response = await this.v1PrivatePostMarginFlat(this.extend(request, params));
|
|
5211
5335
|
//
|
|
5212
5336
|
// {
|
|
5213
5337
|
// "code": 0,
|
|
@@ -5265,7 +5389,7 @@ class coinex extends coinex$1 {
|
|
|
5265
5389
|
request['coin_type'] = this.safeValue(codes, 0);
|
|
5266
5390
|
}
|
|
5267
5391
|
}
|
|
5268
|
-
const response = await this.
|
|
5392
|
+
const response = await this.v1PublicGetCommonAssetConfig(this.extend(request, params));
|
|
5269
5393
|
//
|
|
5270
5394
|
// {
|
|
5271
5395
|
// "code": 0,
|
|
@@ -5365,7 +5489,7 @@ class coinex extends coinex$1 {
|
|
|
5365
5489
|
if (marketType !== 'spot') {
|
|
5366
5490
|
throw new errors.NotSupported(this.id + ' fetchLeverages() supports spot margin markets only');
|
|
5367
5491
|
}
|
|
5368
|
-
const response = await this.
|
|
5492
|
+
const response = await this.v1PrivateGetMarginConfig(params);
|
|
5369
5493
|
//
|
|
5370
5494
|
// {
|
|
5371
5495
|
// "code": 0,
|
|
@@ -5424,9 +5548,11 @@ class coinex extends coinex$1 {
|
|
|
5424
5548
|
nonce() {
|
|
5425
5549
|
return this.milliseconds();
|
|
5426
5550
|
}
|
|
5427
|
-
sign(path, api =
|
|
5551
|
+
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
5428
5552
|
path = this.implodeParams(path, params);
|
|
5429
|
-
|
|
5553
|
+
const version = api[0];
|
|
5554
|
+
const requestUrl = api[1];
|
|
5555
|
+
let url = this.urls['api'][requestUrl] + '/' + version + '/' + path;
|
|
5430
5556
|
let query = this.omit(params, this.extractParams(path));
|
|
5431
5557
|
const nonce = this.nonce().toString();
|
|
5432
5558
|
if (method === 'POST') {
|
|
@@ -5455,7 +5581,7 @@ class coinex extends coinex$1 {
|
|
|
5455
5581
|
}
|
|
5456
5582
|
}
|
|
5457
5583
|
}
|
|
5458
|
-
if (
|
|
5584
|
+
if (requestUrl === 'perpetualPrivate') {
|
|
5459
5585
|
this.checkRequiredCredentials();
|
|
5460
5586
|
query = this.extend({
|
|
5461
5587
|
'access_id': this.apiKey,
|
|
@@ -5476,29 +5602,49 @@ class coinex extends coinex$1 {
|
|
|
5476
5602
|
body = urlencoded;
|
|
5477
5603
|
}
|
|
5478
5604
|
}
|
|
5479
|
-
else if (
|
|
5605
|
+
else if (requestUrl === 'public' || requestUrl === 'perpetualPublic') {
|
|
5480
5606
|
if (Object.keys(query).length) {
|
|
5481
5607
|
url += '?' + this.urlencode(query);
|
|
5482
5608
|
}
|
|
5483
5609
|
}
|
|
5484
5610
|
else {
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5611
|
+
if (version === 'v1') {
|
|
5612
|
+
this.checkRequiredCredentials();
|
|
5613
|
+
query = this.extend({
|
|
5614
|
+
'access_id': this.apiKey,
|
|
5615
|
+
'tonce': nonce,
|
|
5616
|
+
}, query);
|
|
5617
|
+
query = this.keysort(query);
|
|
5618
|
+
const urlencoded = this.rawencode(query);
|
|
5619
|
+
const signature = this.hash(this.encode(urlencoded + '&secret_key=' + this.secret), md5.md5);
|
|
5620
|
+
headers = {
|
|
5621
|
+
'Authorization': signature.toUpperCase(),
|
|
5622
|
+
'Content-Type': 'application/json',
|
|
5623
|
+
};
|
|
5624
|
+
if ((method === 'GET') || (method === 'DELETE') || (method === 'PUT')) {
|
|
5625
|
+
url += '?' + urlencoded;
|
|
5626
|
+
}
|
|
5627
|
+
else {
|
|
5628
|
+
body = this.json(query);
|
|
5629
|
+
}
|
|
5499
5630
|
}
|
|
5500
|
-
else {
|
|
5501
|
-
|
|
5631
|
+
else if (version === 'v2') {
|
|
5632
|
+
this.checkRequiredCredentials();
|
|
5633
|
+
query = this.keysort(query);
|
|
5634
|
+
const urlencoded = this.rawencode(query);
|
|
5635
|
+
const preparedString = method + '/' + version + '/' + path + '?' + urlencoded + nonce + this.secret;
|
|
5636
|
+
const signature = this.hash(this.encode(preparedString), sha256.sha256);
|
|
5637
|
+
headers = {
|
|
5638
|
+
'X-COINEX-KEY': this.apiKey,
|
|
5639
|
+
'X-COINEX-SIGN': signature,
|
|
5640
|
+
'X-COINEX-TIMESTAMP': nonce,
|
|
5641
|
+
};
|
|
5642
|
+
if ((method === 'GET') || (method === 'DELETE') || (method === 'PUT')) {
|
|
5643
|
+
url += '?' + urlencoded;
|
|
5644
|
+
}
|
|
5645
|
+
else {
|
|
5646
|
+
body = this.json(query);
|
|
5647
|
+
}
|
|
5502
5648
|
}
|
|
5503
5649
|
}
|
|
5504
5650
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|