ccxt 4.4.82__py2.py3-none-any.whl → 4.4.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.
Files changed (121) hide show
  1. ccxt/__init__.py +3 -9
  2. ccxt/abstract/blofin.py +8 -0
  3. ccxt/abstract/btcbox.py +1 -0
  4. ccxt/abstract/myokx.py +2 -0
  5. ccxt/abstract/okx.py +2 -0
  6. ccxt/apex.py +2 -1
  7. ccxt/ascendex.py +187 -151
  8. ccxt/async_support/__init__.py +3 -9
  9. ccxt/async_support/apex.py +2 -1
  10. ccxt/async_support/ascendex.py +187 -151
  11. ccxt/async_support/base/exchange.py +51 -24
  12. ccxt/async_support/base/ws/cache.py +6 -1
  13. ccxt/async_support/bequant.py +1 -1
  14. ccxt/async_support/bitget.py +5 -6
  15. ccxt/async_support/bitmart.py +1 -1
  16. ccxt/async_support/bitrue.py +14 -32
  17. ccxt/async_support/bitso.py +33 -0
  18. ccxt/async_support/bitstamp.py +33 -0
  19. ccxt/async_support/{huobijp.py → bittrade.py} +11 -11
  20. ccxt/async_support/blofin.py +145 -14
  21. ccxt/async_support/btcbox.py +25 -5
  22. ccxt/async_support/bybit.py +16 -37
  23. ccxt/async_support/cex.py +2 -4
  24. ccxt/async_support/coinbase.py +58 -47
  25. ccxt/async_support/coinbaseexchange.py +141 -32
  26. ccxt/async_support/coincatch.py +14 -67
  27. ccxt/async_support/coinex.py +28 -29
  28. ccxt/async_support/coinlist.py +17 -16
  29. ccxt/async_support/coinmetro.py +20 -11
  30. ccxt/async_support/coinone.py +8 -10
  31. ccxt/async_support/coinsph.py +124 -2
  32. ccxt/async_support/cryptocom.py +109 -2
  33. ccxt/async_support/cryptomus.py +42 -80
  34. ccxt/async_support/delta.py +75 -36
  35. ccxt/async_support/deribit.py +4 -5
  36. ccxt/async_support/derive.py +46 -10
  37. ccxt/async_support/ellipx.py +175 -77
  38. ccxt/async_support/gate.py +1 -1
  39. ccxt/async_support/gemini.py +3 -4
  40. ccxt/async_support/hitbtc.py +56 -65
  41. ccxt/async_support/hollaex.py +106 -49
  42. ccxt/async_support/htx.py +20 -43
  43. ccxt/async_support/hyperliquid.py +6 -6
  44. ccxt/async_support/kraken.py +27 -23
  45. ccxt/async_support/kucoinfutures.py +5 -0
  46. ccxt/async_support/lbank.py +1 -1
  47. ccxt/async_support/mexc.py +2 -2
  48. ccxt/async_support/ndax.py +25 -24
  49. ccxt/async_support/okcoin.py +12 -29
  50. ccxt/async_support/okx.py +9 -0
  51. ccxt/async_support/onetrading.py +10 -7
  52. ccxt/async_support/oxfun.py +40 -110
  53. ccxt/async_support/paradex.py +123 -4
  54. ccxt/base/exchange.py +21 -2
  55. ccxt/base/types.py +3 -0
  56. ccxt/bequant.py +1 -1
  57. ccxt/bitget.py +5 -6
  58. ccxt/bitmart.py +1 -1
  59. ccxt/bitrue.py +14 -32
  60. ccxt/bitso.py +33 -0
  61. ccxt/bitstamp.py +33 -0
  62. ccxt/{huobijp.py → bittrade.py} +11 -11
  63. ccxt/blofin.py +145 -14
  64. ccxt/btcbox.py +24 -5
  65. ccxt/bybit.py +16 -37
  66. ccxt/cex.py +2 -4
  67. ccxt/coinbase.py +58 -47
  68. ccxt/coinbaseexchange.py +141 -32
  69. ccxt/coincatch.py +14 -67
  70. ccxt/coinex.py +28 -29
  71. ccxt/coinlist.py +17 -16
  72. ccxt/coinmetro.py +20 -11
  73. ccxt/coinone.py +8 -10
  74. ccxt/coinsph.py +124 -2
  75. ccxt/cryptocom.py +109 -2
  76. ccxt/cryptomus.py +42 -80
  77. ccxt/delta.py +75 -36
  78. ccxt/deribit.py +4 -5
  79. ccxt/derive.py +46 -10
  80. ccxt/ellipx.py +175 -77
  81. ccxt/gate.py +1 -1
  82. ccxt/gemini.py +3 -4
  83. ccxt/hitbtc.py +56 -65
  84. ccxt/hollaex.py +106 -49
  85. ccxt/htx.py +20 -43
  86. ccxt/hyperliquid.py +6 -6
  87. ccxt/kraken.py +27 -23
  88. ccxt/kucoinfutures.py +5 -0
  89. ccxt/lbank.py +1 -1
  90. ccxt/mexc.py +2 -2
  91. ccxt/ndax.py +25 -24
  92. ccxt/okcoin.py +12 -29
  93. ccxt/okx.py +9 -0
  94. ccxt/onetrading.py +10 -7
  95. ccxt/oxfun.py +40 -110
  96. ccxt/paradex.py +123 -4
  97. ccxt/pro/__init__.py +109 -5
  98. ccxt/pro/binance.py +32 -33
  99. ccxt/pro/bithumb.py +5 -3
  100. ccxt/pro/{huobijp.py → bittrade.py} +3 -3
  101. ccxt/pro/kraken.py +249 -79
  102. ccxt/pro/luno.py +6 -5
  103. ccxt/pro/mexc.py +254 -7
  104. ccxt/pro/poloniex.py +6 -2
  105. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/METADATA +8 -11
  106. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/RECORD +110 -121
  107. ccxt/abstract/bl3p.py +0 -19
  108. ccxt/abstract/idex.py +0 -26
  109. ccxt/abstract/kuna.py +0 -182
  110. ccxt/async_support/base/ws/fast_client.py +0 -97
  111. ccxt/async_support/bl3p.py +0 -543
  112. ccxt/async_support/idex.py +0 -1889
  113. ccxt/async_support/kuna.py +0 -1935
  114. ccxt/bl3p.py +0 -543
  115. ccxt/idex.py +0 -1889
  116. ccxt/kuna.py +0 -1935
  117. ccxt/pro/idex.py +0 -687
  118. /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
  119. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/LICENSE.txt +0 -0
  120. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/WHEEL +0 -0
  121. {ccxt-4.4.82.dist-info → ccxt-4.4.86.dist-info}/top_level.txt +0 -0
