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