ccxt 4.3.84__py2.py3-none-any.whl → 4.3.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 (51) hide show
  1. ccxt/__init__.py +4 -1
  2. ccxt/abstract/cryptocom.py +2 -0
  3. ccxt/abstract/hashkey.py +67 -0
  4. ccxt/abstract/kucoinfutures.py +2 -0
  5. ccxt/async_support/__init__.py +4 -1
  6. ccxt/async_support/base/exchange.py +2 -2
  7. ccxt/async_support/binance.py +4 -2
  8. ccxt/async_support/bitfinex.py +2 -2
  9. ccxt/async_support/bitmex.py +2 -0
  10. ccxt/async_support/bybit.py +16 -14
  11. ccxt/async_support/cryptocom.py +113 -3
  12. ccxt/async_support/hashkey.py +4062 -0
  13. ccxt/async_support/hyperliquid.py +80 -62
  14. ccxt/async_support/indodax.py +29 -8
  15. ccxt/async_support/kraken.py +28 -1
  16. ccxt/async_support/krakenfutures.py +10 -9
  17. ccxt/async_support/kucoinfutures.py +5 -0
  18. ccxt/async_support/mexc.py +2 -2
  19. ccxt/base/errors.py +6 -0
  20. ccxt/base/exchange.py +2 -2
  21. ccxt/binance.py +4 -2
  22. ccxt/bitfinex.py +2 -2
  23. ccxt/bitmex.py +2 -0
  24. ccxt/bybit.py +16 -14
  25. ccxt/cryptocom.py +113 -3
  26. ccxt/hashkey.py +4062 -0
  27. ccxt/hyperliquid.py +80 -62
  28. ccxt/indodax.py +29 -8
  29. ccxt/kraken.py +28 -1
  30. ccxt/krakenfutures.py +10 -9
  31. ccxt/kucoinfutures.py +5 -0
  32. ccxt/mexc.py +2 -2
  33. ccxt/pro/__init__.py +3 -1
  34. ccxt/pro/ascendex.py +41 -5
  35. ccxt/pro/binance.py +1 -1
  36. ccxt/pro/bingx.py +13 -12
  37. ccxt/pro/bitget.py +104 -4
  38. ccxt/pro/hashkey.py +783 -0
  39. ccxt/pro/hyperliquid.py +118 -1
  40. ccxt/pro/mexc.py +13 -7
  41. ccxt/pro/okx.py +21 -3
  42. ccxt/pro/woo.py +1 -0
  43. ccxt/pro/woofipro.py +1 -0
  44. ccxt/pro/xt.py +1 -0
  45. ccxt/test/tests_async.py +13 -30
  46. ccxt/test/tests_sync.py +13 -30
  47. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/METADATA +8 -6
  48. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/RECORD +51 -47
  49. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/LICENSE.txt +0 -0
  50. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/WHEEL +0 -0
  51. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/top_level.txt +0 -0
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, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, 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
@@ -109,8 +109,8 @@ class cryptocom(Exchange, ImplicitAPI):
109
109
  'fetchTickers': True,
110
110
  'fetchTime': False,
111
111
  'fetchTrades': True,
112
- 'fetchTradingFee': False,
113
- 'fetchTradingFees': False,
112
+ 'fetchTradingFee': True,
113
+ 'fetchTradingFees': True,
114
114
  'fetchTransactionFees': False,
115
115
  'fetchTransactions': False,
116
116
  'fetchTransfers': False,
@@ -211,6 +211,8 @@ class cryptocom(Exchange, ImplicitAPI):
211
211
  'private/get-accounts': 10 / 3,
212
212
  'private/get-withdrawal-history': 10 / 3,
213
213
  'private/get-deposit-history': 10 / 3,
214
+ 'private/get-fee-rate': 2,
215
+ 'private/get-instrument-fee-rate': 2,
214
216
  'private/staking/stake': 2,
215
217
  'private/staking/unstake': 2,
216
218
  'private/staking/get-staking-position': 2,
@@ -2806,6 +2808,114 @@ class cryptocom(Exchange, ImplicitAPI):
2806
2808
  result = self.safe_dict(response, 'result')
2807
2809
  return self.parse_order(result, market)
2808
2810
 
