ccxt 4.2.85__py2.py3-none-any.whl → 4.2.86__py2.py3-none-any.whl
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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/abstract/coinex.py +232 -123
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +33 -19
- ccxt/async_support/bitbank.py +19 -21
- ccxt/async_support/coinex.py +393 -251
- ccxt/async_support/idex.py +10 -10
- ccxt/async_support/okcoin.py +2 -1
- ccxt/base/exchange.py +1 -1
- ccxt/bingx.py +33 -19
- ccxt/bitbank.py +19 -21
- ccxt/coinex.py +393 -251
- ccxt/idex.py +10 -10
- ccxt/okcoin.py +2 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +1 -0
- {ccxt-4.2.85.dist-info → ccxt-4.2.86.dist-info}/METADATA +6 -6
- {ccxt-4.2.85.dist-info → ccxt-4.2.86.dist-info}/RECORD +21 -21
- {ccxt-4.2.85.dist-info → ccxt-4.2.86.dist-info}/WHEEL +0 -0
- {ccxt-4.2.85.dist-info → ccxt-4.2.86.dist-info}/top_level.txt +0 -0
ccxt/async_support/coinex.py
CHANGED
@@ -41,6 +41,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
41
41
|
# 60 per 2 seconds => 30 per second => weight = 13.334
|
42
42
|
# 40 per 2 seconds => 20 per second => weight = 20
|
43
43
|
# 20 per 2 seconds => 10 per second => weight = 40
|
44
|
+
# v1 is per 2 seconds and v2 is per 1 second
|
44
45
|
'rateLimit': 2.5,
|
45
46
|
'pro': True,
|
46
47
|
'certified': True,
|
@@ -147,156 +148,279 @@ class coinex(Exchange, ImplicitAPI):
|
|
147
148
|
'perpetualPrivate': 'https://api.coinex.com/perpetual',
|
148
149
|
},
|
149
150
|
'www': 'https://www.coinex.com',
|
150
|
-
'doc': 'https://
|
151
|
+
'doc': 'https://docs.coinex.com/api/v2',
|
151
152
|
'fees': 'https://www.coinex.com/fees',
|
152
153
|
'referral': 'https://www.coinex.com/register?refer_code=yw5fz',
|
153
154
|
},
|
154
155
|
'api': {
|
155
|
-
'
|
156
|
-
'
|
157
|
-
'
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
'private': {
|
174
|
-
'get': {
|
175
|
-
'account/amm/balance': 40,
|
176
|
-
'account/investment/balance': 40,
|
177
|
-
'account/balance/history': 40,
|
178
|
-
'account/market/fee': 40,
|
179
|
-
'balance/coin/deposit': 40,
|
180
|
-
'balance/coin/withdraw': 40,
|
181
|
-
'balance/info': 40,
|
182
|
-
'balance/deposit/address/{coin_type}': 40,
|
183
|
-
'contract/transfer/history': 40,
|
184
|
-
'credit/info': 40,
|
185
|
-
'credit/balance': 40,
|
186
|
-
'investment/transfer/history': 40,
|
187
|
-
'margin/account': 1,
|
188
|
-
'margin/config': 1,
|
189
|
-
'margin/loan/history': 40,
|
190
|
-
'margin/transfer/history': 40,
|
191
|
-
'order/deals': 40,
|
192
|
-
'order/finished': 40,
|
193
|
-
'order/pending': 8,
|
194
|
-
'order/status': 8,
|
195
|
-
'order/status/batch': 8,
|
196
|
-
'order/user/deals': 40,
|
197
|
-
'order/stop/finished': 40,
|
198
|
-
'order/stop/pending': 8,
|
199
|
-
'order/user/trade/fee': 1,
|
200
|
-
'order/market/trade/info': 1,
|
201
|
-
'sub_account/balance': 1,
|
202
|
-
'sub_account/transfer/history': 40,
|
203
|
-
'sub_account/auth/api': 40,
|
204
|
-
'sub_account/auth/api/{user_auth_id}': 40,
|
205
|
-
},
|
206
|
-
'post': {
|
207
|
-
'balance/coin/withdraw': 40,
|
208
|
-
'contract/balance/transfer': 40,
|
209
|
-
'margin/flat': 40,
|
210
|
-
'margin/loan': 40,
|
211
|
-
'margin/transfer': 40,
|
212
|
-
'order/limit/batch': 40,
|
213
|
-
'order/ioc': 13.334,
|
214
|
-
'order/limit': 13.334,
|
215
|
-
'order/market': 13.334,
|
216
|
-
'order/modify': 13.334,
|
217
|
-
'order/stop/limit': 13.334,
|
218
|
-
'order/stop/market': 13.334,
|
219
|
-
'order/stop/modify': 13.334,
|
220
|
-
'sub_account/transfer': 40,
|
221
|
-
'sub_account/register': 1,
|
222
|
-
'sub_account/unfrozen': 40,
|
223
|
-
'sub_account/frozen': 40,
|
224
|
-
'sub_account/auth/api': 40,
|
156
|
+
'v1': {
|
157
|
+
'public': {
|
158
|
+
'get': {
|
159
|
+
'amm/market': 1,
|
160
|
+
'common/currency/rate': 1,
|
161
|
+
'common/asset/config': 1,
|
162
|
+
'common/maintain/info': 1,
|
163
|
+
'common/temp-maintain/info': 1,
|
164
|
+
'margin/market': 1,
|
165
|
+
'market/info': 1,
|
166
|
+
'market/list': 1,
|
167
|
+
'market/ticker': 1,
|
168
|
+
'market/ticker/all': 1,
|
169
|
+
'market/depth': 1,
|
170
|
+
'market/deals': 1,
|
171
|
+
'market/kline': 1,
|
172
|
+
'market/detail': 1,
|
173
|
+
},
|
225
174
|
},
|
226
|
-
'
|
227
|
-
'
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
175
|
+
'private': {
|
176
|
+
'get': {
|
177
|
+
'account/amm/balance': 40,
|
178
|
+
'account/investment/balance': 40,
|
179
|
+
'account/balance/history': 40,
|
180
|
+
'account/market/fee': 40,
|
181
|
+
'balance/coin/deposit': 40,
|
182
|
+
'balance/coin/withdraw': 40,
|
183
|
+
'balance/info': 40,
|
184
|
+
'balance/deposit/address/{coin_type}': 40,
|
185
|
+
'contract/transfer/history': 40,
|
186
|
+
'credit/info': 40,
|
187
|
+
'credit/balance': 40,
|
188
|
+
'investment/transfer/history': 40,
|
189
|
+
'margin/account': 1,
|
190
|
+
'margin/config': 1,
|
191
|
+
'margin/loan/history': 40,
|
192
|
+
'margin/transfer/history': 40,
|
193
|
+
'order/deals': 40,
|
194
|
+
'order/finished': 40,
|
195
|
+
'order/pending': 8,
|
196
|
+
'order/status': 8,
|
197
|
+
'order/status/batch': 8,
|
198
|
+
'order/user/deals': 40,
|
199
|
+
'order/stop/finished': 40,
|
200
|
+
'order/stop/pending': 8,
|
201
|
+
'order/user/trade/fee': 1,
|
202
|
+
'order/market/trade/info': 1,
|
203
|
+
'sub_account/balance': 1,
|
204
|
+
'sub_account/transfer/history': 40,
|
205
|
+
'sub_account/auth/api': 40,
|
206
|
+
'sub_account/auth/api/{user_auth_id}': 40,
|
207
|
+
},
|
208
|
+
'post': {
|
209
|
+
'balance/coin/withdraw': 40,
|
210
|
+
'contract/balance/transfer': 40,
|
211
|
+
'margin/flat': 40,
|
212
|
+
'margin/loan': 40,
|
213
|
+
'margin/transfer': 40,
|
214
|
+
'order/limit/batch': 40,
|
215
|
+
'order/ioc': 13.334,
|
216
|
+
'order/limit': 13.334,
|
217
|
+
'order/market': 13.334,
|
218
|
+
'order/modify': 13.334,
|
219
|
+
'order/stop/limit': 13.334,
|
220
|
+
'order/stop/market': 13.334,
|
221
|
+
'order/stop/modify': 13.334,
|
222
|
+
'sub_account/transfer': 40,
|
223
|
+
'sub_account/register': 1,
|
224
|
+
'sub_account/unfrozen': 40,
|
225
|
+
'sub_account/frozen': 40,
|
226
|
+
'sub_account/auth/api': 40,
|
227
|
+
},
|
228
|
+
'put': {
|
229
|
+
'balance/deposit/address/{coin_type}': 40,
|
230
|
+
'sub_account/unfrozen': 40,
|
231
|
+
'sub_account/frozen': 40,
|
232
|
+
'sub_account/auth/api/{user_auth_id}': 40,
|
233
|
+
'v1/account/settings': 40,
|
234
|
+
},
|
235
|
+
'delete': {
|
236
|
+
'balance/coin/withdraw': 40,
|
237
|
+
'order/pending/batch': 40,
|
238
|
+
'order/pending': 13.334,
|
239
|
+
'order/stop/pending': 40,
|
240
|
+
'order/stop/pending/{id}': 13.334,
|
241
|
+
'order/pending/by_client_id': 40,
|
242
|
+
'order/stop/pending/by_client_id': 40,
|
243
|
+
'sub_account/auth/api/{user_auth_id}': 40,
|
244
|
+
'sub_account/authorize/{id}': 40,
|
245
|
+
},
|
232
246
|
},
|
233
|
-
'
|
234
|
-
'
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
247
|
+
'perpetualPublic': {
|
248
|
+
'get': {
|
249
|
+
'ping': 1,
|
250
|
+
'time': 1,
|
251
|
+
'market/list': 1,
|
252
|
+
'market/limit_config': 1,
|
253
|
+
'market/ticker': 1,
|
254
|
+
'market/ticker/all': 1,
|
255
|
+
'market/depth': 1,
|
256
|
+
'market/deals': 1,
|
257
|
+
'market/funding_history': 1,
|
258
|
+
'market/kline': 1,
|
259
|
+
},
|
243
260
|
},
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
261
|
+
'perpetualPrivate': {
|
262
|
+
'get': {
|
263
|
+
'market/user_deals': 1,
|
264
|
+
'asset/query': 40,
|
265
|
+
'order/pending': 8,
|
266
|
+
'order/finished': 40,
|
267
|
+
'order/stop_finished': 40,
|
268
|
+
'order/stop_pending': 8,
|
269
|
+
'order/status': 8,
|
270
|
+
'order/stop_status': 8,
|
271
|
+
'position/finished': 40,
|
272
|
+
'position/pending': 40,
|
273
|
+
'position/funding': 40,
|
274
|
+
'position/adl_history': 40,
|
275
|
+
'market/preference': 40,
|
276
|
+
'position/margin_history': 40,
|
277
|
+
'position/settle_history': 40,
|
278
|
+
},
|
279
|
+
'post': {
|
280
|
+
'market/adjust_leverage': 1,
|
281
|
+
'market/position_expect': 1,
|
282
|
+
'order/put_limit': 20,
|
283
|
+
'order/put_market': 20,
|
284
|
+
'order/put_stop_limit': 20,
|
285
|
+
'order/put_stop_market': 20,
|
286
|
+
'order/modify': 20,
|
287
|
+
'order/modify_stop': 20,
|
288
|
+
'order/cancel': 20,
|
289
|
+
'order/cancel_all': 40,
|
290
|
+
'order/cancel_batch': 40,
|
291
|
+
'order/cancel_stop': 20,
|
292
|
+
'order/cancel_stop_all': 40,
|
293
|
+
'order/close_limit': 20,
|
294
|
+
'order/close_market': 20,
|
295
|
+
'position/adjust_margin': 20,
|
296
|
+
'position/stop_loss': 20,
|
297
|
+
'position/take_profit': 20,
|
298
|
+
'position/market_close': 20,
|
299
|
+
'order/cancel/by_client_id': 20,
|
300
|
+
'order/cancel_stop/by_client_id': 20,
|
301
|
+
'market/preference': 20,
|
302
|
+
},
|
257
303
|
},
|
258
304
|
},
|
259
|
-
'
|
260
|
-
'
|
261
|
-
'
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
305
|
+
'v2': {
|
306
|
+
'public': {
|
307
|
+
'get': {
|
308
|
+
'maintain-info': 1,
|
309
|
+
'ping': 1,
|
310
|
+
'time': 1,
|
311
|
+
'spot/market': 1,
|
312
|
+
'spot/ticker': 1,
|
313
|
+
'spot/depth': 1,
|
314
|
+
'spot/deals': 1,
|
315
|
+
'spot/kline': 1,
|
316
|
+
'spot/index': 1,
|
317
|
+
'futures/market': 1,
|
318
|
+
'futures/ticker': 1,
|
319
|
+
'futures/depth': 1,
|
320
|
+
'futures/deals': 1,
|
321
|
+
'futures/kline': 1,
|
322
|
+
'futures/index': 1,
|
323
|
+
'futures/funding-rate': 1,
|
324
|
+
'futures/funding-rate-history': 1,
|
325
|
+
'futures/position-level': 1,
|
326
|
+
'futures/liquidation-history': 1,
|
327
|
+
'futures/basis-history': 1,
|
328
|
+
},
|
276
329
|
},
|
277
|
-
'
|
278
|
-
'
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
330
|
+
'private': {
|
331
|
+
'get': {
|
332
|
+
'account/subs': 1,
|
333
|
+
'account/subs/api-detail': 40,
|
334
|
+
'account/subs/info': 1,
|
335
|
+
'account/subs/api': 40,
|
336
|
+
'account/subs/transfer-history': 40,
|
337
|
+
'account/subs/spot-balance': 1,
|
338
|
+
'account/trade-fee-rate': 40,
|
339
|
+
'assets/spot/balance': 40,
|
340
|
+
'assets/futures/balance': 40,
|
341
|
+
'assets/margin/balance': 1,
|
342
|
+
'assets/financial/balance': 40,
|
343
|
+
'assets/amm/liquidity': 40,
|
344
|
+
'assets/credit/info': 40,
|
345
|
+
'assets/margin/borrow-history': 40,
|
346
|
+
'assets/margin/interest-limit': 1,
|
347
|
+
'assets/deposit-address': 40,
|
348
|
+
'assets/deposit-history': 40,
|
349
|
+
'assets/withdraw': 40,
|
350
|
+
'assets/deposit-withdraw-config': 1,
|
351
|
+
'assets/transfer-history': 40,
|
352
|
+
'spot/order-status': 8,
|
353
|
+
'spot/batch-order-status': 8,
|
354
|
+
'spot/pending-order': 8,
|
355
|
+
'spot/finished-order': 40,
|
356
|
+
'spot/pending-stop-order': 8,
|
357
|
+
'spot/finished-stop-order': 40,
|
358
|
+
'spot/user-deals': 40,
|
359
|
+
'spot/order-deals': 40,
|
360
|
+
'futures/order-status': 8,
|
361
|
+
'futures/batch-order-status': 1,
|
362
|
+
'futures/pending-order': 8,
|
363
|
+
'futures/finished-order': 40,
|
364
|
+
'futures/pending-stop-order': 8,
|
365
|
+
'futures/finished-stop-order': 40,
|
366
|
+
'futures/user-deals': 1,
|
367
|
+
'futures/order-deals': 1,
|
368
|
+
'futures/pending-position': 40,
|
369
|
+
'futures/finished-position': 1,
|
370
|
+
'futures/position-margin-history': 1,
|
371
|
+
'futures/position-funding-history': 40,
|
372
|
+
'futures/position-adl-history': 1,
|
373
|
+
'futures/position-settle-history': 1,
|
374
|
+
},
|
375
|
+
'post': {
|
376
|
+
'account/subs': 40,
|
377
|
+
'account/subs/frozen': 40,
|
378
|
+
'account/subs/unfrozen': 40,
|
379
|
+
'account/subs/api': 40,
|
380
|
+
'account/subs/edit-api': 40,
|
381
|
+
'account/subs/delete-api': 40,
|
382
|
+
'account/subs/transfer': 40,
|
383
|
+
'account/settings': 40,
|
384
|
+
'assets/margin/borrow': 40,
|
385
|
+
'assets/margin/repay': 40,
|
386
|
+
'assets/renewal-deposit-address': 40,
|
387
|
+
'assets/withdraw': 40,
|
388
|
+
'assets/cancel-withdraw': 40,
|
389
|
+
'assets/transfer': 40,
|
390
|
+
'assets/amm/add-liquidity': 1,
|
391
|
+
'assets/amm/remove-liquidity': 1,
|
392
|
+
'spot/order': 13.334,
|
393
|
+
'spot/stop-order': 13.334,
|
394
|
+
'spot/batch-order': 40,
|
395
|
+
'spot/batch-stop-order': 1,
|
396
|
+
'spot/modify-order': 13.334,
|
397
|
+
'spot/modify-stop-order': 13.334,
|
398
|
+
'spot/cancel-all-order': 1,
|
399
|
+
'spot/cancel-order': 6.667,
|
400
|
+
'spot/cancel-stop-order': 6.667,
|
401
|
+
'spot/cancel-batch-order': 10,
|
402
|
+
'spot/cancel-batch-stop-order': 10,
|
403
|
+
'spot/cancel-order-by-client-id': 1,
|
404
|
+
'spot/cancel-stop-order-by-client-id': 1,
|
405
|
+
'futures/order': 20,
|
406
|
+
'futures/stop-order': 20,
|
407
|
+
'futures/batch-order': 1,
|
408
|
+
'futures/batch-stop-order': 1,
|
409
|
+
'futures/modify-order': 20,
|
410
|
+
'futures/modify-stop-order': 20,
|
411
|
+
'futures/cancel-all-order': 1,
|
412
|
+
'futures/cancel-order': 10,
|
413
|
+
'futures/cancel-stop-order': 10,
|
414
|
+
'futures/cancel-batch-order': 20,
|
415
|
+
'futures/cancel-batch-stop-order': 20,
|
416
|
+
'futures/cancel-order-by-client-id': 1,
|
417
|
+
'futures/cancel-stop-order-by-client-id': 1,
|
418
|
+
'futures/close-position': 20,
|
419
|
+
'futures/adjust-position-margin': 20,
|
420
|
+
'futures/adjust-position-leverage': 20,
|
421
|
+
'futures/set-position-stop-loss': 20,
|
422
|
+
'futures/set-position-take-profit': 20,
|
423
|
+
},
|
300
424
|
},
|
301
425
|
},
|
302
426
|
},
|
@@ -367,7 +491,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
367
491
|
})
|
368
492
|
|
369
493
|
async def fetch_currencies(self, params={}):
|
370
|
-
response = await self.
|
494
|
+
response = await self.v1PublicGetCommonAssetConfig(params)
|
371
495
|
# {
|
372
496
|
# "code": 0,
|
373
497
|
# "data": {
|
@@ -507,7 +631,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
507
631
|
return self.array_concat(spotMarkets, swapMarkets)
|
508
632
|
|
509
633
|
async def fetch_spot_markets(self, params):
|
510
|
-
response = await self.
|
634
|
+
response = await self.v1PublicGetMarketInfo(params)
|
511
635
|
#
|
512
636
|
# {
|
513
637
|
# "code": 0,
|
@@ -594,7 +718,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
594
718
|
return result
|
595
719
|
|
596
720
|
async def fetch_contract_markets(self, params):
|
597
|
-
response = await self.
|
721
|
+
response = await self.v1PerpetualPublicGetMarketList(params)
|
598
722
|
#
|
599
723
|
# {
|
600
724
|
# "code": 0,
|
@@ -773,9 +897,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
773
897
|
}
|
774
898
|
response = None
|
775
899
|
if market['swap']:
|
776
|
-
response = await self.
|
900
|
+
response = await self.v1PerpetualPublicGetMarketTicker(self.extend(request, params))
|
777
901
|
else:
|
778
|
-
response = await self.
|
902
|
+
response = await self.v1PublicGetMarketTicker(self.extend(request, params))
|
779
903
|
#
|
780
904
|
# Spot
|
781
905
|
#
|
@@ -850,9 +974,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
850
974
|
marketType, query = self.handle_market_type_and_params('fetchTickers', market, params)
|
851
975
|
response = None
|
852
976
|
if marketType == 'swap':
|
853
|
-
response = await self.
|
977
|
+
response = await self.v1PerpetualPublicGetMarketTickerAll(query)
|
854
978
|
else:
|
855
|
-
response = await self.
|
979
|
+
response = await self.v1PublicGetMarketTickerAll()
|
856
980
|
#
|
857
981
|
# Spot
|
858
982
|
#
|
@@ -935,7 +1059,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
935
1059
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
936
1060
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
937
1061
|
"""
|
938
|
-
response = await self.
|
1062
|
+
response = await self.v1PerpetualPublicGetTime(params)
|
939
1063
|
#
|
940
1064
|
# {
|
941
1065
|
# "code": "0",
|
@@ -966,9 +1090,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
966
1090
|
}
|
967
1091
|
response = None
|
968
1092
|
if market['swap']:
|
969
|
-
response = await self.
|
1093
|
+
response = await self.v1PerpetualPublicGetMarketDepth(self.extend(request, params))
|
970
1094
|
else:
|
971
|
-
response = await self.
|
1095
|
+
response = await self.v1PublicGetMarketDepth(self.extend(request, params))
|
972
1096
|
#
|
973
1097
|
# Spot
|
974
1098
|
#
|
@@ -1156,9 +1280,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
1156
1280
|
request['limit'] = limit
|
1157
1281
|
response = None
|
1158
1282
|
if market['swap']:
|
1159
|
-
response = await self.
|
1283
|
+
response = await self.v1PerpetualPublicGetMarketDeals(self.extend(request, params))
|
1160
1284
|
else:
|
1161
|
-
response = await self.
|
1285
|
+
response = await self.v1PublicGetMarketDeals(self.extend(request, params))
|
1162
1286
|
#
|
1163
1287
|
# Spot and Swap
|
1164
1288
|
#
|
@@ -1192,7 +1316,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1192
1316
|
request = {
|
1193
1317
|
'market': market['id'],
|
1194
1318
|
}
|
1195
|
-
response = await self.
|
1319
|
+
response = await self.v1PublicGetMarketDetail(self.extend(request, params))
|
1196
1320
|
#
|
1197
1321
|
# {
|
1198
1322
|
# "code": 0,
|
@@ -1220,7 +1344,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1220
1344
|
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
1221
1345
|
"""
|
1222
1346
|
await self.load_markets()
|
1223
|
-
response = await self.
|
1347
|
+
response = await self.v1PublicGetMarketInfo(params)
|
1224
1348
|
#
|
1225
1349
|
# {
|
1226
1350
|
# "code": 0,
|
@@ -1304,9 +1428,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
1304
1428
|
request['limit'] = limit
|
1305
1429
|
response = None
|
1306
1430
|
if market['swap']:
|
1307
|
-
response = await self.
|
1431
|
+
response = await self.v1PerpetualPublicGetMarketKline(self.extend(request, params))
|
1308
1432
|
else:
|
1309
|
-
response = await self.
|
1433
|
+
response = await self.v1PublicGetMarketKline(self.extend(request, params))
|
1310
1434
|
#
|
1311
1435
|
# Spot
|
1312
1436
|
#
|
@@ -1349,7 +1473,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1349
1473
|
request = {
|
1350
1474
|
'market': marketId,
|
1351
1475
|
}
|
1352
|
-
response = await self.
|
1476
|
+
response = await self.v1PrivateGetMarginAccount(self.extend(request, params))
|
1353
1477
|
#
|
1354
1478
|
# {
|
1355
1479
|
# "code": 0,
|
@@ -1416,7 +1540,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1416
1540
|
|
1417
1541
|
async def fetch_spot_balance(self, params={}):
|
1418
1542
|
await self.load_markets()
|
1419
|
-
response = await self.
|
1543
|
+
response = await self.v1PrivateGetBalanceInfo(params)
|
1420
1544
|
#
|
1421
1545
|
# {
|
1422
1546
|
# "code": 0,
|
@@ -1452,7 +1576,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1452
1576
|
|
1453
1577
|
async def fetch_swap_balance(self, params={}):
|
1454
1578
|
await self.load_markets()
|
1455
|
-
response = await self.
|
1579
|
+
response = await self.v1PerpetualPrivateGetAssetQuery(params)
|
1456
1580
|
#
|
1457
1581
|
# {
|
1458
1582
|
# "code": 0,
|
@@ -1485,7 +1609,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
1485
1609
|
|
1486
1610
|
async def fetch_financial_balance(self, params={}):
|
1487
1611
|
await self.load_markets()
|
1488
|
-
response = await self.
|
1612
|
+
response = await self.v1PrivateGetAccountInvestmentBalance(params)
|
1489
1613
|
#
|
1490
1614
|
# {
|
1491
1615
|
# "code": 0,
|
@@ -2062,36 +2186,36 @@ class coinex(Exchange, ImplicitAPI):
|
|
2062
2186
|
if market['spot']:
|
2063
2187
|
if isTriggerOrder:
|
2064
2188
|
if type == 'limit':
|
2065
|
-
response = await self.
|
2189
|
+
response = await self.v1PrivatePostOrderStopLimit(request)
|
2066
2190
|
else:
|
2067
|
-
response = await self.
|
2191
|
+
response = await self.v1PrivatePostOrderStopMarket(request)
|
2068
2192
|
else:
|
2069
2193
|
if type == 'limit':
|
2070
|
-
response = await self.
|
2194
|
+
response = await self.v1PrivatePostOrderLimit(request)
|
2071
2195
|
else:
|
2072
|
-
response = await self.
|
2196
|
+
response = await self.v1PrivatePostOrderMarket(request)
|
2073
2197
|
else:
|
2074
2198
|
if isTriggerOrder:
|
2075
2199
|
if type == 'limit':
|
2076
|
-
response = await self.
|
2200
|
+
response = await self.v1PerpetualPrivatePostOrderPutStopLimit(request)
|
2077
2201
|
else:
|
2078
|
-
response = await self.
|
2202
|
+
response = await self.v1PerpetualPrivatePostOrderPutStopMarket(request)
|
2079
2203
|
elif isStopLossOrTakeProfitTrigger:
|
2080
2204
|
if isStopLossTriggerOrder:
|
2081
|
-
response = await self.
|
2205
|
+
response = await self.v1PerpetualPrivatePostPositionStopLoss(request)
|
2082
2206
|
elif isTakeProfitTriggerOrder:
|
2083
|
-
response = await self.
|
2207
|
+
response = await self.v1PerpetualPrivatePostPositionTakeProfit(request)
|
2084
2208
|
else:
|
2085
2209
|
if reduceOnly:
|
2086
2210
|
if type == 'limit':
|
2087
|
-
response = await self.
|
2211
|
+
response = await self.v1PerpetualPrivatePostOrderCloseLimit(request)
|
2088
2212
|
else:
|
2089
|
-
response = await self.
|
2213
|
+
response = await self.v1PerpetualPrivatePostOrderCloseMarket(request)
|
2090
2214
|
else:
|
2091
2215
|
if type == 'limit':
|
2092
|
-
response = await self.
|
2216
|
+
response = await self.v1PerpetualPrivatePostOrderPutLimit(request)
|
2093
2217
|
else:
|
2094
|
-
response = await self.
|
2218
|
+
response = await self.v1PerpetualPrivatePostOrderPutMarket(request)
|
2095
2219
|
#
|
2096
2220
|
# Spot and Margin
|
2097
2221
|
#
|
@@ -2207,7 +2331,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2207
2331
|
'market': market['id'],
|
2208
2332
|
'batch_orders': self.json(ordersRequests),
|
2209
2333
|
}
|
2210
|
-
response = await self.
|
2334
|
+
response = await self.v1PrivatePostOrderLimitBatch(request)
|
2211
2335
|
#
|
2212
2336
|
# {
|
2213
2337
|
# "code": 0,
|
@@ -2283,10 +2407,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
2283
2407
|
response = None
|
2284
2408
|
if market['spot']:
|
2285
2409
|
request['batch_ids'] = idsString
|
2286
|
-
response = await self.
|
2410
|
+
response = await self.v1PrivateDeleteOrderPendingBatch(self.extend(request, params))
|
2287
2411
|
else:
|
2288
2412
|
request['order_ids'] = idsString
|
2289
|
-
response = await self.
|
2413
|
+
response = await self.v1PerpetualPrivatePostOrderCancelBatch(self.extend(request, params))
|
2290
2414
|
#
|
2291
2415
|
# spot
|
2292
2416
|
#
|
@@ -2415,7 +2539,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
2415
2539
|
request['amount'] = self.amount_to_precision(symbol, amount)
|
2416
2540
|
if price is not None:
|
2417
2541
|
request['price'] = self.price_to_precision(symbol, price)
|
2418
|
-
response = await self.
|
2542
|
+
response = await self.v1PrivatePostOrderModify(self.extend(request, params))
|
2419
2543
|
#
|
2420
2544
|
# {
|
2421
2545
|
# "code": 0,
|
@@ -2491,27 +2615,27 @@ class coinex(Exchange, ImplicitAPI):
|
|
2491
2615
|
request['client_id'] = clientOrderId
|
2492
2616
|
if stop:
|
2493
2617
|
if swap:
|
2494
|
-
response = await self.
|
2618
|
+
response = await self.v1PerpetualPrivatePostOrderCancelStopByClientId(self.extend(request, query))
|
2495
2619
|
else:
|
2496
|
-
response = await self.
|
2620
|
+
response = await self.v1PrivateDeleteOrderStopPendingByClientId(self.extend(request, query))
|
2497
2621
|
else:
|
2498
2622
|
if swap:
|
2499
|
-
response = await self.
|
2623
|
+
response = await self.v1PerpetualPrivatePostOrderCancelByClientId(self.extend(request, query))
|
2500
2624
|
else:
|
2501
|
-
response = await self.
|
2625
|
+
response = await self.v1PrivateDeleteOrderPendingByClientId(self.extend(request, query))
|
2502
2626
|
else:
|
2503
2627
|
idRequest = 'order_id' if swap else 'id'
|
2504
2628
|
request[idRequest] = id
|
2505
2629
|
if stop:
|
2506
2630
|
if swap:
|
2507
|
-
response = await self.
|
2631
|
+
response = await self.v1PerpetualPrivatePostOrderCancelStop(self.extend(request, query))
|
2508
2632
|
else:
|
2509
|
-
response = await self.
|
2633
|
+
response = await self.v1PrivateDeleteOrderStopPendingId(self.extend(request, query))
|
2510
2634
|
else:
|
2511
2635
|
if swap:
|
2512
|
-
response = await self.
|
2636
|
+
response = await self.v1PerpetualPrivatePostOrderCancel(self.extend(request, query))
|
2513
2637
|
else:
|
2514
|
-
response = await self.
|
2638
|
+
response = await self.v1PrivateDeleteOrderPending(self.extend(request, query))
|
2515
2639
|
#
|
2516
2640
|
# Spot and Margin
|
2517
2641
|
#
|
@@ -2649,15 +2773,15 @@ class coinex(Exchange, ImplicitAPI):
|
|
2649
2773
|
response = None
|
2650
2774
|
if swap:
|
2651
2775
|
if stop:
|
2652
|
-
response = await self.
|
2776
|
+
response = await self.v1PerpetualPrivatePostOrderCancelStopAll(self.extend(request, params))
|
2653
2777
|
else:
|
2654
|
-
response = await self.
|
2778
|
+
response = await self.v1PerpetualPrivatePostOrderCancelAll(self.extend(request, params))
|
2655
2779
|
else:
|
2656
2780
|
request['account_id'] = accountId
|
2657
2781
|
if stop:
|
2658
|
-
response = await self.
|
2782
|
+
response = await self.v1PrivateDeleteOrderStopPending(self.extend(request, params))
|
2659
2783
|
else:
|
2660
|
-
response = await self.
|
2784
|
+
response = await self.v1PrivateDeleteOrderPending(self.extend(request, params))
|
2661
2785
|
#
|
2662
2786
|
# Spot and Margin
|
2663
2787
|
#
|
@@ -2696,11 +2820,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
2696
2820
|
response = None
|
2697
2821
|
if swap:
|
2698
2822
|
if stop:
|
2699
|
-
response = await self.
|
2823
|
+
response = await self.v1PerpetualPrivateGetOrderStopStatus(self.extend(request, params))
|
2700
2824
|
else:
|
2701
|
-
response = await self.
|
2825
|
+
response = await self.v1PerpetualPrivateGetOrderStatus(self.extend(request, params))
|
2702
2826
|
else:
|
2703
|
-
response = await self.
|
2827
|
+
response = await self.v1PrivateGetOrderStatus(self.extend(request, params))
|
2704
2828
|
#
|
2705
2829
|
# Spot
|
2706
2830
|
#
|
@@ -2837,24 +2961,24 @@ class coinex(Exchange, ImplicitAPI):
|
|
2837
2961
|
request['side'] = 0
|
2838
2962
|
request['offset'] = 0
|
2839
2963
|
if stop:
|
2840
|
-
response = await self.
|
2964
|
+
response = await self.v1PerpetualPrivateGetOrderStopPending(self.extend(request, params))
|
2841
2965
|
else:
|
2842
2966
|
if status == 'finished':
|
2843
|
-
response = await self.
|
2967
|
+
response = await self.v1PerpetualPrivateGetOrderFinished(self.extend(request, params))
|
2844
2968
|
elif status == 'pending':
|
2845
|
-
response = await self.
|
2969
|
+
response = await self.v1PerpetualPrivateGetOrderPending(self.extend(request, params))
|
2846
2970
|
else:
|
2847
2971
|
request['page'] = 1
|
2848
2972
|
if status == 'finished':
|
2849
2973
|
if stop:
|
2850
|
-
response = await self.
|
2974
|
+
response = await self.v1PrivateGetOrderStopFinished(self.extend(request, params))
|
2851
2975
|
else:
|
2852
|
-
response = await self.
|
2976
|
+
response = await self.v1PrivateGetOrderFinished(self.extend(request, params))
|
2853
2977
|
elif status == 'pending':
|
2854
2978
|
if stop:
|
2855
|
-
response = await self.
|
2979
|
+
response = await self.v1PrivateGetOrderStopPending(self.extend(request, params))
|
2856
2980
|
else:
|
2857
|
-
response = await self.
|
2981
|
+
response = await self.v1PrivateGetOrderPending(self.extend(request, params))
|
2858
2982
|
#
|
2859
2983
|
# Spot and Margin
|
2860
2984
|
#
|
@@ -3056,7 +3180,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3056
3180
|
network = self.safe_string(params, 'network')
|
3057
3181
|
params = self.omit(params, 'network')
|
3058
3182
|
request['smart_contract_name'] = network
|
3059
|
-
response = await self.
|
3183
|
+
response = await self.v1PrivatePutBalanceDepositAddressCoinType(self.extend(request, params))
|
3060
3184
|
#
|
3061
3185
|
# {
|
3062
3186
|
# "code": 0,
|
@@ -3094,7 +3218,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3094
3218
|
raise ExchangeError(self.id + ' fetchDepositAddress() ' + network + ' network not supported for ' + code)
|
3095
3219
|
if network is not None:
|
3096
3220
|
request['smart_contract_name'] = network
|
3097
|
-
response = await self.
|
3221
|
+
response = await self.v1PrivateGetBalanceDepositAddressCoinType(self.extend(request, params))
|
3098
3222
|
#
|
3099
3223
|
# {
|
3100
3224
|
# "code": 0,
|
@@ -3198,10 +3322,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
3198
3322
|
if since is not None:
|
3199
3323
|
request['start_time'] = since
|
3200
3324
|
request['side'] = 0
|
3201
|
-
response = await self.
|
3325
|
+
response = await self.v1PerpetualPrivateGetMarketUserDeals(self.extend(request, params))
|
3202
3326
|
else:
|
3203
3327
|
request['page'] = 1
|
3204
|
-
response = await self.
|
3328
|
+
response = await self.v1PrivateGetOrderUserDeals(self.extend(request, params))
|
3205
3329
|
#
|
3206
3330
|
# Spot and Margin
|
3207
3331
|
#
|
@@ -3292,8 +3416,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
3292
3416
|
"""
|
3293
3417
|
await self.load_markets()
|
3294
3418
|
defaultMethod = None
|
3295
|
-
defaultMethod, params = self.handle_option_and_params(params, 'fetchPositions', 'method', '
|
3296
|
-
isHistory = (defaultMethod == '
|
3419
|
+
defaultMethod, params = self.handle_option_and_params(params, 'fetchPositions', 'method', 'v1PerpetualPrivateGetPositionPending')
|
3420
|
+
isHistory = (defaultMethod == 'v1PerpetualPrivateGetPositionFinished')
|
3297
3421
|
symbols = self.market_symbols(symbols)
|
3298
3422
|
request = {}
|
3299
3423
|
market = None
|
@@ -3315,10 +3439,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
3315
3439
|
request['limit'] = 100
|
3316
3440
|
request['side'] = self.safe_integer(params, 'side', 0) # 0: All, 1: Sell, 2: Buy
|
3317
3441
|
response = None
|
3318
|
-
if defaultMethod == '
|
3319
|
-
response = await self.
|
3442
|
+
if defaultMethod == 'v1PerpetualPrivateGetPositionPending':
|
3443
|
+
response = await self.v1PerpetualPrivateGetPositionPending(self.extend(request, params))
|
3320
3444
|
else:
|
3321
|
-
response = await self.
|
3445
|
+
response = await self.v1PerpetualPrivateGetPositionFinished(self.extend(request, params))
|
3322
3446
|
#
|
3323
3447
|
# {
|
3324
3448
|
# "code": 0,
|
@@ -3397,7 +3521,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3397
3521
|
request = {
|
3398
3522
|
'market': market['id'],
|
3399
3523
|
}
|
3400
|
-
response = await self.
|
3524
|
+
response = await self.v1PerpetualPrivateGetPositionPending(self.extend(request, params))
|
3401
3525
|
#
|
3402
3526
|
# {
|
3403
3527
|
# "code": 0,
|
@@ -3601,7 +3725,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3601
3725
|
'leverage': str(leverage),
|
3602
3726
|
'position_type': positionType, # 1: isolated, 2: cross
|
3603
3727
|
}
|
3604
|
-
return await self.
|
3728
|
+
return await self.v1PerpetualPrivatePostMarketAdjustLeverage(self.extend(request, params))
|
3605
3729
|
|
3606
3730
|
async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
3607
3731
|
"""
|
@@ -3635,7 +3759,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3635
3759
|
'leverage': str(leverage),
|
3636
3760
|
'position_type': positionType, # 1: isolated, 2: cross
|
3637
3761
|
}
|
3638
|
-
return await self.
|
3762
|
+
return await self.v1PerpetualPrivatePostMarketAdjustLeverage(self.extend(request, params))
|
3639
3763
|
|
3640
3764
|
async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
|
3641
3765
|
"""
|
@@ -3646,7 +3770,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3646
3770
|
:returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
|
3647
3771
|
"""
|
3648
3772
|
await self.load_markets()
|
3649
|
-
response = await self.
|
3773
|
+
response = await self.v1PerpetualPublicGetMarketLimitConfig(params)
|
3650
3774
|
#
|
3651
3775
|
# {
|
3652
3776
|
# "code": 0,
|
@@ -3720,7 +3844,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3720
3844
|
'amount': self.amount_to_precision(symbol, amount),
|
3721
3845
|
'type': addOrReduce,
|
3722
3846
|
}
|
3723
|
-
response = await self.
|
3847
|
+
response = await self.v1PerpetualPrivatePostPositionAdjustMargin(self.extend(request, params))
|
3724
3848
|
#
|
3725
3849
|
# {
|
3726
3850
|
# "code": 0,
|
@@ -3842,7 +3966,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3842
3966
|
}
|
3843
3967
|
if since is not None:
|
3844
3968
|
request['start_time'] = since
|
3845
|
-
response = await self.
|
3969
|
+
response = await self.v1PerpetualPrivateGetPositionFunding(self.extend(request, params))
|
3846
3970
|
#
|
3847
3971
|
# {
|
3848
3972
|
# "code": 0,
|
@@ -3904,7 +4028,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3904
4028
|
request = {
|
3905
4029
|
'market': market['id'],
|
3906
4030
|
}
|
3907
|
-
response = await self.
|
4031
|
+
response = await self.v1PerpetualPublicGetMarketTicker(self.extend(request, params))
|
3908
4032
|
#
|
3909
4033
|
# {
|
3910
4034
|
# "code": 0,
|
@@ -4012,7 +4136,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4012
4136
|
market = self.market(symbol)
|
4013
4137
|
if not market['swap']:
|
4014
4138
|
raise BadSymbol(self.id + ' fetchFundingRates() supports swap contracts only')
|
4015
|
-
response = await self.
|
4139
|
+
response = await self.v1PerpetualPublicGetMarketTickerAll(params)
|
4016
4140
|
#
|
4017
4141
|
# {
|
4018
4142
|
# "code": 0,
|
@@ -4088,7 +4212,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4088
4212
|
}
|
4089
4213
|
if networkCode is not None:
|
4090
4214
|
request['smart_contract_name'] = self.network_code_to_id(networkCode)
|
4091
|
-
response = await self.
|
4215
|
+
response = await self.v1PrivatePostBalanceCoinWithdraw(self.extend(request, params))
|
4092
4216
|
#
|
4093
4217
|
# {
|
4094
4218
|
# "code": 0,
|
@@ -4154,7 +4278,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4154
4278
|
if since is not None:
|
4155
4279
|
request['start_time'] = since
|
4156
4280
|
request, params = self.handle_until_option('end_time', request, params)
|
4157
|
-
response = await self.
|
4281
|
+
response = await self.v1PerpetualPublicGetMarketFundingHistory(self.extend(request, params))
|
4158
4282
|
#
|
4159
4283
|
# {
|
4160
4284
|
# "code": 0,
|
@@ -4322,10 +4446,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
4322
4446
|
response = None
|
4323
4447
|
if (fromAccount == 'spot') and (toAccount == 'swap'):
|
4324
4448
|
request['transfer_side'] = 'in' # 'in' spot to swap, 'out' swap to spot
|
4325
|
-
response = await self.
|
4449
|
+
response = await self.v1PrivatePostContractBalanceTransfer(self.extend(request, params))
|
4326
4450
|
elif (fromAccount == 'swap') and (toAccount == 'spot'):
|
4327
4451
|
request['transfer_side'] = 'out' # 'in' spot to swap, 'out' swap to spot
|
4328
|
-
response = await self.
|
4452
|
+
response = await self.v1PrivatePostContractBalanceTransfer(self.extend(request, params))
|
4329
4453
|
else:
|
4330
4454
|
accountsById = self.safe_value(self.options, 'accountsById', {})
|
4331
4455
|
fromId = self.safe_string(accountsById, fromAccount, fromAccount)
|
@@ -4334,7 +4458,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4334
4458
|
# spot is 0, use fetchBalance() to find the margin account id
|
4335
4459
|
request['from_account'] = int(fromId)
|
4336
4460
|
request['to_account'] = int(toId)
|
4337
|
-
response = await self.
|
4461
|
+
response = await self.v1PrivatePostMarginTransfer(self.extend(request, params))
|
4338
4462
|
#
|
4339
4463
|
# {"code": 0, "data": null, "message": "Success"}
|
4340
4464
|
#
|
@@ -4445,9 +4569,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
4445
4569
|
marginMode, params = self.handle_margin_mode_and_params('fetchTransfers', params)
|
4446
4570
|
response = None
|
4447
4571
|
if marginMode is not None:
|
4448
|
-
response = await self.
|
4572
|
+
response = await self.v1PrivateGetMarginTransferHistory(self.extend(request, params))
|
4449
4573
|
else:
|
4450
|
-
response = await self.
|
4574
|
+
response = await self.v1PrivateGetContractTransferHistory(self.extend(request, params))
|
4451
4575
|
#
|
4452
4576
|
# Swap
|
4453
4577
|
#
|
@@ -4514,7 +4638,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4514
4638
|
request['coin_type'] = currency['id']
|
4515
4639
|
if limit is not None:
|
4516
4640
|
request['Limit'] = limit
|
4517
|
-
response = await self.
|
4641
|
+
response = await self.v1PrivateGetBalanceCoinWithdraw(self.extend(request, params))
|
4518
4642
|
#
|
4519
4643
|
# {
|
4520
4644
|
# "code": 0,
|
@@ -4576,7 +4700,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4576
4700
|
request['coin_type'] = currency['id']
|
4577
4701
|
if limit is not None:
|
4578
4702
|
request['Limit'] = limit
|
4579
|
-
response = await self.
|
4703
|
+
response = await self.v1PrivateGetBalanceCoinDeposit(self.extend(request, params))
|
4580
4704
|
#
|
4581
4705
|
# {
|
4582
4706
|
# "code": 0,
|
@@ -4666,7 +4790,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4666
4790
|
request = {
|
4667
4791
|
'market': market['id'],
|
4668
4792
|
}
|
4669
|
-
response = await self.
|
4793
|
+
response = await self.v1PrivateGetMarginConfig(self.extend(request, params))
|
4670
4794
|
#
|
4671
4795
|
# {
|
4672
4796
|
# "code": 0,
|
@@ -4698,7 +4822,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4698
4822
|
:returns dict: a list of `isolated borrow rate structures <https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure>`
|
4699
4823
|
"""
|
4700
4824
|
await self.load_markets()
|
4701
|
-
response = await self.
|
4825
|
+
response = await self.v1PrivateGetMarginConfig(params)
|
4702
4826
|
#
|
4703
4827
|
# {
|
4704
4828
|
# "code": 0,
|
@@ -4736,7 +4860,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4736
4860
|
request['market'] = market['id']
|
4737
4861
|
if limit is not None:
|
4738
4862
|
request['limit'] = limit
|
4739
|
-
response = await self.
|
4863
|
+
response = await self.v1PrivateGetMarginLoanHistory(self.extend(request, params))
|
4740
4864
|
#
|
4741
4865
|
# {
|
4742
4866
|
# "code": 0,
|
@@ -4829,7 +4953,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4829
4953
|
'coin_type': currency['id'],
|
4830
4954
|
'amount': self.currency_to_precision(code, amount),
|
4831
4955
|
}
|
4832
|
-
response = await self.
|
4956
|
+
response = await self.v1PrivatePostMarginLoan(self.extend(request, params))
|
4833
4957
|
#
|
4834
4958
|
# {
|
4835
4959
|
# "code": 0,
|
@@ -4865,7 +4989,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4865
4989
|
'coin_type': currency['id'],
|
4866
4990
|
'amount': self.currency_to_precision(code, amount),
|
4867
4991
|
}
|
4868
|
-
response = await self.
|
4992
|
+
response = await self.v1PrivatePostMarginFlat(self.extend(request, params))
|
4869
4993
|
#
|
4870
4994
|
# {
|
4871
4995
|
# "code": 0,
|
@@ -4919,7 +5043,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4919
5043
|
codesLength = len(codes)
|
4920
5044
|
if codesLength == 1:
|
4921
5045
|
request['coin_type'] = self.safe_value(codes, 0)
|
4922
|
-
response = await self.
|
5046
|
+
response = await self.v1PublicGetCommonAssetConfig(self.extend(request, params))
|
4923
5047
|
#
|
4924
5048
|
# {
|
4925
5049
|
# "code": 0,
|
@@ -5009,7 +5133,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
5009
5133
|
marketType, params = self.handle_market_type_and_params('fetchLeverages', market, params)
|
5010
5134
|
if marketType != 'spot':
|
5011
5135
|
raise NotSupported(self.id + ' fetchLeverages() supports spot margin markets only')
|
5012
|
-
response = await self.
|
5136
|
+
response = await self.v1PrivateGetMarginConfig(params)
|
5013
5137
|
#
|
5014
5138
|
# {
|
5015
5139
|
# "code": 0,
|
@@ -5065,9 +5189,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
5065
5189
|
def nonce(self):
|
5066
5190
|
return self.milliseconds()
|
5067
5191
|
|
5068
|
-
def sign(self, path, api=
|
5192
|
+
def sign(self, path, api=[], method='GET', params={}, headers=None, body=None):
|
5069
5193
|
path = self.implode_params(path, params)
|
5070
|
-
|
5194
|
+
version = api[0]
|
5195
|
+
requestUrl = api[1]
|
5196
|
+
url = self.urls['api'][requestUrl] + '/' + version + '/' + path
|
5071
5197
|
query = self.omit(params, self.extract_params(path))
|
5072
5198
|
nonce = str(self.nonce())
|
5073
5199
|
if method == 'POST':
|
@@ -5093,7 +5219,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
5093
5219
|
defaultId = 'x-167673045'
|
5094
5220
|
brokerId = self.safe_value(self.options, 'brokerId', defaultId)
|
5095
5221
|
query['client_id'] = brokerId + '_' + self.uuid16()
|
5096
|
-
if
|
5222
|
+
if requestUrl == 'perpetualPrivate':
|
5097
5223
|
self.check_required_credentials()
|
5098
5224
|
query = self.extend({
|
5099
5225
|
'access_id': self.apiKey,
|
@@ -5111,26 +5237,42 @@ class coinex(Exchange, ImplicitAPI):
|
|
5111
5237
|
else:
|
5112
5238
|
headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
5113
5239
|
body = urlencoded
|
5114
|
-
elif
|
5240
|
+
elif requestUrl == 'public' or requestUrl == 'perpetualPublic':
|
5115
5241
|
if query:
|
5116
5242
|
url += '?' + self.urlencode(query)
|
5117
5243
|
else:
|
5118
|
-
|
5119
|
-
|
5120
|
-
|
5121
|
-
|
5122
|
-
|
5123
|
-
|
5124
|
-
|
5125
|
-
|
5126
|
-
|
5127
|
-
|
5128
|
-
|
5129
|
-
|
5130
|
-
|
5131
|
-
|
5132
|
-
|
5133
|
-
|
5244
|
+
if version == 'v1':
|
5245
|
+
self.check_required_credentials()
|
5246
|
+
query = self.extend({
|
5247
|
+
'access_id': self.apiKey,
|
5248
|
+
'tonce': nonce,
|
5249
|
+
}, query)
|
5250
|
+
query = self.keysort(query)
|
5251
|
+
urlencoded = self.rawencode(query)
|
5252
|
+
signature = self.hash(self.encode(urlencoded + '&secret_key=' + self.secret), 'md5')
|
5253
|
+
headers = {
|
5254
|
+
'Authorization': signature.upper(),
|
5255
|
+
'Content-Type': 'application/json',
|
5256
|
+
}
|
5257
|
+
if (method == 'GET') or (method == 'DELETE') or (method == 'PUT'):
|
5258
|
+
url += '?' + urlencoded
|
5259
|
+
else:
|
5260
|
+
body = self.json(query)
|
5261
|
+
elif version == 'v2':
|
5262
|
+
self.check_required_credentials()
|
5263
|
+
query = self.keysort(query)
|
5264
|
+
urlencoded = self.rawencode(query)
|
5265
|
+
preparedString = method + '/' + version + '/' + path + '?' + urlencoded + nonce + self.secret
|
5266
|
+
signature = self.hash(self.encode(preparedString), 'sha256')
|
5267
|
+
headers = {
|
5268
|
+
'X-COINEX-KEY': self.apiKey,
|
5269
|
+
'X-COINEX-SIGN': signature,
|
5270
|
+
'X-COINEX-TIMESTAMP': nonce,
|
5271
|
+
}
|
5272
|
+
if (method == 'GET') or (method == 'DELETE') or (method == 'PUT'):
|
5273
|
+
url += '?' + urlencoded
|
5274
|
+
else:
|
5275
|
+
body = self.json(query)
|
5134
5276
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
5135
5277
|
|
5136
5278
|
def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
|