ccxt 4.4.9__py2.py3-none-any.whl → 4.4.11__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 (85) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +1 -0
  3. ccxt/abstract/binancecoinm.py +1 -0
  4. ccxt/abstract/binanceus.py +1 -0
  5. ccxt/abstract/binanceusdm.py +1 -0
  6. ccxt/abstract/oceanex.py +5 -0
  7. ccxt/ascendex.py +5 -4
  8. ccxt/async_support/__init__.py +1 -1
  9. ccxt/async_support/ascendex.py +5 -4
  10. ccxt/async_support/base/exchange.py +1 -1
  11. ccxt/async_support/binance.py +9 -11
  12. ccxt/async_support/bingx.py +20 -21
  13. ccxt/async_support/bitfinex2.py +7 -16
  14. ccxt/async_support/bitget.py +9 -8
  15. ccxt/async_support/bitmart.py +4 -3
  16. ccxt/async_support/bitmex.py +7 -6
  17. ccxt/async_support/blofin.py +7 -16
  18. ccxt/async_support/bybit.py +18 -16
  19. ccxt/async_support/coinex.py +19 -5
  20. ccxt/async_support/delta.py +6 -5
  21. ccxt/async_support/deribit.py +4 -3
  22. ccxt/async_support/digifinex.py +18 -4
  23. ccxt/async_support/gate.py +32 -13
  24. ccxt/async_support/hashkey.py +6 -6
  25. ccxt/async_support/hitbtc.py +6 -5
  26. ccxt/async_support/htx.py +29 -6
  27. ccxt/async_support/hyperliquid.py +6 -1
  28. ccxt/async_support/kraken.py +35 -13
  29. ccxt/async_support/krakenfutures.py +6 -5
  30. ccxt/async_support/kucoinfutures.py +13 -2
  31. ccxt/async_support/mexc.py +14 -7
  32. ccxt/async_support/oceanex.py +80 -4
  33. ccxt/async_support/okx.py +19 -3
  34. ccxt/async_support/oxfun.py +7 -7
  35. ccxt/async_support/phemex.py +4 -3
  36. ccxt/async_support/poloniexfutures.py +13 -2
  37. ccxt/async_support/vertex.py +6 -5
  38. ccxt/async_support/whitebit.py +14 -13
  39. ccxt/async_support/woo.py +42 -21
  40. ccxt/async_support/woofipro.py +19 -6
  41. ccxt/async_support/xt.py +5 -3
  42. ccxt/base/exchange.py +1 -1
  43. ccxt/base/types.py +1 -0
  44. ccxt/binance.py +9 -11
  45. ccxt/bingx.py +20 -21
  46. ccxt/bitfinex2.py +7 -16
  47. ccxt/bitget.py +9 -8
  48. ccxt/bitmart.py +4 -3
  49. ccxt/bitmex.py +7 -6
  50. ccxt/blofin.py +7 -16
  51. ccxt/bybit.py +18 -16
  52. ccxt/coinex.py +19 -5
  53. ccxt/delta.py +6 -5
  54. ccxt/deribit.py +4 -3
  55. ccxt/digifinex.py +18 -4
  56. ccxt/gate.py +32 -13
  57. ccxt/hashkey.py +6 -6
  58. ccxt/hitbtc.py +6 -5
  59. ccxt/htx.py +29 -6
  60. ccxt/hyperliquid.py +6 -1
  61. ccxt/kraken.py +35 -13
  62. ccxt/krakenfutures.py +6 -5
  63. ccxt/kucoinfutures.py +13 -2
  64. ccxt/mexc.py +14 -7
  65. ccxt/oceanex.py +80 -4
  66. ccxt/okx.py +19 -3
  67. ccxt/oxfun.py +7 -7
  68. ccxt/phemex.py +4 -3
  69. ccxt/poloniexfutures.py +13 -2
  70. ccxt/pro/__init__.py +1 -1
  71. ccxt/pro/deribit.py +114 -2
  72. ccxt/pro/exmo.py +29 -2
  73. ccxt/pro/gate.py +1 -1
  74. ccxt/pro/okx.py +1 -1
  75. ccxt/vertex.py +6 -5
  76. ccxt/whitebit.py +14 -13
  77. ccxt/woo.py +42 -21
  78. ccxt/woofipro.py +19 -6
  79. ccxt/xt.py +5 -3
  80. ccxt-4.4.11.dist-info/METADATA +636 -0
  81. {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/RECORD +84 -84
  82. ccxt-4.4.9.dist-info/METADATA +0 -636
  83. {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/LICENSE.txt +0 -0
  84. {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/WHEEL +0 -0
  85. {ccxt-4.4.9.dist-info → ccxt-4.4.11.dist-info}/top_level.txt +0 -0
ccxt/whitebit.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.whitebit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2219,10 +2219,10 @@ class whitebit(Exchange, ImplicitAPI):
2219
2219
  'info': info,
2220
2220
  }
2221
2221
 
2222
- def fetch_funding_rate(self, symbol: str, params={}):
2222
+ def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
2223
2223
  """
2224
- :see: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
2225
2224
  fetch the current funding rate
2225
+ :see: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
2226
2226
  :param str symbol: unified market symbol
2227
2227
  :param dict [params]: extra parameters specific to the exchange API endpoint
2228
2228
  :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
@@ -2232,13 +2232,13 @@ class whitebit(Exchange, ImplicitAPI):
2232
2232
  response = self.fetch_funding_rates([symbol], params)
2233
2233
  return self.safe_value(response, symbol)
2234
2234
 
2235
- def fetch_funding_rates(self, symbols: Strings = None, params={}):
2235
+ def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
2236
2236
  """
2237
- :see: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
2238
2237
  fetch the funding rate for multiple markets
2238
+ :see: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
2239
2239
  :param str[]|None symbols: list of unified market symbols
2240
2240
  :param dict [params]: extra parameters specific to the exchange API endpoint
2241
- :returns dict: a dictionary of `funding rates structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexe by market symbols
2241
+ :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
2242
2242
  """
2243
2243
  self.load_markets()
2244
2244
  symbols = self.market_symbols(symbols)
@@ -2287,11 +2287,11 @@ class whitebit(Exchange, ImplicitAPI):
2287
2287
  # }
2288
2288
  # ]
2289
2289
  #
2290
- data = self.safe_value(response, 'result', [])
2290
+ data = self.safe_list(response, 'result', [])
2291
2291
  result = self.parse_funding_rates(data)
2292
2292
  return self.filter_by_array(result, 'symbol', symbols)
2293
2293
 
2294
- def parse_funding_rate(self, contract, market: Market = None):
2294
+ def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
2295
2295
  #
2296
2296
  # {
2297
2297
  # "ticker_id":"ADA_PERP",
@@ -2330,7 +2330,7 @@ class whitebit(Exchange, ImplicitAPI):
2330
2330
  indexPrice = self.safe_number(contract, 'indexPrice')
2331
2331
  interestRate = self.safe_number(contract, 'interestRate')
2332
2332
  fundingRate = self.safe_number(contract, 'funding_rate')
2333
- nextFundingTime = self.safe_integer(contract, 'next_funding_rate_timestamp')
2333
+ fundingTime = self.safe_integer(contract, 'next_funding_rate_timestamp')
2334
2334
  return {
2335
2335
  'info': contract,
2336
2336
  'symbol': symbol,
@@ -2340,14 +2340,15 @@ class whitebit(Exchange, ImplicitAPI):
2340
2340
  'timestamp': None,
2341
2341
  'datetime': None,
2342
2342
  'fundingRate': fundingRate,
2343
- 'fundingTimestamp': None,
2344
- 'fundingDatetime': self.iso8601(None),
2343
+ 'fundingTimestamp': fundingTime,
2344
+ 'fundingDatetime': self.iso8601(fundingTime),
2345
2345
  'nextFundingRate': None,
2346
- 'nextFundingTimestamp': nextFundingTime,
2347
- 'nextFundingDatetime': self.iso8601(nextFundingTime),
2346
+ 'nextFundingTimestamp': None,
2347
+ 'nextFundingDatetime': None,
2348
2348
  'previousFundingRate': None,
2349
2349
  'previousFundingTimestamp': None,
2350
2350
  'previousFundingDatetime': None,
2351
+ 'interval': None,
2351
2352
  }
2352
2353
 
2353
2354
  def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
ccxt/woo.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.woo import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Bool, Conversion, Currencies, Currency, Int, LedgerEntry, Leverage, MarginModification, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Bool, Conversion, Currencies, Currency, Int, LedgerEntry, Leverage, MarginModification, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from typing import Any
12
12
  from ccxt.base.errors import ExchangeError
@@ -2548,23 +2548,27 @@ class woo(Exchange, ImplicitAPI):
2548
2548
  result[resultLength - 1] = lastItem
2549
2549
  return self.parse_incomes(result, market, since, limit)
2550
2550
 
2551
- def parse_funding_rate(self, fundingRate, market: Market = None):
2552
- #
2553
- # {
2554
- # "symbol":"PERP_AAVE_USDT",
2555
- # "est_funding_rate":-0.00003447,
2556
- # "est_funding_rate_timestamp":1653633959001,
2557
- # "last_funding_rate":-0.00002094,
2558
- # "last_funding_rate_timestamp":1653631200000,
2559
- # "next_funding_time":1653634800000
2560
- # }
2551
+ def parse_funding_rate(self, fundingRate, market: Market = None) -> FundingRate:
2561
2552
  #
2553
+ # {
2554
+ # "success": True,
2555
+ # "timestamp": 1727427915529,
2556
+ # "symbol": "PERP_BTC_USDT",
2557
+ # "est_funding_rate": -0.00092719,
2558
+ # "est_funding_rate_timestamp": 1727427899060,
2559
+ # "last_funding_rate": -0.00092610,
2560
+ # "last_funding_rate_timestamp": 1727424000000,
2561
+ # "next_funding_time": 1727452800000,
2562
+ # "last_funding_rate_interval": 8,
2563
+ # "est_funding_rate_interval": 8
2564
+ # }
2562
2565
  #
2563
2566
  symbol = self.safe_string(fundingRate, 'symbol')
2564
2567
  market = self.market(symbol)
2565
2568
  nextFundingTimestamp = self.safe_integer(fundingRate, 'next_funding_time')
2566
2569
  estFundingRateTimestamp = self.safe_integer(fundingRate, 'est_funding_rate_timestamp')
2567
2570
  lastFundingRateTimestamp = self.safe_integer(fundingRate, 'last_funding_rate_timestamp')
2571
+ intervalString = self.safe_string(fundingRate, 'est_funding_rate_interval')
2568
2572
  return {
2569
2573
  'info': fundingRate,
2570
2574
  'symbol': market['symbol'],
@@ -2583,9 +2587,17 @@ class woo(Exchange, ImplicitAPI):
2583
2587
  'previousFundingRate': self.safe_number(fundingRate, 'last_funding_rate'),
2584
2588
  'previousFundingTimestamp': lastFundingRateTimestamp,
2585
2589
  'previousFundingDatetime': self.iso8601(lastFundingRateTimestamp),
2590
+ 'interval': intervalString + 'h',
2586
2591
  }
2587
2592
 
2588
- def fetch_funding_rate(self, symbol: str, params={}):
2593
+ def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
2594
+ """
2595
+ fetch the current funding rate
2596
+ :see: https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
2597
+ :param str symbol: unified market symbol
2598
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2599
+ :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
2600
+ """
2589
2601
  self.load_markets()
2590
2602
  market = self.market(symbol)
2591
2603
  request: dict = {
@@ -2594,19 +2606,28 @@ class woo(Exchange, ImplicitAPI):
2594
2606
  response = self.v1PublicGetFundingRateSymbol(self.extend(request, params))
2595
2607
  #
2596
2608
  # {
2597
- # "success":true,
2598
- # "timestamp":1653640572711,
2599
- # "symbol":"PERP_BTC_USDT",
2600
- # "est_funding_rate":0.00000738,
2601
- # "est_funding_rate_timestamp":1653640559003,
2602
- # "last_funding_rate":0.00000629,
2603
- # "last_funding_rate_timestamp":1653638400000,
2604
- # "next_funding_time":1653642000000
2609
+ # "success": True,
2610
+ # "timestamp": 1727428037877,
2611
+ # "symbol": "PERP_BTC_USDT",
2612
+ # "est_funding_rate": -0.00092674,
2613
+ # "est_funding_rate_timestamp": 1727428019064,
2614
+ # "last_funding_rate": -0.00092610,
2615
+ # "last_funding_rate_timestamp": 1727424000000,
2616
+ # "next_funding_time": 1727452800000,
2617
+ # "last_funding_rate_interval": 8,
2618
+ # "est_funding_rate_interval": 8
2605
2619
  # }
2606
2620
  #
2607
2621
  return self.parse_funding_rate(response, market)
2608
2622
 
2609
- def fetch_funding_rates(self, symbols: Strings = None, params={}):
2623
+ def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
2624
+ """
2625
+ fetch the funding rate for multiple markets
2626
+ :see: https://docs.woox.io/#get-predicted-funding-rate-for-all-markets-public
2627
+ :param str[]|None symbols: list of unified market symbols
2628
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2629
+ :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
2630
+ """
2610
2631
  self.load_markets()
2611
2632
  symbols = self.market_symbols(symbols)
2612
2633
  response = self.v1PublicGetFundingRates(params)
ccxt/woofipro.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.woofipro import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction
8
+ from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction
9
9
  from typing import List
10
10
  from typing import Any
11
11
  from ccxt.base.errors import ExchangeError
@@ -736,7 +736,7 @@ class woofipro(Exchange, ImplicitAPI):
736
736
  rows = self.safe_list(data, 'rows', [])
737
737
  return self.parse_trades(rows, market, since, limit)
738
738
 
739
- def parse_funding_rate(self, fundingRate, market: Market = None):
739
+ def parse_funding_rate(self, fundingRate, market: Market = None) -> FundingRate:
740
740
  #
741
741
  # {
742
742
  # "symbol":"PERP_AAVE_USDT",
@@ -748,12 +748,14 @@ class woofipro(Exchange, ImplicitAPI):
748
748
  # "sum_unitary_funding": 521.367
749
749
  # }
750
750
  #
751
- #
752
751
  symbol = self.safe_string(fundingRate, 'symbol')
753
752
  market = self.market(symbol)
754
753
  nextFundingTimestamp = self.safe_integer(fundingRate, 'next_funding_time')
755
754
  estFundingRateTimestamp = self.safe_integer(fundingRate, 'est_funding_rate_timestamp')
756
755
  lastFundingRateTimestamp = self.safe_integer(fundingRate, 'last_funding_rate_timestamp')
756
+ fundingTimeString = self.safe_string(fundingRate, 'last_funding_rate_timestamp')
757
+ nextFundingTimeString = self.safe_string(fundingRate, 'next_funding_time')
758
+ millisecondsInterval = Precise.string_sub(nextFundingTimeString, fundingTimeString)
757
759
  return {
758
760
  'info': fundingRate,
759
761
  'symbol': market['symbol'],
@@ -772,9 +774,20 @@ class woofipro(Exchange, ImplicitAPI):
772
774
  'previousFundingRate': self.safe_number(fundingRate, 'last_funding_rate'),
773
775
  'previousFundingTimestamp': lastFundingRateTimestamp,
774
776
  'previousFundingDatetime': self.iso8601(lastFundingRateTimestamp),
777
+ 'interval': self.parse_funding_interval(millisecondsInterval),
778
+ }
779
+
780
+ def parse_funding_interval(self, interval):
781
+ intervals: dict = {
782
+ '3600000': '1h',
783
+ '14400000': '4h',
784
+ '28800000': '8h',
785
+ '57600000': '16h',
786
+ '86400000': '24h',
775
787
  }
788
+ return self.safe_string(intervals, interval, interval)
776
789
 
777
- def fetch_funding_rate(self, symbol: str, params={}):
790
+ def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
778
791
  """
779
792
  fetch the current funding rate
780
793
  :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market
@@ -806,9 +819,9 @@ class woofipro(Exchange, ImplicitAPI):
806
819
  data = self.safe_dict(response, 'data', {})
807
820
  return self.parse_funding_rate(data, market)
808
821
 
809
- def fetch_funding_rates(self, symbols: Strings = None, params={}):
822
+ def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
810
823
  """
811
- fetch the current funding rates
824
+ fetch the current funding rate for multiple markets
812
825
  :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rates-for-all-markets
813
826
  :param str[] symbols: unified market symbols
814
827
  :param dict [params]: extra parameters specific to the exchange API endpoint
ccxt/xt.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.xt import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Currencies, Currency, Int, LedgerEntry, LeverageTier, MarginModification, Market, Num, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry
9
+ from ccxt.base.types import Currencies, Currency, Int, LedgerEntry, LeverageTier, MarginModification, Market, Num, Order, OrderSide, OrderType, Str, Tickers, FundingRate, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -4029,7 +4029,7 @@ class xt(Exchange, ImplicitAPI):
4029
4029
  sorted = self.sort_by(rates, 'timestamp')
4030
4030
  return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
4031
4031
 
4032
- def fetch_funding_rate(self, symbol: str, params={}):
4032
+ def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
4033
4033
  """
4034
4034
  fetch the current funding rate
4035
4035
  :see: https://doc.xt.com/#futures_quotesgetFundingRate
@@ -4067,7 +4067,7 @@ class xt(Exchange, ImplicitAPI):
4067
4067
  result = self.safe_value(response, 'result', {})
4068
4068
  return self.parse_funding_rate(result, market)
4069
4069
 
4070
- def parse_funding_rate(self, contract, market=None):
4070
+ def parse_funding_rate(self, contract, market=None) -> FundingRate:
4071
4071
  #
4072
4072
  # {
4073
4073
  # "symbol": "btc_usdt",
@@ -4079,6 +4079,7 @@ class xt(Exchange, ImplicitAPI):
4079
4079
  marketId = self.safe_string(contract, 'symbol')
4080
4080
  symbol = self.safe_symbol(marketId, market, '_', 'swap')
4081
4081
  timestamp = self.safe_integer(contract, 'nextCollectionTime')
4082
+ interval = self.safe_string(contract, 'collectionInternal')
4082
4083
  return {
4083
4084
  'info': contract,
4084
4085
  'symbol': symbol,
@@ -4097,6 +4098,7 @@ class xt(Exchange, ImplicitAPI):
4097
4098
  'previousFundingRate': None,
4098
4099
  'previousFundingTimestamp': None,
4099
4100
  'previousFundingDatetime': None,
4101
+ 'interval': interval + 'h',
4100
4102
  }
4101
4103
 
4102
4104
  def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):