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
ccxt/bitopro.py CHANGED
@@ -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
 
ccxt/bitrue.py CHANGED
@@ -833,7 +833,8 @@ class bitrue(Exchange, ImplicitAPI):
833
833
  'withdraw': withdraw,
834
834
  'networks': networks,
835
835
  'fee': self.parse_number(minWithdrawFeeString),
836
- # 'fees': fees,
836
+ 'fees': None,
837
+ 'type': 'crypto',
837
838
  'limits': {
838
839
  'withdraw': {
839
840
  'min': self.parse_number(minWithdrawString),
ccxt/bitso.py CHANGED
@@ -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",
ccxt/bitteam.py CHANGED
@@ -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
ccxt/bitvavo.py CHANGED
@@ -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
  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
  def cancel_order(self, id: str, symbol: Str = None, params={}):
ccxt/btcalpha.py CHANGED
@@ -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': {
ccxt/btcmarkets.py CHANGED
@@ -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",
ccxt/btcturk.py CHANGED
@@ -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
  # }
ccxt/bybit.py CHANGED
@@ -1040,9 +1040,6 @@ class bybit(Exchange, ImplicitAPI):
1040
1040
  'usePrivateInstrumentsInfo': False,
1041
1041
  'enableDemoTrading': False,
1042
1042
  'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
1043
- 'createOrder': {
1044
- 'method': 'privatePostV5OrderCreate', # 'privatePostV5PositionTradingStop'
1045
- },
1046
1043
  'enableUnifiedMargin': None,
1047
1044
  'enableUnifiedAccount': None,
1048
1045
  'unifiedMarginStatus': None,
@@ -2141,7 +2138,7 @@ class bybit(Exchange, ImplicitAPI):
2141
2138
  'quoteId': quoteId,
2142
2139
  'settleId': settleId,
2143
2140
  'type': 'option',
2144
- 'subType': 'linear',
2141
+ 'subType': None,
2145
2142
  'spot': False,
2146
2143
  'margin': False,
2147
2144
  'swap': False,
@@ -2149,8 +2146,8 @@ class bybit(Exchange, ImplicitAPI):
2149
2146
  'option': True,
2150
2147
  'active': isActive,
2151
2148
  'contract': True,
2152
- 'linear': True,
2153
- 'inverse': False,
2149
+ 'linear': None,
2150
+ 'inverse': None,
2154
2151
  'taker': self.safe_number(market, 'takerFee', self.parse_number('0.0006')),
2155
2152
  'maker': self.safe_number(market, 'makerFee', self.parse_number('0.0001')),
2156
2153
  'contractSize': self.parse_number('1'),
@@ -3774,12 +3771,21 @@ class bybit(Exchange, ImplicitAPI):
3774
3771
  parts = self.is_unified_enabled()
3775
3772
  enableUnifiedAccount = parts[1]
3776
3773
  trailingAmount = self.safe_string_2(params, 'trailingAmount', 'trailingStop')
3774
+ stopLossPrice = self.safe_string(params, 'stopLossPrice')
3775
+ takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
3777
3776
  isTrailingAmountOrder = trailingAmount is not None
3777
+ isStopLoss = stopLossPrice is not None
3778
+ isTakeProfit = takeProfitPrice is not None
3778
3779
  orderRequest = self.create_order_request(symbol, type, side, amount, price, params, enableUnifiedAccount)
3779
- options = self.safe_dict(self.options, 'createOrder', {})
3780
- defaultMethod = self.safe_string(options, 'method', 'privatePostV5OrderCreate')
3780
+ defaultMethod = None
3781
+ if isTrailingAmountOrder or isStopLoss or isTakeProfit:
3782
+ defaultMethod = 'privatePostV5PositionTradingStop'
3783
+ else:
3784
+ defaultMethod = 'privatePostV5OrderCreate'
3785
+ method = None
3786
+ method, params = self.handle_option_and_params(params, 'createOrder', 'method', defaultMethod)
3781
3787
  response = None
3782
- if isTrailingAmountOrder or (defaultMethod == 'privatePostV5PositionTradingStop'):
3788
+ if method == 'privatePostV5PositionTradingStop':
3783
3789
  response = self.privatePostV5PositionTradingStop(orderRequest)
3784
3790
  else:
3785
3791
  response = self.privatePostV5OrderCreate(orderRequest) # already extended inside createOrderRequest
@@ -3804,8 +3810,6 @@ class bybit(Exchange, ImplicitAPI):
3804
3810
  lowerCaseType = type.lower()
3805
3811
  if (price is None) and (lowerCaseType == 'limit'):
3806
3812
  raise ArgumentsRequired(self.id + ' createOrder requires a price argument for limit orders')
3807
- defaultMethod = None
3808
- defaultMethod, params = self.handle_option_and_params(params, 'createOrder', 'method', 'privatePostV5OrderCreate')
3809
3813
  request: dict = {
3810
3814
  'symbol': market['id'],
3811
3815
  # 'side': self.capitalize(side),
@@ -3849,7 +3853,14 @@ class bybit(Exchange, ImplicitAPI):
3849
3853
  isMarket = lowerCaseType == 'market'
3850
3854
  isLimit = lowerCaseType == 'limit'
3851
3855
  isBuy = side == 'buy'
3852
- isAlternativeEndpoint = defaultMethod == 'privatePostV5PositionTradingStop'
3856
+ defaultMethod = None
3857
+ if isTrailingAmountOrder or isStopLossTriggerOrder or isTakeProfitTriggerOrder:
3858
+ defaultMethod = 'privatePostV5PositionTradingStop'
3859
+ else:
3860
+ defaultMethod = 'privatePostV5OrderCreate'
3861
+ method = None
3862
+ method, params = self.handle_option_and_params(params, 'createOrder', 'method', defaultMethod)
3863
+ isAlternativeEndpoint = method == 'privatePostV5PositionTradingStop'
3853
3864
  amountString = self.get_amount(symbol, amount)
3854
3865
  priceString = self.get_price(symbol, self.number_to_string(price)) if (price is not None) else None
3855
3866
  if isTrailingAmountOrder or isAlternativeEndpoint:
@@ -3900,12 +3911,12 @@ class bybit(Exchange, ImplicitAPI):
3900
3911
  request['price'] = priceString
3901
3912
  if market['spot']:
3902
3913
  request['category'] = 'spot'
3914
+ elif market['option']:
3915
+ request['category'] = 'option'
3903
3916
  elif market['linear']:
3904
3917
  request['category'] = 'linear'
3905
3918
  elif market['inverse']:
3906
3919
  request['category'] = 'inverse'
3907
- elif market['option']:
3908
- request['category'] = 'option'
3909
3920
  cost = self.safe_string(params, 'cost')
3910
3921
  params = self.omit(params, 'cost')
3911
3922
  # if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
@@ -5650,7 +5661,8 @@ classic accounts only/ spot not supported* fetches information on an order made
5650
5661
  subType, params = self.handle_sub_type_and_params('fetchLedger', None, params)
5651
5662
  response = None
5652
5663
  if enableUnified[1]:
5653
- if subType == 'inverse':
5664
+ unifiedMarginStatus = self.safe_integer(self.options, 'unifiedMarginStatus', 5) # 3/4 uta 1.0, 5/6 uta 2.0
5665
+ if subType == 'inverse' and (unifiedMarginStatus < 5):
5654
5666
  response = self.privateGetV5AccountContractTransactionLog(self.extend(request, params))
5655
5667
  else:
5656
5668
  response = self.privateGetV5AccountTransactionLog(self.extend(request, params))
ccxt/cex.py CHANGED
@@ -554,7 +554,7 @@ class cex(Exchange, ImplicitAPI):
554
554
  'askVolume': None,
555
555
  'vwap': None,
556
556
  'open': None,
557
- 'close': self.safe_string(ticker, 'lastTradePrice'),
557
+ '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 )
558
558
  'previousClose': None,
559
559
  'change': self.safe_number(ticker, 'priceChange'),
560
560
  'percentage': self.safe_number(ticker, 'priceChangePercentage'),
ccxt/coinbase.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbase import ImplicitAPI
8
8
  import hashlib
9
- 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
9
+ 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
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -1473,7 +1473,18 @@ class coinbase(Exchange, ImplicitAPI):
1473
1473
  perpetualData = self.safe_list(perpetualFutures, 'products', [])
1474
1474
  for i in range(0, len(perpetualData)):
1475
1475
  result.append(self.parse_contract_market(perpetualData[i], perpetualFeeTier))
1476
- return result
1476
+ newMarkets = []
1477
+ for i in range(0, len(result)):
1478
+ market = result[i]
1479
+ info = self.safe_value(market, 'info', {})
1480
+ realMarketIds = self.safe_list(info, 'alias_to', [])
1481
+ length = len(realMarketIds)
1482
+ if length > 0:
1483
+ market['alias'] = realMarketIds[0]
1484
+ else:
1485
+ market['alias'] = None
1486
+ newMarkets.append(market)
1487
+ return newMarkets
1477
1488
 
1478
1489
  def parse_spot_market(self, market, feeTier) -> MarketInterface:
1479
1490
  #
@@ -1882,6 +1893,7 @@ class coinbase(Exchange, ImplicitAPI):
1882
1893
  'withdraw': None,
1883
1894
  'fee': None,
1884
1895
  'precision': None,
1896
+ 'networks': {},
1885
1897
  'limits': {
1886
1898
  'amount': {
1887
1899
  'min': self.safe_number(currency, 'min_size'),
@@ -2193,10 +2205,11 @@ class coinbase(Exchange, ImplicitAPI):
2193
2205
  ask = self.safe_number(asks[0], 'price')
2194
2206
  askVolume = self.safe_number(asks[0], 'size')
2195
2207
  marketId = self.safe_string(ticker, 'product_id')
2208
+ market = self.safe_market(marketId, market)
2196
2209
  last = self.safe_number(ticker, 'price')
2197
2210
  datetime = self.safe_string(ticker, 'time')
2198
2211
  return self.safe_ticker({
2199
- 'symbol': self.safe_symbol(marketId, market),
2212
+ 'symbol': market['symbol'],
2200
2213
  'timestamp': self.parse8601(datetime),
2201
2214
  'datetime': datetime,
2202
2215
  'bid': bid,
@@ -4409,7 +4422,7 @@ class coinbase(Exchange, ImplicitAPI):
4409
4422
  order = self.safe_dict(response, 'success_response', {})
4410
4423
  return self.parse_order(order)
4411
4424
 
4412
- def fetch_positions(self, symbols: Strings = None, params={}):
4425
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
4413
4426
  """
4414
4427
  fetch all open positions
4415
4428
 
ccxt/coincatch.py CHANGED
@@ -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
+ 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
+ self.load_markets()
739
+ response = 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
  def fetch_markets(self, params={}) -> List[Market]:
728
794
  """
729
795
  retrieves data on all markets for the exchange
ccxt/coinex.py CHANGED
@@ -757,6 +757,7 @@ class coinex(Exchange, ImplicitAPI):
757
757
  },
758
758
  },
759
759
  'networks': {},
760
+ 'type': 'crypto',
760
761
  'info': coin,
761
762
  }
762
763
  for j in range(0, len(chains)):
@@ -3858,7 +3859,7 @@ class coinex(Exchange, ImplicitAPI):
3858
3859
  data = self.safe_list(response, 'data', [])
3859
3860
  return self.parse_trades(data, market, since, limit)
3860
3861
 
3861
- def fetch_positions(self, symbols: Strings = None, params={}):
3862
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
3862
3863
  """
3863
3864
  fetch all open positions
3864
3865
 
ccxt/coinlist.py CHANGED
@@ -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
 
ccxt/coinone.py CHANGED
@@ -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
 
ccxt/cryptocom.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.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
- def fetch_positions(self, symbols: Strings = None, params={}):
2792
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2793
2793
  """
2794
2794
  fetch all open positions
2795
2795
 
ccxt/defx.py CHANGED
@@ -1494,7 +1494,7 @@ class defx(Exchange, ImplicitAPI):
1494
1494
  first = self.safe_dict(data, 0, {})
1495
1495
  return self.parse_position(first, market)
1496
1496
 
1497
- def fetch_positions(self, symbols: Strings = None, params={}):
1497
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
1498
1498
  """
1499
1499
  fetch all open positions
1500
1500
 
ccxt/delta.py CHANGED
@@ -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
- def fetch_positions(self, symbols: Strings = None, params={}):
1666
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
1664
1667
  """
1665
1668
  fetch all open positions
1666
1669
 
ccxt/deribit.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.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
- def fetch_positions(self, symbols: Strings = None, params={}):
2677
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2677
2678
  """
2678
2679
  fetch all open positions
2679
2680
 
ccxt/derive.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.derive import ImplicitAPI
8
- from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderSide, OrderType, Str, Strings, Ticker, FundingRate, Trade, Transaction
8
+ from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, FundingRate, Trade, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import AuthenticationError
@@ -2027,7 +2027,7 @@ class derive(Exchange, ImplicitAPI):
2027
2027
  trades = self.safe_list(result, 'trades', [])
2028
2028
  return self.parse_trades(trades, market, since, limit, params)
2029
2029
 
2030
- def fetch_positions(self, symbols: Strings = None, params={}):
2030
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
2031
2031
  """
2032
2032
  fetch all open positions
2033
2033
 
ccxt/digifinex.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.digifinex import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- 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
10
+ 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
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -3375,7 +3375,7 @@ class digifinex(Exchange, ImplicitAPI):
3375
3375
  'tierBased': None,
3376
3376
  }
3377
3377
 
3378
- def fetch_positions(self, symbols: Strings = None, params={}):
3378
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
3379
3379
  """
3380
3380
  fetch all open positions
3381
3381
 
ccxt/gate.py CHANGED
@@ -5723,7 +5723,7 @@ class gate(Exchange, ImplicitAPI):
5723
5723
  #
5724
5724
  return self.parse_position(response, market)
5725
5725
 
5726
- def fetch_positions(self, symbols: Strings = None, params={}):
5726
+ def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
5727
5727
  """
5728
5728
  fetch all open positions
5729
5729