2811
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
2812
+ """
2813
+ fetch the trading fees for a market
2814
+ :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-instrument-fee-rate
2815
+ :param str symbol: unified market symbol
2816
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2817
+ :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
2818
+ """
2819
+ self.load_markets()
2820
+ market = self.market(symbol)
2821
+ request: dict = {
2822
+ 'instrument_name': market['id'],
2823
+ }
2824
+ response = self.v1PrivatePostPrivateGetInstrumentFeeRate(self.extend(request, params))
2825
+ #
2826
+ # {
2827
+ # "id": 1,
2828
+ # "code": 0,
2829
+ # "method": "private/staking/unstake",
2830
+ # "result": {
2831
+ # "staking_id": "1",
2832
+ # "instrument_name": "SOL.staked",
2833
+ # "status": "NEW",
2834
+ # "quantity": "1",
2835
+ # "underlying_inst_name": "SOL",
2836
+ # "reason": "NO_ERROR"
2837
+ # }
2838
+ # }
2839
+ #
2840
+ data = self.safe_dict(response, 'result', {})
2841
+ return self.parse_trading_fee(data, market)
2842
+
2843
+ def fetch_trading_fees(self, params={}) -> TradingFees:
2844
+ """
2845
+ :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-fee-rate
2846
+ fetch the trading fees for multiple markets
2847
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2848
+ :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
2849
+ """
2850
+ self.load_markets()
2851
+ response = self.v1PrivatePostPrivateGetFeeRate(params)
2852
+ #
2853
+ # {
2854
+ # "id": 1,
2855
+ # "method": "/private/get-fee-rate",
2856
+ # "code": 0,
2857
+ # "result": {
2858
+ # "spot_tier": "3",
2859
+ # "deriv_tier": "3",
2860
+ # "effective_spot_maker_rate_bps": "6.5",
2861
+ # "effective_spot_taker_rate_bps": "6.9",
2862
+ # "effective_deriv_maker_rate_bps": "1.1",
2863
+ # "effective_deriv_taker_rate_bps": "3"
2864
+ # }
2865
+ # }
2866
+ #
2867
+ result = self.safe_dict(response, 'result', {})
2868
+ return self.parse_trading_fees(result)
2869
+
2870
+ def parse_trading_fees(self, response):
2871
+ #
2872
+ # {
2873
+ # "spot_tier": "3",
2874
+ # "deriv_tier": "3",
2875
+ # "effective_spot_maker_rate_bps": "6.5",
2876
+ # "effective_spot_taker_rate_bps": "6.9",
2877
+ # "effective_deriv_maker_rate_bps": "1.1",
2878
+ # "effective_deriv_taker_rate_bps": "3"
2879
+ # }
2880
+ #
2881
+ result: dict = {}
2882
+ result['info'] = response
2883
+ for i in range(0, len(self.symbols)):
2884
+ symbol = self.symbols[i]
2885
+ market = self.market(symbol)
2886
+ isSwap = market['swap']
2887
+ takerFeeKey = 'effective_deriv_taker_rate_bps' if isSwap else 'effective_spot_taker_rate_bps'
2888
+ makerFeeKey = 'effective_deriv_maker_rate_bps' if isSwap else 'effective_spot_maker_rate_bps'
2889
+ tradingFee = {
2890
+ 'info': response,
2891
+ 'symbol': symbol,
2892
+ 'maker': self.parse_number(Precise.string_div(self.safe_string(response, makerFeeKey), '10000')),
2893
+ 'taker': self.parse_number(Precise.string_div(self.safe_string(response, takerFeeKey), '10000')),
2894
+ 'percentage': None,
2895
+ 'tierBased': None,
2896
+ }
2897
+ result[symbol] = tradingFee
2898
+ return result
2899
+
2900
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
2901
+ #
2902
+ # {
2903
+ # "instrument_name": "BTC_USD",
2904
+ # "effective_maker_rate_bps": "6.5",
2905
+ # "effective_taker_rate_bps": "6.9"
2906
+ # }
2907
+ #
2908
+ marketId = self.safe_string(fee, 'instrument_name')
2909
+ symbol = self.safe_symbol(marketId, market)
2910
+ return {
2911
+ 'info': fee,
2912
+ 'symbol': symbol,
2913
+ 'maker': self.parse_number(Precise.string_div(self.safe_string(fee, 'effective_maker_rate_bps'), '10000')),
2914
+ 'taker': self.parse_number(Precise.string_div(self.safe_string(fee, 'effective_taker_rate_bps'), '10000')),
2915
+ 'percentage': None,
2916
+ 'tierBased': None,
2917
+ }
2918
+
2809
2919
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
2810
2920
  type = self.safe_string(api, 0)
2811
2921
  access = self.safe_string(api, 1)