@@ -292,6 +292,14 @@ class hollaex(Exchange, ImplicitAPI):
292
292
  'BNB': 'bnb',
293
293
  'MATIC': 'matic',
294
294
  },
295
+ 'networksById': {
296
+ 'eth': 'ERC20',
297
+ 'ETH': 'ERC20',
298
+ 'ERC20': 'ERC20',
299
+ 'trx': 'TRC20',
300
+ 'TRX': 'TRC20',
301
+ 'TRC20': 'TRC20',
302
+ },
295
303
  },
296
304
  })
297
305
 
@@ -421,66 +429,115 @@ class hollaex(Exchange, ImplicitAPI):
421
429
  """
422
430
  response = await self.publicGetConstants(params)
423
431
  #
424
- # {
425
- # "coins":{
426
- # "bch":{
427
- # "id":4,
428
- # "fullname":"Bitcoin Cash",
429
- # "symbol":"bch",
430
- # "active":true,
431
- # "verified":true,
432
- # "allow_deposit":true,
433
- # "allow_withdrawal":true,
434
- # "withdrawal_fee":0.0002,
435
- # "min":0.001,
436
- # "max":100000,
437
- # "increment_unit":0.001,
438
- # "logo":"https://bitholla.s3.ap-northeast-2.amazonaws.com/icon/BCH-hollaex-asset-01.svg",
439
- # "code":"bch",
440
- # "is_public":true,
441
- # "meta":{},
442
- # "estimated_price":null,
443
- # "description":null,
444
- # "type":"blockchain",
445
- # "network":null,
446
- # "standard":null,
447
- # "issuer":"HollaEx",
448
- # "withdrawal_fees":null,
449
- # "created_at":"2019-08-09T10:45:43.367Z",
450
- # "updated_at":"2021-12-13T03:08:32.372Z",
451
- # "created_by":1,
452
- # "owner_id":1
453
- # },
432
+ # {
433
+ # "coins": {
434
+ # "usdt": {
435
+ # "id": "6",
436
+ # "fullname": "USD Tether",
437
+ # "symbol": "usdt",
438
+ # "active": True,
439
+ # "verified": True,
440
+ # "allow_deposit": True,
441
+ # "allow_withdrawal": True,
442
+ # "withdrawal_fee": "20",
443
+ # "min": "1",
444
+ # "max": "10000000",
445
+ # "increment_unit": "0.0001",
446
+ # "logo": "https://hollaex-resources.s3.ap-southeast-1.amazonaws.com/icons/usdt.svg",
447
+ # "code": "usdt",
448
+ # "is_public": True,
449
+ # "meta": {
450
+ # "color": "#27a17a",
451
+ # "website": "https://tether.to",
452
+ # "explorer": "https://blockchair.com/tether",
453
+ # "decimal_points": "6"
454
+ # },
455
+ # "estimated_price": "1",
456
+ # "description": "<p>Tether(USDT) is a stablecoin pegged 1:1 to the US dollar. It is a digital currency that aims to maintain its value while allowing for fast and secure transfer of funds. It was the first stablecoin, and is the most widely used due stablecoin due to its stability and low volatility compared to other cryptocurrencies. It was launched in 2014 by Tether Limited.</p>",
457
+ # "type": "blockchain",
458
+ # "network": "eth,trx,bnb,matic",
459
+ # "standard": "",
460
+ # "issuer": "HollaEx",
461
+ # "withdrawal_fees": {
462
+ # "bnb": {
463
+ # "value": "0.8",
464
+ # "active": True,
465
+ # "symbol": "usdt"
466
+ # },
467
+ # "eth": {
468
+ # "value": "1.5",
469
+ # "active": True,
470
+ # "symbol": "usdt"
471
+ # },
472
+ # "trx": {
473
+ # "value": "4",
474
+ # "active": True,
475
+ # "symbol": "usdt"
476
+ # },
477
+ # "matic": {
478
+ # "value": "0.3",
479
+ # "active": True,
480
+ # "symbol": "usdt"
481
+ # }
482
+ # },
483
+ # "display_name": null,
484
+ # "deposit_fees": null,
485
+ # "is_risky": False,
486
+ # "market_cap": "144568098696.29",
487
+ # "category": "stable",
488
+ # "created_at": "2019-08-09T10:45:43.367Z",
489
+ # "updated_at": "2025-03-25T17:12:37.970Z",
490
+ # "created_by": "168",
491
+ # "owner_id": "1"
492
+ # },
454
493
  # },
455
494
  # "network":"https://api.hollaex.network"
456
495
  # }
457
496
  #
458
- coins = self.safe_value(response, 'coins', {})
497
+ coins = self.safe_dict(response, 'coins', {})
459
498
  keys = list(coins.keys())
460
499
  result: dict = {}
461
500
  for i in range(0, len(keys)):
462
501
  key = keys[i]
463
502
  currency = coins[key]
464
503
  id = self.safe_string(currency, 'symbol')
465
- numericId = self.safe_integer(currency, 'id')
466
504
  code = self.safe_currency_code(id)
467
- name = self.safe_string(currency, 'fullname')
468
- depositEnabled = self.safe_value(currency, 'allow_deposit')
469
- withdrawEnabled = self.safe_value(currency, 'allow_withdrawal')
470
- isActive = self.safe_value(currency, 'active')
471
- active = isActive and depositEnabled and withdrawEnabled
472
- fee = self.safe_number(currency, 'withdrawal_fee')
473
- withdrawalLimits = self.safe_value(currency, 'withdrawal_limits', [])
474
- result[code] = {
505
+ withdrawalLimits = self.safe_list(currency, 'withdrawal_limits', [])
506
+ rawType = self.safe_string(currency, 'type')
507
+ type = 'crypto' if (rawType == 'blockchain') else 'other'
508
+ rawNetworks = self.safe_dict(currency, 'withdrawal_fees', {})
509
+ networks = {}
510
+ networkIds = list(rawNetworks.keys())
511
+ for j in range(0, len(networkIds)):
512
+ networkId = networkIds[j]
513
+ networkEntry = self.safe_dict(rawNetworks, networkId)
514
+ networkCode = self.network_id_to_code(networkId)
515
+ networks[networkCode] = {
516
+ 'id': networkId,
517
+ 'network': networkCode,
518
+ 'active': self.safe_bool(networkEntry, 'active'),
519
+ 'deposit': None,
520
+ 'withdraw': None,
521
+ 'fee': self.safe_number(networkEntry, 'value'),
522
+ 'precision': None,
523
+ 'limits': {
524
+ 'withdraw': {
525
+ 'min': None,
526
+ 'max': None,
527
+ },
528
+ },
529
+ 'info': networkEntry,
530
+ }
531
+ result[code] = self.safe_currency_structure({
475
532
  'id': id,
476
- 'numericId': numericId,
533
+ 'numericId': self.safe_integer(currency, 'id'),
477
534
  'code': code,
478
535
  'info': currency,
479
- 'name': name,
480
- 'active': active,
481
- 'deposit': depositEnabled,
482
- 'withdraw': withdrawEnabled,
483
- 'fee': fee,
536
+ 'name': self.safe_string(currency, 'fullname'),
537
+ 'active': self.safe_bool(currency, 'active'),
538
+ 'deposit': self.safe_bool(currency, 'allow_deposit'),
539
+ 'withdraw': self.safe_bool(currency, 'allow_withdrawal'),
540
+ 'fee': self.safe_number(currency, 'withdrawal_fee'),
484
541
  'precision': self.safe_number(currency, 'increment_unit'),
485
542
  'limits': {
486
543
  'amount': {
@@ -492,9 +549,9 @@ class hollaex(Exchange, ImplicitAPI):
492
549
  'max': self.safe_value(withdrawalLimits, 0),
493
550
  },
494
551
  },
495
- 'networks': {},
496
- 'type': 'crypto',
497
- }
552
+ 'networks': networks,
553
+ 'type': type,
554
+ })
498
555
  return result
499
556
 
500
557
  async def fetch_order_books(self, symbols: Strings = None, limit: Int = None, params={}) -> OrderBooks:
ccxt/async_support/htx.py CHANGED
@@ -3281,9 +3281,8 @@ class htx(Exchange, ImplicitAPI):
3281
3281
  # }
3282
3282
  # ]
3283
3283
  # }
3284
- # }
3285
3284
  #
3286
- data = self.safe_value(response, 'data', [])
3285
+ data = self.safe_list(response, 'data', [])
3287
3286
  result: dict = {}
3288
3287
  self.options['networkChainIdsByNames'] = {}
3289
3288
  self.options['networkNamesByChainIds'] = {}
@@ -3291,19 +3290,11 @@ class htx(Exchange, ImplicitAPI):
3291
3290
  entry = data[i]
3292
3291
  currencyId = self.safe_string(entry, 'currency')
3293
3292
  code = self.safe_currency_code(currencyId)
3294
- self.options['networkChainIdsByNames'][code] = {}
3295
- chains = self.safe_value(entry, 'chains', [])
3296
- networks: dict = {}
3297
- instStatus = self.safe_string(entry, 'instStatus')
3298
3293
  assetType = self.safe_string(entry, 'assetType')
3299
3294
  type = assetType == 'crypto' if '1' else 'fiat'
3300
- currencyActive = instStatus == 'normal'
3301
- minPrecision = None
3302
- minDeposit = None
3303
- minWithdraw = None
3304
- maxWithdraw = None
3305
- deposit = False
3306
- withdraw = False
3295
+ self.options['networkChainIdsByNames'][code] = {}
3296
+ chains = self.safe_list(entry, 'chains', [])
3297
+ networks: dict = {}
3307
3298
  for j in range(0, len(chains)):
3308
3299
  chainEntry = chains[j]
3309
3300
  uniqueChainId = self.safe_string(chainEntry, 'chain') # i.e. usdterc20, trc20usdt ...
@@ -3311,47 +3302,33 @@ class htx(Exchange, ImplicitAPI):
3311
3302
  self.options['networkChainIdsByNames'][code][title] = uniqueChainId
3312
3303
  self.options['networkNamesByChainIds'][uniqueChainId] = title
3313
3304
  networkCode = self.network_id_to_code(uniqueChainId)
3314
- minDeposit = self.safe_number(chainEntry, 'minDepositAmt')
3315
- minWithdraw = self.safe_number(chainEntry, 'minWithdrawAmt')
3316
- maxWithdraw = self.safe_number(chainEntry, 'maxWithdrawAmt')
3317
- withdrawStatus = self.safe_string(chainEntry, 'withdrawStatus')
3318
- depositStatus = self.safe_string(chainEntry, 'depositStatus')
3319
- withdrawEnabled = (withdrawStatus == 'allowed')
3320
- depositEnabled = (depositStatus == 'allowed')
3321
- withdraw = withdrawEnabled if (withdrawEnabled) else withdraw
3322
- deposit = depositEnabled if (depositEnabled) else deposit
3323
- active = withdrawEnabled and depositEnabled
3324
- precision = self.parse_precision(self.safe_string(chainEntry, 'withdrawPrecision'))
3325
- if precision is not None:
3326
- minPrecision = precision if (minPrecision is None) else Precise.string_min(precision, minPrecision)
3327
- fee = self.safe_number(chainEntry, 'transactFeeWithdraw')
3328
3305
  networks[networkCode] = {
3329
3306
  'info': chainEntry,
3330
3307
  'id': uniqueChainId,
3331
3308
  'network': networkCode,
3332
3309
  'limits': {
3333
3310
  'deposit': {
3334
- 'min': minDeposit,
3311
+ 'min': self.safe_number(chainEntry, 'minDepositAmt'),
3335
3312
  'max': None,
3336
3313
  },
3337
3314
  'withdraw': {
3338
- 'min': minWithdraw,
3339
- 'max': maxWithdraw,
3315
+ 'min': self.safe_number(chainEntry, 'minWithdrawAmt'),
3316
+ 'max': self.safe_number(chainEntry, 'maxWithdrawAmt'),
3340
3317
  },
3341
3318
  },
3342
- 'active': active,
3343
- 'deposit': depositEnabled,
3344
- 'withdraw': withdrawEnabled,
3345
- 'fee': fee,
3346
- 'precision': self.parse_number(precision),
3319
+ 'active': None,
3320
+ 'deposit': self.safe_string(chainEntry, 'depositStatus') == 'allowed',
3321
+ 'withdraw': self.safe_string(chainEntry, 'withdrawStatus') == 'allowed',
3322
+ 'fee': self.safe_number(chainEntry, 'transactFeeWithdraw'),
3323
+ 'precision': self.parse_number(self.parse_precision(self.safe_string(chainEntry, 'withdrawPrecision'))),
3347
3324
  }
3348
- result[code] = {
3325
+ result[code] = self.safe_currency_structure({
3349
3326
  'info': entry,
3350
3327
  'code': code,
3351
3328
  'id': currencyId,
3352
- 'active': currencyActive,
3353
- 'deposit': deposit,
3354
- 'withdraw': withdraw,
3329
+ 'active': self.safe_string(entry, 'instStatus') == 'normal',
3330
+ 'deposit': None,
3331
+ 'withdraw': None,
3355
3332
  'fee': None,
3356
3333
  'name': None,
3357
3334
  'type': type,
@@ -3361,17 +3338,17 @@ class htx(Exchange, ImplicitAPI):
3361
3338
  'max': None,
3362
3339
  },
3363
3340
  'withdraw': {
3364
- 'min': minWithdraw,
3365
- 'max': maxWithdraw,
3341
+ 'min': None,
3342
+ 'max': None,
3366
3343
  },
3367
3344
  'deposit': {
3368
3345
  'min': None,
3369
3346
  'max': None,
3370
3347
  },
3371
3348
  },
3372
- 'precision': self.parse_number(minPrecision),
3349
+ 'precision': None,
3373
3350
  'networks': networks,
3374
- }
3351
+ })
3375
3352
  return result
3376
3353
 
3377
3354
  def network_id_to_code(self, networkId: Str = None, currencyCode: Str = None):
@@ -185,12 +185,12 @@ class hyperliquid(Exchange, ImplicitAPI):
185
185
  },
186
186
  'fees': {
187
187
  'swap': {
188
- 'taker': self.parse_number('0.00035'),
189
- 'maker': self.parse_number('0.0001'),
188
+ 'taker': self.parse_number('0.00045'),
189
+ 'maker': self.parse_number('0.00015'),
190
190
  },
191
191
  'spot': {
192
- 'taker': self.parse_number('0.00035'),
193
- 'maker': self.parse_number('0.0001'),
192
+ 'taker': self.parse_number('0.0007'),
193
+ 'maker': self.parse_number('0.0004'),
194
194
  },
195
195
  },
196
196
  'requiredCredentials': {
@@ -369,7 +369,7 @@ class hyperliquid(Exchange, ImplicitAPI):
369
369
  id = i
370
370
  name = self.safe_string(data, 'name')
371
371
  code = self.safe_currency_code(name)
372
- result[code] = {
372
+ result[code] = self.safe_currency_structure({
373
373
  'id': id,
374
374
  'name': name,
375
375
  'code': code,
@@ -391,7 +391,7 @@ class hyperliquid(Exchange, ImplicitAPI):
391
391
  'max': None,
392
392
  },
393
393
  },
394
- }
394
+ })
395
395
  return result
396
396
 
397
397
  async def fetch_markets(self, params={}) -> List[Market]:
@@ -1616,6 +1616,8 @@ class kraken(Exchange, ImplicitAPI):
1616
1616
  'volume': self.amount_to_precision(symbol, amount),
1617
1617
  }
1618
1618
  orderRequest = self.order_request('createOrder', symbol, type, request, amount, price, params)
1619
+ flags = self.safe_string(orderRequest[0], 'oflags', '')
1620
+ isUsingCost = flags.find('viqc') > -1
1619
1621
  response = await self.privatePostAddOrder(self.extend(orderRequest[0], orderRequest[1]))
1620
1622
  #
1621
1623
  # {
@@ -1627,6 +1629,10 @@ class kraken(Exchange, ImplicitAPI):
1627
1629
  # }
1628
1630
  #
1629
1631
  result = self.safe_dict(response, 'result')
1632
+ result['usingCost'] = isUsingCost
1633
+ # it's impossible to know if the order was created using cost or base currency
1634
+ # becuase kraken only returns something like self: {order: 'buy 10.00000000 LTCUSD @ market'}
1635
+ # self usingCost flag is used to help the parsing but omited from the order
1630
1636
  return self.parse_order(result)
1631
1637
 
1632
1638
  def find_market_by_altname_or_id(self, id):
@@ -1713,22 +1719,15 @@ class kraken(Exchange, ImplicitAPI):
1713
1719
  # }
1714
1720
  #
1715
1721
  # ws - createOrder
1716
- # {
1717
- # "descr": 'sell 0.00010000 XBTUSDT @ market',
1718
- # "event": 'addOrderStatus',
1719
- # "reqid": 1,
1720
- # "status": 'ok',
1721
- # "txid": 'OAVXZH-XIE54-JCYYDG'
1722
- # }
1722
+ # {
1723
+ # "order_id": "OXM2QD-EALR2-YBAVEU"
1724
+ # }
1725
+ #
1723
1726
  # ws - editOrder
1724
- # {
1725
- # "descr": "order edited price = 9000.00000000",
1726
- # "event": "editOrderStatus",
1727
- # "originaltxid": "O65KZW-J4AW3-VFS74A",
1728
- # "reqid": 3,
1729
- # "status": "ok",
1730
- # "txid": "OTI672-HJFAO-XOIPPK"
1731
- # }
1727
+ # {
1728
+ # "amend_id": "TJSMEH-AA67V-YUSQ6O",
1729
+ # "order_id": "OXM2QD-EALR2-YBAVEU"
1730
+ # }
1732
1731
  #
1733
1732
  # {
1734
1733
  # "error": [],
@@ -1796,6 +1795,8 @@ class kraken(Exchange, ImplicitAPI):
1796
1795
  # "oflags": "fciq"
1797
1796
  # }
1798
1797
  #
1798
+ isUsingCost = self.safe_bool(order, 'usingCost', False)
1799
+ order = self.omit(order, 'usingCost')
1799
1800
  description = self.safe_dict(order, 'descr', {})
1800
1801
  orderDescriptionObj = self.safe_dict(order, 'descr') # can be null
1801
1802
  orderDescription = None
@@ -1808,11 +1809,15 @@ class kraken(Exchange, ImplicitAPI):
1808
1809
  marketId = None
1809
1810
  price = None
1810
1811
  amount = None
1812
+ cost = None
1811
1813
  triggerPrice = None
1812
1814
  if orderDescription is not None:
1813
1815
  parts = orderDescription.split(' ')
1814
1816
  side = self.safe_string(parts, 0)
1815
- amount = self.safe_string(parts, 1)
1817
+ if not isUsingCost:
1818
+ amount = self.safe_string(parts, 1)
1819
+ else:
1820
+ cost = self.safe_string(parts, 1)
1816
1821
  marketId = self.safe_string(parts, 2)
1817
1822
  part4 = self.safe_string(parts, 4)
1818
1823
  part5 = self.safe_string(parts, 5)
@@ -1842,13 +1847,12 @@ class kraken(Exchange, ImplicitAPI):
1842
1847
  # kraken truncates the cost in the api response so we will ignore it and calculate it from average & filled
1843
1848
  # cost = self.safe_string(order, 'cost')
1844
1849
  price = self.safe_string(description, 'price', price)
1845
- # when type = trailling stop returns price = '+50.0000%'
1846
- if (price is not None) and price.endswith('%'):
1850
+ # when type = trailing stop returns price = '+50.0000%'
1851
+ if (price is not None) and (price.endswith('%') or Precise.string_equals(price, '0.00000') or Precise.string_equals(price, '0')):
1847
1852
  price = None # self is not the price we want
1848
- if (price is None) or Precise.string_equals(price, '0'):
1853
+ if price is None:
1849
1854
  price = self.safe_string(description, 'price2')
1850
- if (price is None) or Precise.string_equals(price, '0'):
1851
- price = self.safe_string(order, 'price', price)
1855
+ price = self.safe_string_2(order, 'limitprice', 'price', price)
1852
1856
  flags = self.safe_string(order, 'oflags', '')
1853
1857
  isPostOnly = flags.find('post') > -1
1854
1858
  average = self.safe_number(order, 'price')
@@ -1865,7 +1869,7 @@ class kraken(Exchange, ImplicitAPI):
1865
1869
  elif flags.find('fcib') >= 0:
1866
1870
  fee['currency'] = market['base']
1867
1871
  status = self.parse_order_status(self.safe_string(order, 'status'))
1868
- id = self.safe_string_n(order, ['id', 'txid', 'amend_id'])
1872
+ id = self.safe_string_n(order, ['id', 'txid', 'order_id', 'amend_id'])
1869
1873
  if (id is None) or (id.startswith('[')):
1870
1874
  txid = self.safe_list(order, 'txid')
1871
1875
  id = self.safe_string(txid, 0)
@@ -1922,7 +1926,7 @@ class kraken(Exchange, ImplicitAPI):
1922
1926
  'triggerPrice': triggerPrice,
1923
1927
  'takeProfitPrice': takeProfitPrice,
1924
1928
  'stopLossPrice': stopLossPrice,
1925
- 'cost': None,
1929
+ 'cost': cost,
1926
1930
  'amount': amount,
1927
1931
  'filled': filled,
1928
1932
  'average': average,
@@ -1510,6 +1510,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1510
1510
  :param str [params.timeInForce]: GTC, GTT, IOC, or FOK, default is GTC, limit orders only
1511
1511
  :param str [params.postOnly]: Post only flag, invalid when timeInForce is IOC or FOK
1512
1512
  :param float [params.cost]: the cost of the order in units of USDT
1513
+ :param str [params.marginMode]: 'cross' or 'isolated', default is 'isolated'
1513
1514
  ----------------- Exchange Specific Parameters -----------------
1514
1515
  :param float [params.leverage]: Leverage size of the order(mandatory param in request, default is 1)
1515
1516
  :param str [params.clientOid]: client order id, defaults to uuid if not passed
@@ -1607,6 +1608,10 @@ class kucoinfutures(kucoin, ImplicitAPI):
1607
1608
  'type': type, # limit or market
1608
1609
  'leverage': 1,
1609
1610
  }
1611
+ marginModeUpper = self.safe_string_upper(params, 'marginMode')
1612
+ if marginModeUpper is not None:
1613
+ params = self.omit(params, 'marginMode')
1614
+ request['marginMode'] = marginModeUpper
1610
1615
  cost = self.safe_string(params, 'cost')
1611
1616
  params = self.omit(params, 'cost')
1612
1617
  if cost is not None:
@@ -876,7 +876,7 @@ class lbank(Exchange, ImplicitAPI):
876
876
  timestamp = self.milliseconds()
877
877
  if market['swap']:
878
878
  return self.parse_order_book(orderbook, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume')
879
- return self.parse_order_book(orderbook, market['symbol'], timestamp)
879
+ return self.parse_order_book(orderbook, market['symbol'], timestamp, 'bids', 'asks', 1, 0)
880
880
 
881
881
  def parse_trade(self, trade: dict, market: Market = None) -> Trade:
882
882
  #
@@ -1097,7 +1097,6 @@ class mexc(Exchange, ImplicitAPI):
1097
1097
  currency = response[i]
1098
1098
  id = self.safe_string(currency, 'coin')
1099
1099
  code = self.safe_currency_code(id)
1100
- name = self.safe_string(currency, 'name')
1101
1100
  networks: dict = {}
1102
1101
  chains = self.safe_value(currency, 'networkList', [])
1103
1102
  for j in range(0, len(chains)):
@@ -1119,12 +1118,13 @@ class mexc(Exchange, ImplicitAPI):
1119
1118
  'max': self.safe_string(chain, 'withdrawMax'),
1120
1119
  },
1121
1120
  },
1121
+ 'contract': self.safe_string(chain, 'contract'),
1122
1122
  }
1123
1123
  result[code] = self.safe_currency_structure({
1124
1124
  'info': currency,
1125
1125
  'id': id,
1126
1126
  'code': code,
1127
- 'name': name,
1127
+ 'name': self.safe_string(currency, 'name'),
1128
1128
  'active': None,
1129
1129
  'deposit': None,
1130
1130
  'withdraw': None,
@@ -454,44 +454,44 @@ class ndax(Exchange, ImplicitAPI):
454
454
  }
455
455
  response = await self.publicGetGetProducts(self.extend(request, params))
456
456
  #
457
- # [
458
- # {
459
- # "OMSId":1,
460
- # "ProductId":1,
461
- # "Product":"BTC",
462
- # "ProductFullName":"Bitcoin",
463
- # "ProductType":"CryptoCurrency",
464
- # "DecimalPlaces":8,
465
- # "TickSize":0.0000000100000000000000000000,
466
- # "NoFees":false,
467
- # "IsDisabled":false,
468
- # "MarginEnabled":false
469
- # },
470
- # ]
457
+ # [
458
+ # {
459
+ # "OMSId": "1",
460
+ # "ProductId": "1",
461
+ # "Product": "BTC",
462
+ # "ProductFullName": "Bitcoin",
463
+ # "MasterDataUniqueProductSymbol": "",
464
+ # "ProductType": "CryptoCurrency",
465
+ # "DecimalPlaces": "8",
466
+ # "TickSize": "0.0000000100000000000000000000",
467
+ # "DepositEnabled": True,
468
+ # "WithdrawEnabled": True,
469
+ # "NoFees": False,
470
+ # "IsDisabled": False,
471
+ # "MarginEnabled": False
472
+ # },
473
+ # ...
471
474
  #
472
475
  result: dict = {}
473
476
  for i in range(0, len(response)):
474
477
  currency = response[i]
475
478
  id = self.safe_string(currency, 'ProductId')
476
- name = self.safe_string(currency, 'ProductFullName')
479
+ code = self.safe_currency_code(self.safe_string(currency, 'Product'))
477
480
  ProductType = self.safe_string(currency, 'ProductType')
478
481
  type = 'fiat' if (ProductType == 'NationalCurrency') else 'crypto'
479
482
  if ProductType == 'Unknown':
480
483
  # such currency is just a blanket entry
481
484
  type = 'other'
482
- code = self.safe_currency_code(self.safe_string(currency, 'Product'))
483
- isDisabled = self.safe_value(currency, 'IsDisabled')
484
- active = not isDisabled
485
- result[code] = {
485
+ result[code] = self.safe_currency_structure({
486
486
  'id': id,
487
- 'name': name,
487
+ 'name': self.safe_string(currency, 'ProductFullName'),
488
488
  'code': code,
489
489
  'type': type,
490
490
  'precision': self.safe_number(currency, 'TickSize'),
491
491
  'info': currency,
492
- 'active': active,
493
- 'deposit': None,
494
- 'withdraw': None,
492
+ 'active': not self.safe_bool(currency, 'IsDisabled'),
493
+ 'deposit': self.safe_bool(currency, 'DepositEnabled'),
494
+ 'withdraw': self.safe_bool(currency, 'WithdrawEnabled'),
495
495
  'fee': None,
496
496
  'limits': {
497
497
  'amount': {
@@ -504,7 +504,8 @@ class ndax(Exchange, ImplicitAPI):
504
504
  },
505
505
  },
506
506
  'networks': {},
507
- }
507
+ 'margin': self.safe_bool(currency, 'MarginEnabled'),
508
+ })
508
509
  return result
509
510
 
510
511
  async def fetch_markets(self, params={}) -> List[Market]: