ccxt 4.4.77__py2.py3-none-any.whl → 4.4.80__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 (133) hide show
  1. ccxt/__init__.py +3 -3
  2. ccxt/abstract/apex.py +31 -0
  3. ccxt/abstract/bitmart.py +1 -0
  4. ccxt/apex.py +1884 -0
  5. ccxt/ascendex.py +23 -6
  6. ccxt/async_support/__init__.py +3 -3
  7. ccxt/async_support/apex.py +1884 -0
  8. ccxt/async_support/ascendex.py +23 -6
  9. ccxt/async_support/base/exchange.py +5 -1
  10. ccxt/async_support/binance.py +9 -3
  11. ccxt/async_support/bingx.py +4 -4
  12. ccxt/async_support/bitfinex.py +61 -36
  13. ccxt/async_support/bitflyer.py +2 -2
  14. ccxt/async_support/bitget.py +186 -128
  15. ccxt/async_support/bitmart.py +9 -4
  16. ccxt/async_support/bitmex.py +14 -7
  17. ccxt/async_support/bitopro.py +5 -1
  18. ccxt/async_support/bitrue.py +2 -1
  19. ccxt/async_support/bitso.py +1 -1
  20. ccxt/async_support/bitteam.py +2 -0
  21. ccxt/async_support/bitvavo.py +25 -10
  22. ccxt/async_support/btcalpha.py +1 -1
  23. ccxt/async_support/btcmarkets.py +1 -1
  24. ccxt/async_support/btcturk.py +1 -1
  25. ccxt/async_support/bybit.py +27 -15
  26. ccxt/async_support/cex.py +1 -1
  27. ccxt/async_support/coinbase.py +17 -4
  28. ccxt/async_support/coincatch.py +66 -0
  29. ccxt/async_support/coinex.py +2 -1
  30. ccxt/async_support/coinlist.py +1 -0
  31. ccxt/async_support/coinone.py +1 -0
  32. ccxt/async_support/cryptocom.py +2 -2
  33. ccxt/async_support/defx.py +1 -1
  34. ccxt/async_support/delta.py +4 -1
  35. ccxt/async_support/deribit.py +3 -2
  36. ccxt/async_support/derive.py +2 -2
  37. ccxt/async_support/digifinex.py +2 -2
  38. ccxt/async_support/gate.py +1 -1
  39. ccxt/async_support/hitbtc.py +5 -2
  40. ccxt/async_support/hollaex.py +1 -0
  41. ccxt/async_support/htx.py +9 -5
  42. ccxt/async_support/huobijp.py +1 -0
  43. ccxt/async_support/hyperliquid.py +14 -6
  44. ccxt/async_support/kraken.py +4 -2
  45. ccxt/async_support/krakenfutures.py +2 -2
  46. ccxt/async_support/kucoinfutures.py +2 -2
  47. ccxt/async_support/mexc.py +50 -52
  48. ccxt/async_support/okx.py +2 -2
  49. ccxt/async_support/oxfun.py +2 -2
  50. ccxt/async_support/paradex.py +2 -2
  51. ccxt/async_support/phemex.py +4 -3
  52. ccxt/async_support/poloniex.py +4 -3
  53. ccxt/async_support/probit.py +1 -0
  54. ccxt/async_support/timex.py +2 -2
  55. ccxt/async_support/tradeogre.py +2 -1
  56. ccxt/async_support/upbit.py +243 -63
  57. ccxt/async_support/vertex.py +2 -2
  58. ccxt/async_support/whitebit.py +66 -12
  59. ccxt/async_support/woo.py +5 -3
  60. ccxt/async_support/woofipro.py +2 -2
  61. ccxt/async_support/xt.py +9 -2
  62. ccxt/base/exchange.py +69 -2
  63. ccxt/binance.py +9 -3
  64. ccxt/bingx.py +4 -4
  65. ccxt/bitfinex.py +61 -36
  66. ccxt/bitflyer.py +2 -2
  67. ccxt/bitget.py +186 -128
  68. ccxt/bitmart.py +9 -4
  69. ccxt/bitmex.py +14 -7
  70. ccxt/bitopro.py +5 -1
  71. ccxt/bitrue.py +2 -1
  72. ccxt/bitso.py +1 -1
  73. ccxt/bitteam.py +2 -0
  74. ccxt/bitvavo.py +25 -10
  75. ccxt/btcalpha.py +1 -1
  76. ccxt/btcmarkets.py +1 -1
  77. ccxt/btcturk.py +1 -1
  78. ccxt/bybit.py +27 -15
  79. ccxt/cex.py +1 -1
  80. ccxt/coinbase.py +17 -4
  81. ccxt/coincatch.py +66 -0
  82. ccxt/coinex.py +2 -1
  83. ccxt/coinlist.py +1 -0
  84. ccxt/coinone.py +1 -0
  85. ccxt/cryptocom.py +2 -2
  86. ccxt/defx.py +1 -1
  87. ccxt/delta.py +4 -1
  88. ccxt/deribit.py +3 -2
  89. ccxt/derive.py +2 -2
  90. ccxt/digifinex.py +2 -2
  91. ccxt/gate.py +1 -1
  92. ccxt/hitbtc.py +5 -2
  93. ccxt/hollaex.py +1 -0
  94. ccxt/htx.py +9 -5
  95. ccxt/huobijp.py +1 -0
  96. ccxt/hyperliquid.py +14 -6
  97. ccxt/kraken.py +4 -2
  98. ccxt/krakenfutures.py +2 -2
  99. ccxt/kucoinfutures.py +2 -2
  100. ccxt/mexc.py +50 -52
  101. ccxt/okx.py +2 -2
  102. ccxt/oxfun.py +2 -2
  103. ccxt/paradex.py +2 -2
  104. ccxt/phemex.py +4 -3
  105. ccxt/poloniex.py +4 -3
  106. ccxt/pro/__init__.py +5 -1
  107. ccxt/pro/apex.py +984 -0
  108. ccxt/pro/binance.py +3 -3
  109. ccxt/pro/coinbase.py +43 -57
  110. ccxt/pro/gate.py +22 -2
  111. ccxt/pro/hollaex.py +2 -2
  112. ccxt/pro/p2b.py +2 -2
  113. ccxt/pro/tradeogre.py +272 -0
  114. ccxt/pro/upbit.py +42 -0
  115. ccxt/probit.py +1 -0
  116. ccxt/test/tests_async.py +4 -1
  117. ccxt/test/tests_sync.py +4 -1
  118. ccxt/timex.py +2 -2
  119. ccxt/tradeogre.py +2 -1
  120. ccxt/upbit.py +243 -63
  121. ccxt/vertex.py +2 -2
  122. ccxt/whitebit.py +66 -12
  123. ccxt/woo.py +5 -3
  124. ccxt/woofipro.py +2 -2
  125. ccxt/xt.py +9 -2
  126. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/METADATA +9 -11
  127. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/RECORD +130 -128
  128. ccxt/abstract/ace.py +0 -15
  129. ccxt/ace.py +0 -1152
  130. ccxt/async_support/ace.py +0 -1152
  131. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/LICENSE.txt +0 -0
  132. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/WHEEL +0 -0
  133. {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/top_level.txt +0 -0
@@ -245,6 +245,7 @@ class bitopro(Exchange, ImplicitAPI):
245
245
  'BEP20': 'BSC',
246
246
  'BSC': 'BSC',
247
247
  },
248
+ 'fiatCurrencies': ['TWD'], # the only fiat currency for exchange
248
249
  },
249
250
  'features': {
250
251
  'spot': {
@@ -373,6 +374,7 @@ class bitopro(Exchange, ImplicitAPI):
373
374
  # }
374
375
  #
375
376
  result: dict = {}
377
+ fiatCurrencies = self.safe_list(self.options, 'fiatCurrencies', [])
376
378
  for i in range(0, len(currencies)):
377
379
  currency = currencies[i]
378
380
  currencyId = self.safe_string(currency, 'currency')
@@ -392,11 +394,12 @@ class bitopro(Exchange, ImplicitAPI):
392
394
  'max': None,
393
395
  },
394
396
  }
397
+ isFiat = self.in_array(code, fiatCurrencies)
395
398
  result[code] = {
396
399
  'id': currencyId,
397
400
  'code': code,
398
401
  'info': currency,
399
- 'type': None,
402
+ 'type': 'fiat' if isFiat else 'crypto',
400
403
  'name': None,
401
404
  'active': deposit and withdraw,
402
405
  'deposit': deposit,
@@ -404,6 +407,7 @@ class bitopro(Exchange, ImplicitAPI):
404
407
  'fee': fee,
405
408
  'precision': None,
406
409
  'limits': limits,
410
+ 'networks': None,
407
411
  }
408
412
  return result
409
413
 
@@ -834,7 +834,8 @@ class bitrue(Exchange, ImplicitAPI):
834
834
  'withdraw': withdraw,
835
835
  'networks': networks,
836
836
  'fee': self.parse_number(minWithdrawFeeString),
837
- # 'fees': fees,
837
+ 'fees': None,
838
+ 'type': 'crypto',
838
839
  'limits': {
839
840
  'withdraw': {
840
841
  'min': self.parse_number(minWithdrawString),
@@ -742,7 +742,7 @@ class bitso(Exchange, ImplicitAPI):
742
742
  # {
743
743
  # "bucket_start_time":1648219140000,
744
744
  # "first_trade_time":1648219154990,
745
- # "last_trade_time":1648219189441,
745
+ # "last_trade_time":1648219189442,
746
746
  # "first_rate":"44958.60",
747
747
  # "last_rate":"44979.88",
748
748
  # "min_rate":"44957.33",
@@ -650,6 +650,7 @@ class bitteam(Exchange, ImplicitAPI):
650
650
  networkIds = list(feesByNetworkId.keys())
651
651
  networks: dict = {}
652
652
  networkPrecision = self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals')))
653
+ typeRaw = self.safe_string(currency, 'type')
653
654
  for j in range(0, len(networkIds)):
654
655
  networkId = networkIds[j]
655
656
  networkCode = self.network_id_to_code(networkId, code)
@@ -703,6 +704,7 @@ class bitteam(Exchange, ImplicitAPI):
703
704
  'max': None,
704
705
  },
705
706
  },
707
+ 'type': typeRaw, # 'crypto' or 'fiat'
706
708
  'networks': networks,
707
709
  }
708
710
  return result
@@ -361,6 +361,8 @@ class bitvavo(Exchange, ImplicitAPI):
361
361
  'ERC20': 'ETH',
362
362
  'TRC20': 'TRX',
363
363
  },
364
+ 'operatorId': None, # self will be required soon for order-related endpoints
365
+ 'fiatCurrencies': ['EUR'], # only fiat atm
364
366
  },
365
367
  'precisionMode': SIGNIFICANT_DIGITS,
366
368
  'commonCurrencies': {
@@ -567,24 +569,24 @@ class bitvavo(Exchange, ImplicitAPI):
567
569
  # },
568
570
  # ]
569
571
  #
572
+ fiatCurrencies = self.safe_list(self.options, 'fiatCurrencies', [])
570
573
  result: dict = {}
571
574
  for i in range(0, len(currencies)):
572
575
  currency = currencies[i]
573
576
  id = self.safe_string(currency, 'symbol')
574
577
  code = self.safe_currency_code(id)
578
+ isFiat = self.in_array(code, fiatCurrencies)
575
579
  networks: dict = {}
576
- networksArray = self.safe_value(currency, 'networks', [])
577
- networksLength = len(networksArray)
578
- isOneNetwork = (networksLength == 1)
579
- deposit = (self.safe_value(currency, 'depositStatus') == 'OK')
580
- withdrawal = (self.safe_value(currency, 'withdrawalStatus') == 'OK')
580
+ networksArray = self.safe_list(currency, 'networks', [])
581
+ deposit = self.safe_string(currency, 'depositStatus') == 'OK'
582
+ withdrawal = self.safe_string(currency, 'withdrawalStatus') == 'OK'
581
583
  active = deposit and withdrawal
582
584
  withdrawFee = self.safe_number(currency, 'withdrawalFee')
583
585
  precision = self.safe_integer(currency, 'decimals', 8)
584
586
  minWithdraw = self.safe_number(currency, 'withdrawalMinAmount')
585
- # absolutely all of them have 1 network atm - ETH. So, we can reliably assign that inside networks
586
- if isOneNetwork:
587
- networkId = networksArray[0]
587
+ # btw, absolutely all of them have 1 network atm
588
+ for j in range(0, len(networksArray)):
589
+ networkId = networksArray[j]
588
590
  networkCode = self.network_id_to_code(networkId)
589
591
  networks[networkCode] = {
590
592
  'info': currency,
@@ -602,7 +604,7 @@ class bitvavo(Exchange, ImplicitAPI):
602
604
  },
603
605
  },
604
606
  }
605
- result[code] = {
607
+ result[code] = self.safe_currency_structure({
606
608
  'info': currency,
607
609
  'id': id,
608
610
  'code': code,
@@ -613,6 +615,7 @@ class bitvavo(Exchange, ImplicitAPI):
613
615
  'networks': networks,
614
616
  'fee': withdrawFee,
615
617
  'precision': precision,
618
+ 'type': 'fiat' if isFiat else 'crypto',
616
619
  'limits': {
617
620
  'amount': {
618
621
  'min': None,
@@ -627,7 +630,7 @@ class bitvavo(Exchange, ImplicitAPI):
627
630
  'max': None,
628
631
  },
629
632
  },
630
- }
633
+ })
631
634
  # set currencies here to avoid calling publicGetAssets twice
632
635
  self.currencies = self.deep_extend(self.currencies, result)
633
636
  return result
@@ -1166,6 +1169,10 @@ class bitvavo(Exchange, ImplicitAPI):
1166
1169
  request['timeInForce'] = timeInForce
1167
1170
  if postOnly:
1168
1171
  request['postOnly'] = True
1172
+ operatorId = None
1173
+ operatorId, params = self.handle_option_and_params(params, 'createOrder', 'operatorId')
1174
+ if operatorId is not None:
1175
+ request['operatorId'] = self.parse_to_int(operatorId)
1169
1176
  return self.extend(request, params)
1170
1177
 
1171
1178
  async def create_order(self, symbol: Str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
@@ -1259,6 +1266,10 @@ class bitvavo(Exchange, ImplicitAPI):
1259
1266
  clientOrderId = self.safe_string(params, 'clientOrderId')
1260
1267
  if clientOrderId is None:
1261
1268
  request['orderId'] = id
1269
+ operatorId = None
1270
+ operatorId, params = self.handle_option_and_params(params, 'editOrder', 'operatorId')
1271
+ if operatorId is not None:
1272
+ request['operatorId'] = self.parse_to_int(operatorId)
1262
1273
  request['market'] = market['id']
1263
1274
  return request
1264
1275
 
@@ -1293,6 +1304,10 @@ class bitvavo(Exchange, ImplicitAPI):
1293
1304
  clientOrderId = self.safe_string(params, 'clientOrderId')
1294
1305
  if clientOrderId is None:
1295
1306
  request['orderId'] = id
1307
+ operatorId = None
1308
+ operatorId, params = self.handle_option_and_params(params, 'cancelOrder', 'operatorId')
1309
+ if operatorId is not None:
1310
+ request['operatorId'] = self.parse_to_int(operatorId)
1296
1311
  return self.extend(request, params)
1297
1312
 
1298
1313
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -216,7 +216,7 @@ class btcalpha(Exchange, ImplicitAPI):
216
216
  'symbolRequired': False,
217
217
  },
218
218
  'fetchOHLCV': {
219
- 'max': 720,
219
+ 'limit': 720,
220
220
  },
221
221
  },
222
222
  'swap': {
@@ -455,7 +455,7 @@ class btcmarkets(Exchange, ImplicitAPI):
455
455
  # "marketId":"COMP-AUD",
456
456
  # "baseAssetName":"COMP",
457
457
  # "quoteAssetName":"AUD",
458
- # "minOrderAmount":"0.00007",
458
+ # "minOrderAmount":"0.00006",
459
459
  # "maxOrderAmount":"1000000",
460
460
  # "amountDecimals":"8",
461
461
  # "priceDecimals":"2",
@@ -248,7 +248,7 @@ class btcturk(Exchange, ImplicitAPI):
248
248
  # "minPrice": "0.0000000000001",
249
249
  # "maxPrice": "10000000",
250
250
  # "tickSize": "10",
251
- # "minExchangeValue": "99.91",
251
+ # "minExchangeValue": "99.92",
252
252
  # "minAmount": null,
253
253
  # "maxAmount": null
254
254
  # }
@@ -1041,9 +1041,6 @@ class bybit(Exchange, ImplicitAPI):
1041
1041
  'usePrivateInstrumentsInfo': False,
1042
1042
  'enableDemoTrading': False,
1043
1043
  'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
1044
- 'createOrder': {
1045
- 'method': 'privatePostV5OrderCreate', # 'privatePostV5PositionTradingStop'
1046
- },
1047
1044
  'enableUnifiedMargin': None,
1048
1045
  'enableUnifiedAccount': None,
1049
1046
  'unifiedMarginStatus': None,
@@ -2142,7 +2139,7 @@ class bybit(Exchange, ImplicitAPI):
2142
2139
  'quoteId': quoteId,
2143
2140
  'settleId': settleId,
2144
2141
  'type': 'option',
2145
- 'subType': 'linear',
2142
+ 'subType': None,
2146
2143
  'spot': False,
2147
2144
  'margin': False,
2148
2145
  'swap': False,
@@ -2150,8 +2147,8 @@ class bybit(Exchange, ImplicitAPI):
2150
2147
  'option': True,
2151
2148
  'active': isActive,
2152
2149
  'contract': True,
2153
- 'linear': True,
2154
- 'inverse': False,
2150
+ 'linear': None,
2151
+ 'inverse': None,
2155
2152
  'taker': self.safe_number(market, 'takerFee', self.parse_number('0.0006')),
2156
2153
  'maker': self.safe_number(market, 'makerFee', self.parse_number('0.0001')),
2157
2154
  'contractSize': self.parse_number('1'),
@@ -3775,12 +3772,21 @@ class bybit(Exchange, ImplicitAPI):
3775
3772
  parts = await self.is_unified_enabled()
3776
3773
  enableUnifiedAccount = parts[1]
3777
3774
  trailingAmount = self.safe_string_2(params, 'trailingAmount', 'trailingStop')
3775
+ stopLossPrice = self.safe_string(params, 'stopLossPrice')
3776
+ takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
3778
3777
  isTrailingAmountOrder = trailingAmount is not None
3778
+ isStopLoss = stopLossPrice is not None
3779
+ isTakeProfit = takeProfitPrice is not None
3779
3780
  orderRequest = self.create_order_request(symbol, type, side, amount, price, params, enableUnifiedAccount)
3780
- options = self.safe_dict(self.options, 'createOrder', {})
3781
- defaultMethod = self.safe_string(options, 'method', 'privatePostV5OrderCreate')
3781
+ defaultMethod = None
3782
+ if isTrailingAmountOrder or isStopLoss or isTakeProfit:
3783
+ defaultMethod = 'privatePostV5PositionTradingStop'
3784
+ else:
3785
+ defaultMethod = 'privatePostV5OrderCreate'
3786
+ method = None
3787
+ method, params = self.handle_option_and_params(params, 'createOrder', 'method', defaultMethod)
3782
3788
  response = None
3783
- if isTrailingAmountOrder or (defaultMethod == 'privatePostV5PositionTradingStop'):
3789
+ if method == 'privatePostV5PositionTradingStop':
3784
3790
  response = await self.privatePostV5PositionTradingStop(orderRequest)
3785
3791
  else:
3786
3792
  response = await self.privatePostV5OrderCreate(orderRequest) # already extended inside createOrderRequest
@@ -3805,8 +3811,6 @@ class bybit(Exchange, ImplicitAPI):
3805
3811
  lowerCaseType = type.lower()
3806
3812
  if (price is None) and (lowerCaseType == 'limit'):
3807
3813
  raise ArgumentsRequired(self.id + ' createOrder requires a price argument for limit orders')
3808
- defaultMethod = None
3809
- defaultMethod, params = self.handle_option_and_params(params, 'createOrder', 'method', 'privatePostV5OrderCreate')
3810
3814
  request: dict = {
3811
3815
  'symbol': market['id'],
3812
3816
  # 'side': self.capitalize(side),
@@ -3850,7 +3854,14 @@ class bybit(Exchange, ImplicitAPI):
3850
3854
  isMarket = lowerCaseType == 'market'
3851
3855
  isLimit = lowerCaseType == 'limit'
3852
3856
  isBuy = side == 'buy'
3853
- isAlternativeEndpoint = defaultMethod == 'privatePostV5PositionTradingStop'
3857
+ defaultMethod = None
3858
+ if isTrailingAmountOrder or isStopLossTriggerOrder or isTakeProfitTriggerOrder:
3859
+ defaultMethod = 'privatePostV5PositionTradingStop'
3860
+ else:
3861
+ defaultMethod = 'privatePostV5OrderCreate'
3862
+ method = None
3863
+ method, params = self.handle_option_and_params(params, 'createOrder', 'method', defaultMethod)
3864
+ isAlternativeEndpoint = method == 'privatePostV5PositionTradingStop'
3854
3865
  amountString = self.get_amount(symbol, amount)
3855
3866
  priceString = self.get_price(symbol, self.number_to_string(price)) if (price is not None) else None
3856
3867
  if isTrailingAmountOrder or isAlternativeEndpoint:
@@ -3901,12 +3912,12 @@ class bybit(Exchange, ImplicitAPI):
3901
3912
  request['price'] = priceString
3902
3913
  if market['spot']:
3903
3914
  request['category'] = 'spot'
3915
+ elif market['option']:
3916
+ request['category'] = 'option'
3904
3917
  elif market['linear']:
3905
3918
  request['category'] = 'linear'
3906
3919
  elif market['inverse']:
3907
3920
  request['category'] = 'inverse'
3908
- elif market['option']:
3909
- request['category'] = 'option'
3910
3921
  cost = self.safe_string(params, 'cost')
3911
3922
  params = self.omit(params, 'cost')
3912
3923
  # if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
@@ -5651,7 +5662,8 @@ classic accounts only/ spot not supported* fetches information on an order made
5651
5662
  subType, params = self.handle_sub_type_and_params('fetchLedger', None, params)
5652
5663
  response = None
5653
5664
  if enableUnified[1]:
5654
- if subType == 'inverse':
5665
+ unifiedMarginStatus = self.safe_integer(self.options, 'unifiedMarginStatus', 5) # 3/4 uta 1.0, 5/6 uta 2.0
5666
+ if subType == 'inverse' and (unifiedMarginStatus < 5):
5655
5667
  response = await self.privateGetV5AccountContractTransactionLog(self.extend(request, params))
5656
5668
  else:
5657
5669
  response = await self.privateGetV5AccountTransactionLog(self.extend(request, params))
ccxt/async_support/cex.py CHANGED
@@ -555,7 +555,7 @@ class cex(Exchange, ImplicitAPI):
555
555
  'askVolume': None,
556
556
  'vwap': None,
557
557
  'open': None,
558
- 'close': self.safe_string(ticker, 'lastTradePrice'),
558
+ 'close': self.safe_string(ticker, 'last'), # last indicative price per api docs(difference also seen here: https://github.com/ccxt/ccxt/actions/runs/14593899575/job/40935513901?pr=25767#step:11:456 )
559
559
  'previousClose': None,
560
560
  'change': self.safe_number(ticker, 'priceChange'),
561
561
  'percentage': self.safe_number(ticker, 'priceChangePercentage'),
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbase import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Account, Any, Balances, Conversion, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, MarketInterface
10
+ from ccxt.base.types import Account, Any, Balances, Conversion, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, MarketInterface
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -1474,7 +1474,18 @@ class coinbase(Exchange, ImplicitAPI):
1474
1474
  perpetualData = self.safe_list(perpetualFutures, 'products', [])
1475
1475
  for i in range(0, len(perpetualData)):
1476
1476
  result.append(self.parse_contract_market(perpetualData[i], perpetualFeeTier))
1477
- return result
1477
+ newMarkets = []
1478
+ for i in range(0, len(result)):
1479
+ market = result[i]
1480
+ info = self.safe_value(market, 'info', {})
1481
+ realMarketIds = self.safe_list(info, 'alias_to', [])
1482
+ length = len(realMarketIds)
1483
+ if length > 0:
1484
+ market['alias'] = realMarketIds[0]
1485
+ else:
1486
+ market['alias'] = None
1487
+ newMarkets.append(market)
1488
+ return newMarkets
1478
1489
 
1479
1490
  def parse_spot_market(self, market, feeTier) -> MarketInterface:
1480
1491
  #
@@ -1883,6 +1894,7 @@ class coinbase(Exchange, ImplicitAPI):
1883
1894
  'withdraw': None,
1884
1895
  'fee': None,
1885
1896
  'precision': None,
1897
+ 'networks': {},
1886
1898
  'limits': {
1887
1899
  'amount': {
1888
1900
  'min': self.safe_number(currency, 'min_size'),
@@ -2194,10 +2206,11 @@ class coinbase(Exchange, ImplicitAPI):
2194
2206
  ask = self.safe_number(asks[0], 'price')
2195
2207
  askVolume = self.safe_number(asks[0], 'size')
2196
2208
  marketId = self.safe_string(ticker, 'product_id')
2209
+ market = self.safe_market(marketId, market)
2197
2210
  last = self.safe_number(ticker, 'price')
2198
2211
  datetime = self.safe_string(ticker, 'time')
2199
2212
  return self.safe_ticker({
2200
- 'symbol': self.safe_symbol(marketId, market),
2213
+ 'symbol': market['symbol'],
2201
2214
  'timestamp': self.parse8601(datetime),
2202
2215
  'datetime': datetime,
2203
2216
  'bid': bid,
@@ -4410,7 +4423,7 @@ class coinbase(Exchange, ImplicitAPI):
4410
4423
  order = self.safe_dict(response, 'success_response', {})
4411
4424
  return self.parse_order(order)
4412
4425
 
4413
- async def fetch_positions(self, symbols: Strings = None, params={}):
4426
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
4414
4427
  """
4415
4428
  fetch all open positions
4416
4429
 
@@ -90,6 +90,7 @@ class coincatch(Exchange, ImplicitAPI):
90
90
  'fetchDepositAddress': True,
91
91
  'fetchDeposits': True,
92
92
  'fetchDepositsWithdrawals': False,
93
+ 'fetchDepositWithdrawFees': True,
93
94
  'fetchFundingHistory': False,
94
95
  'fetchFundingRate': True,
95
96
  'fetchFundingRateHistory': True,
@@ -724,6 +725,71 @@ class coincatch(Exchange, ImplicitAPI):
724
725
  self.options['currencyIdsListForParseMarket'] = currenciesIds
725
726
  return result
726
727
 
728
+ async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
729
+ """
730
+ fetch deposit and withdraw fees
731
+
732
+ https://coincatch.github.io/github.io/en/spot/#get-coin-list
733
+
734
+ :param str[] [codes]: list of unified currency codes
735
+ :param dict [params]: extra parameters specific to the exchange API endpoint
736
+ :returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
737
+ """
738
+ await self.load_markets()
739
+ response = await self.publicGetApiSpotV1PublicCurrencies(params)
740
+ data = self.safe_list(response, 'data', [])
741
+ return self.parse_deposit_withdraw_fees(data, codes, 'coinName')
742
+
743
+ def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
744
+ #
745
+ # {
746
+ # "coinId":"1",
747
+ # "coinName":"BTC",
748
+ # "transfer":"true",
749
+ # "chains":[
750
+ # {
751
+ # "chain":null,
752
+ # "needTag":"false",
753
+ # "withdrawable":"true",
754
+ # "rechargeAble":"true",
755
+ # "withdrawFee":"0.005",
756
+ # "depositConfirm":"1",
757
+ # "withdrawConfirm":"1",
758
+ # "minDepositAmount":"0.001",
759
+ # "minWithdrawAmount":"0.001",
760
+ # "browserUrl":"https://blockchair.com/bitcoin/testnet/transaction/"
761
+ # }
762
+ # ]
763
+ # }
764
+ #
765
+ chains = self.safe_list(fee, 'chains', [])
766
+ chainsLength = len(chains)
767
+ result: dict = {
768
+ 'info': fee,
769
+ 'withdraw': {
770
+ 'fee': None,
771
+ 'percentage': None,
772
+ },
773
+ 'deposit': {
774
+ 'fee': None,
775
+ 'percentage': None,
776
+ },
777
+ 'networks': {},
778
+ }
779
+ for i in range(0, chainsLength):
780
+ chain = chains[i]
781
+ networkId = self.safe_string(chain, 'chain')
782
+ currencyCode = self.safe_string(currency, 'code')
783
+ networkCode = self.network_id_to_code(networkId, currencyCode)
784
+ result['networks'][networkCode] = {
785
+ 'deposit': {'fee': None, 'percentage': None},
786
+ 'withdraw': {'fee': self.safe_number(chain, 'withdrawFee'), 'percentage': False},
787
+ }
788
+ if chainsLength == 1:
789
+ result['withdraw']['fee'] = self.safe_number(chain, 'withdrawFee')
790
+ result['withdraw']['percentage'] = False
791
+ return result
792
+
727
793
  async def fetch_markets(self, params={}) -> List[Market]:
728
794
  """
729
795
  retrieves data on all markets for the exchange
@@ -758,6 +758,7 @@ class coinex(Exchange, ImplicitAPI):
758
758
  },
759
759
  },
760
760
  'networks': {},
761
+ 'type': 'crypto',
761
762
  'info': coin,
762
763
  }
763
764
  for j in range(0, len(chains)):
@@ -3859,7 +3860,7 @@ class coinex(Exchange, ImplicitAPI):
3859
3860
  data = self.safe_list(response, 'data', [])
3860
3861
  return self.parse_trades(data, market, since, limit)
3861
3862
 
3862
- async def fetch_positions(self, symbols: Strings = None, params={}):
3863
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
3863
3864
  """
3864
3865
  fetch all open positions
3865
3866
 
@@ -489,6 +489,7 @@ class coinlist(Exchange, ImplicitAPI):
489
489
  'withdraw': {'min': minWithdrawal, 'max': None},
490
490
  },
491
491
  'networks': {},
492
+ 'type': 'crypto',
492
493
  }
493
494
  return result
494
495
 
@@ -330,6 +330,7 @@ class coinone(Exchange, ImplicitAPI):
330
330
  },
331
331
  },
332
332
  'networks': {},
333
+ 'type': 'crypto',
333
334
  }
334
335
  return result
335
336
 
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.cryptocom import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Any, Balances, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
9
+ from ccxt.base.types import Account, Any, Balances, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2789,7 +2789,7 @@ class cryptocom(Exchange, ImplicitAPI):
2789
2789
  data = self.safe_list(result, 'data', [])
2790
2790
  return self.parse_position(self.safe_dict(data, 0), market)
2791
2791
 
2792
- async def fetch_positions(self, symbols: Strings = None, params={}):
2792
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2793
2793
  """
2794
2794
  fetch all open positions
2795
2795
 
@@ -1495,7 +1495,7 @@ class defx(Exchange, ImplicitAPI):
1495
1495
  first = self.safe_dict(data, 0, {})
1496
1496
  return self.parse_position(first, market)
1497
1497
 
1498
- async def fetch_positions(self, symbols: Strings = None, params={}):
1498
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
1499
1499
  """
1500
1500
  fetch all open positions
1501
1501
 
@@ -357,6 +357,8 @@ class delta(Exchange, ImplicitAPI):
357
357
  base = self.safe_string(optionParts, 1)
358
358
  expiry = self.safe_string(optionParts, 3)
359
359
  optionType = self.safe_string(optionParts, 0)
360
+ if expiry is not None:
361
+ expiry = expiry[4:] + expiry[2:4] + expiry[0:2]
360
362
  settle = quote
361
363
  strike = self.safe_string(optionParts, 2)
362
364
  datetime = self.convert_expire_date(expiry)
@@ -567,6 +569,7 @@ class delta(Exchange, ImplicitAPI):
567
569
  },
568
570
  },
569
571
  'networks': {},
572
+ 'type': 'crypto',
570
573
  }
571
574
  return result
572
575
 
@@ -1660,7 +1663,7 @@ class delta(Exchange, ImplicitAPI):
1660
1663
  result = self.safe_dict(response, 'result', {})
1661
1664
  return self.parse_position(result, market)
1662
1665
 
1663
- async def fetch_positions(self, symbols: Strings = None, params={}):
1666
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
1664
1667
  """
1665
1668
  fetch all open positions
1666
1669
 
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.deribit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Any, Balances, Currencies, Currency, DepositAddress, Greeks, Int, Market, Num, Option, OptionChain, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFees, Transaction, MarketInterface, TransferEntry
9
+ from ccxt.base.types import Account, Any, Balances, Currencies, Currency, DepositAddress, Greeks, Int, Market, Num, Option, OptionChain, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFees, Transaction, MarketInterface, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -655,6 +655,7 @@ class deribit(Exchange, ImplicitAPI):
655
655
  'active': None,
656
656
  'deposit': None,
657
657
  'withdraw': None,
658
+ 'type': 'crypto',
658
659
  'fee': self.safe_number(currency, 'withdrawal_fee'),
659
660
  'precision': self.parse_number(self.parse_precision(self.safe_string(currency, 'fee_precision'))),
660
661
  'limits': {
@@ -2673,7 +2674,7 @@ class deribit(Exchange, ImplicitAPI):
2673
2674
  result = self.safe_dict(response, 'result')
2674
2675
  return self.parse_position(result)
2675
2676
 
2676
- async def fetch_positions(self, symbols: Strings = None, params={}):
2677
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2677
2678
  """
2678
2679
  fetch all open positions
2679
2680
 
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.derive import ImplicitAPI
8
8
  import asyncio
9
- from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderSide, OrderType, Str, Strings, Ticker, FundingRate, Trade, Transaction
9
+ from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, FundingRate, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2028,7 +2028,7 @@ class derive(Exchange, ImplicitAPI):
2028
2028
  trades = self.safe_list(result, 'trades', [])
2029
2029
  return self.parse_trades(trades, market, since, limit, params)
2030
2030
 
2031
- async def fetch_positions(self, symbols: Strings = None, params={}):
2031
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2032
2032
  """
2033
2033
  fetch all open positions
2034
2034
 
@@ -8,7 +8,7 @@ from ccxt.abstract.digifinex import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- from ccxt.base.types import Any, Balances, BorrowInterest, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, DepositAddress, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
11
+ from ccxt.base.types import Any, Balances, BorrowInterest, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, DepositAddress, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import AuthenticationError
@@ -3376,7 +3376,7 @@ class digifinex(Exchange, ImplicitAPI):
3376
3376
  'tierBased': None,
3377
3377
  }
3378
3378
 
3379
- async def fetch_positions(self, symbols: Strings = None, params={}):
3379
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
3380
3380
  """
3381
3381
  fetch all open positions
3382
3382
 
@@ -5724,7 +5724,7 @@ class gate(Exchange, ImplicitAPI):
5724
5724
  #
5725
5725
  return self.parse_position(response, market)
5726
5726
 
5727
- async def fetch_positions(self, symbols: Strings = None, params={}):
5727
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
5728
5728
  """
5729
5729
  fetch all open positions
5730
5730