ccxt 4.3.68__py2.py3-none-any.whl → 4.3.69__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 (57) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/async_support/__init__.py +1 -1
  3. ccxt/async_support/base/exchange.py +1 -1
  4. ccxt/async_support/binance.py +2 -2
  5. ccxt/async_support/bingx.py +129 -73
  6. ccxt/async_support/bitget.py +2 -2
  7. ccxt/async_support/bitmart.py +2 -2
  8. ccxt/async_support/bitrue.py +2 -2
  9. ccxt/async_support/btcbox.py +1 -1
  10. ccxt/async_support/bybit.py +2 -2
  11. ccxt/async_support/coinbaseinternational.py +72 -1
  12. ccxt/async_support/coinex.py +2 -2
  13. ccxt/async_support/coinlist.py +2 -2
  14. ccxt/async_support/deribit.py +2 -2
  15. ccxt/async_support/digifinex.py +2 -2
  16. ccxt/async_support/hyperliquid.py +0 -2
  17. ccxt/async_support/kucoin.py +11 -5
  18. ccxt/async_support/latoken.py +2 -2
  19. ccxt/async_support/mexc.py +2 -2
  20. ccxt/async_support/okx.py +2 -2
  21. ccxt/async_support/oxfun.py +1 -1
  22. ccxt/async_support/phemex.py +2 -2
  23. ccxt/async_support/poloniex.py +33 -33
  24. ccxt/async_support/poloniexfutures.py +26 -26
  25. ccxt/async_support/woo.py +2 -2
  26. ccxt/base/exchange.py +329 -117
  27. ccxt/base/types.py +21 -3
  28. ccxt/binance.py +2 -2
  29. ccxt/bingx.py +129 -73
  30. ccxt/bitget.py +2 -2
  31. ccxt/bitmart.py +2 -2
  32. ccxt/bitrue.py +2 -2
  33. ccxt/btcbox.py +1 -1
  34. ccxt/bybit.py +2 -2
  35. ccxt/coinbaseinternational.py +72 -1
  36. ccxt/coinex.py +2 -2
  37. ccxt/coinlist.py +2 -2
  38. ccxt/deribit.py +2 -2
  39. ccxt/digifinex.py +2 -2
  40. ccxt/hyperliquid.py +0 -2
  41. ccxt/kucoin.py +11 -5
  42. ccxt/latoken.py +2 -2
  43. ccxt/mexc.py +2 -2
  44. ccxt/okx.py +2 -2
  45. ccxt/oxfun.py +1 -1
  46. ccxt/phemex.py +2 -2
  47. ccxt/poloniex.py +33 -33
  48. ccxt/poloniexfutures.py +26 -26
  49. ccxt/pro/__init__.py +1 -1
  50. ccxt/pro/poloniex.py +13 -13
  51. ccxt/pro/poloniexfutures.py +5 -5
  52. ccxt/woo.py +2 -2
  53. {ccxt-4.3.68.dist-info → ccxt-4.3.69.dist-info}/METADATA +6 -6
  54. {ccxt-4.3.68.dist-info → ccxt-4.3.69.dist-info}/RECORD +57 -57
  55. {ccxt-4.3.68.dist-info → ccxt-4.3.69.dist-info}/LICENSE.txt +0 -0
  56. {ccxt-4.3.68.dist-info → ccxt-4.3.69.dist-info}/WHEEL +0 -0
  57. {ccxt-4.3.68.dist-info → ccxt-4.3.69.dist-info}/top_level.txt +0 -0
ccxt/bingx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bingx import ImplicitAPI
8
8
  import hashlib
9
9
  import numbers
10
- from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
10
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, 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
@@ -1110,7 +1110,27 @@ class bingx(Exchange, ImplicitAPI):
1110
1110
  # "s": "BTC-USDT"
1111
1111
  # }
1112
1112
  #
1113
- time = self.safe_integer_n(trade, ['time', 'filledTm', 'T'])
1113
+ # inverse swap fetchMyTrades
1114
+ #
1115
+ # {
1116
+ # "orderId": "1817441228670648320",
1117
+ # "symbol": "SOL-USD",
1118
+ # "type": "MARKET",
1119
+ # "side": "BUY",
1120
+ # "positionSide": "LONG",
1121
+ # "tradeId": "97244554",
1122
+ # "volume": "2",
1123
+ # "tradePrice": "182.652",
1124
+ # "amount": "20.00000000",
1125
+ # "realizedPnl": "0.00000000",
1126
+ # "commission": "-0.00005475",
1127
+ # "currency": "SOL",
1128
+ # "buyer": True,
1129
+ # "maker": False,
1130
+ # "tradeTime": 1722146730000
1131
+ # }
1132
+ #
1133
+ time = self.safe_integer_n(trade, ['time', 'filledTm', 'T', 'tradeTime'])
1114
1134
  datetimeId = self.safe_string(trade, 'filledTm')
1115
1135
  if datetimeId is not None:
1116
1136
  time = self.parse8601(datetimeId)
@@ -1121,8 +1141,8 @@ class bingx(Exchange, ImplicitAPI):
1121
1141
  currencyId = self.safe_string_n(trade, ['currency', 'N', 'commissionAsset'])
1122
1142
  currencyCode = self.safe_currency_code(currencyId)
1123
1143
  m = self.safe_bool(trade, 'm')
1124
- marketId = self.safe_string(trade, 's')
1125
- isBuyerMaker = self.safe_bool_2(trade, 'buyerMaker', 'isBuyerMaker')
1144
+ marketId = self.safe_string_2(trade, 's', 'symbol')
1145
+ isBuyerMaker = self.safe_bool_n(trade, ['buyerMaker', 'isBuyerMaker', 'maker'])
1126
1146
  takeOrMaker = None
1127
1147
  if (isBuyerMaker is not None) or (m is not None):
1128
1148
  takeOrMaker = 'maker' if (isBuyerMaker or m) else 'taker'
@@ -1153,7 +1173,7 @@ class bingx(Exchange, ImplicitAPI):
1153
1173
  'type': self.safe_string_lower(trade, 'o'),
1154
1174
  'side': self.parse_order_side(side),
1155
1175
  'takerOrMaker': takeOrMaker,
1156
- 'price': self.safe_string_2(trade, 'price', 'p'),
1176
+ 'price': self.safe_string_n(trade, ['price', 'p', 'tradePrice']),
1157
1177
  'amount': amount,
1158
1178
  'cost': cost,
1159
1179
  'fee': {
@@ -3984,7 +4004,7 @@ class bingx(Exchange, ImplicitAPI):
3984
4004
  'status': None,
3985
4005
  }
3986
4006
 
3987
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
4007
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
3988
4008
  """
3989
4009
  fetch a history of internal transfers made on an account
3990
4010
  :see: https://bingx-api.github.io/docs/#/spot/account-api.html#Query%20User%20Universal%20Transfer%20History%20(USER_DATA)
@@ -4596,93 +4616,129 @@ class bingx(Exchange, ImplicitAPI):
4596
4616
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4597
4617
  """
4598
4618
  fetch all trades made by the user
4599
- :see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20History
4600
- :see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20historical%20transaction%20orders
4619
+ :see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20transaction%20details
4620
+ :see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20historical%20transaction%20orders
4621
+ :see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order%20Trade%20Detail
4601
4622
  :param str [symbol]: unified market symbol
4602
4623
  :param int [since]: the earliest time in ms to fetch trades for
4603
4624
  :param int [limit]: the maximum number of trades structures to retrieve
4604
4625
  :param dict [params]: extra parameters specific to the exchange API endpoint
4605
4626
  :param int [params.until]: timestamp in ms for the ending date filter, default is None
4606
4627
  :param str params['trandingUnit']: COIN(directly represent assets such and ETH) or CONT(represents the number of contract sheets)
4628
+ :param str params['orderId']: the order id required for inverse swap
4607
4629
  :returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
4608
4630
  """
4609
4631
  if symbol is None:
4610
4632
  raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
4611
4633
  self.load_markets()
4612
4634
  market = self.market(symbol)
4613
- now = self.milliseconds()
4614
- response = None
4615
- request: dict = {
4616
- 'symbol': market['id'],
4617
- }
4618
- if since is not None:
4619
- startTimeReq = 'startTime' if market['spot'] else 'startTs'
4620
- request[startTimeReq] = since
4621
- elif market['swap']:
4622
- request['startTs'] = now - 7776000000 # 90 days
4623
- until = self.safe_integer(params, 'until')
4624
- params = self.omit(params, 'until')
4625
- if until is not None:
4626
- endTimeReq = 'endTime' if market['spot'] else 'endTs'
4627
- request[endTimeReq] = until
4628
- elif market['swap']:
4629
- request['endTs'] = now
4635
+ request: dict = {}
4630
4636
  fills = None
4631
- if market['spot']:
4632
- response = self.spotV1PrivateGetTradeMyTrades(self.extend(request, params))
4633
- data = self.safe_dict(response, 'data', {})
4634
- fills = self.safe_list(data, 'fills', [])
4637
+ response = None
4638
+ subType = None
4639
+ subType, params = self.handle_sub_type_and_params('fetchMyTrades', market, params)
4640
+ if subType == 'inverse':
4641
+ orderId = self.safe_string(params, 'orderId')
4642
+ if orderId is None:
4643
+ raise ArgumentsRequired(self.id + ' fetchMyTrades() requires an orderId argument for inverse swap trades')
4644
+ response = self.cswapV1PrivateGetTradeAllFillOrders(self.extend(request, params))
4645
+ fills = self.safe_list(response, 'data', [])
4635
4646
  #
4636
4647
  # {
4637
4648
  # "code": 0,
4638
4649
  # "msg": "",
4639
- # "debugMsg": "",
4640
- # "data": {
4641
- # "fills": [
4642
- # {
4643
- # "symbol": "LTC-USDT",
4644
- # "id": 36237072,
4645
- # "orderId": 1674069326895775744,
4646
- # "price": "85.891",
4647
- # "qty": "0.0582",
4648
- # "quoteQty": "4.9988562000000005",
4649
- # "commission": -0.00005820000000000001,
4650
- # "commissionAsset": "LTC",
4651
- # "time": 1687964205000,
4652
- # "isBuyer": True,
4653
- # "isMaker": False
4654
- # }
4655
- # ]
4656
- # }
4650
+ # "timestamp": 1722147756019,
4651
+ # "data": [
4652
+ # {
4653
+ # "orderId": "1817441228670648320",
4654
+ # "symbol": "SOL-USD",
4655
+ # "type": "MARKET",
4656
+ # "side": "BUY",
4657
+ # "positionSide": "LONG",
4658
+ # "tradeId": "97244554",
4659
+ # "volume": "2",
4660
+ # "tradePrice": "182.652",
4661
+ # "amount": "20.00000000",
4662
+ # "realizedPnl": "0.00000000",
4663
+ # "commission": "-0.00005475",
4664
+ # "currency": "SOL",
4665
+ # "buyer": True,
4666
+ # "maker": False,
4667
+ # "tradeTime": 1722146730000
4668
+ # }
4669
+ # ]
4657
4670
  # }
4658
4671
  #
4659
4672
  else:
4660
- tradingUnit = self.safe_string_upper(params, 'tradingUnit', 'CONT')
4661
- params = self.omit(params, 'tradingUnit')
4662
- request['tradingUnit'] = tradingUnit
4663
- response = self.swapV2PrivateGetTradeAllFillOrders(self.extend(request, params))
4664
- data = self.safe_dict(response, 'data', {})
4665
- fills = self.safe_list(data, 'fill_orders', [])
4666
- #
4667
- # {
4668
- # "code": "0",
4669
- # "msg": '',
4670
- # "data": {fill_orders: [
4671
- # {
4672
- # "volume": "0.1",
4673
- # "price": "106.75",
4674
- # "amount": "10.6750",
4675
- # "commission": "-0.0053",
4676
- # "currency": "USDT",
4677
- # "orderId": "1676213270274379776",
4678
- # "liquidatedPrice": "0.00",
4679
- # "liquidatedMarginRatio": "0.00",
4680
- # "filledTime": "2023-07-04T20:56:01.000+0800"
4681
- # }
4682
- # ]
4683
- # }
4684
- # }
4685
- #
4673
+ request['symbol'] = market['id']
4674
+ now = self.milliseconds()
4675
+ if since is not None:
4676
+ startTimeReq = 'startTime' if market['spot'] else 'startTs'
4677
+ request[startTimeReq] = since
4678
+ elif market['swap']:
4679
+ request['startTs'] = now - 7776000000 # 90 days
4680
+ until = self.safe_integer(params, 'until')
4681
+ params = self.omit(params, 'until')
4682
+ if until is not None:
4683
+ endTimeReq = 'endTime' if market['spot'] else 'endTs'
4684
+ request[endTimeReq] = until
4685
+ elif market['swap']:
4686
+ request['endTs'] = now
4687
+ if market['spot']:
4688
+ response = self.spotV1PrivateGetTradeMyTrades(self.extend(request, params))
4689
+ data = self.safe_dict(response, 'data', {})
4690
+ fills = self.safe_list(data, 'fills', [])
4691
+ #
4692
+ # {
4693
+ # "code": 0,
4694
+ # "msg": "",
4695
+ # "debugMsg": "",
4696
+ # "data": {
4697
+ # "fills": [
4698
+ # {
4699
+ # "symbol": "LTC-USDT",
4700
+ # "id": 36237072,
4701
+ # "orderId": 1674069326895775744,
4702
+ # "price": "85.891",
4703
+ # "qty": "0.0582",
4704
+ # "quoteQty": "4.9988562000000005",
4705
+ # "commission": -0.00005820000000000001,
4706
+ # "commissionAsset": "LTC",
4707
+ # "time": 1687964205000,
4708
+ # "isBuyer": True,
4709
+ # "isMaker": False
4710
+ # }
4711
+ # ]
4712
+ # }
4713
+ # }
4714
+ #
4715
+ else:
4716
+ tradingUnit = self.safe_string_upper(params, 'tradingUnit', 'CONT')
4717
+ params = self.omit(params, 'tradingUnit')
4718
+ request['tradingUnit'] = tradingUnit
4719
+ response = self.swapV2PrivateGetTradeAllFillOrders(self.extend(request, params))
4720
+ data = self.safe_dict(response, 'data', {})
4721
+ fills = self.safe_list(data, 'fill_orders', [])
4722
+ #
4723
+ # {
4724
+ # "code": "0",
4725
+ # "msg": '',
4726
+ # "data": {fill_orders: [
4727
+ # {
4728
+ # "volume": "0.1",
4729
+ # "price": "106.75",
4730
+ # "amount": "10.6750",
4731
+ # "commission": "-0.0053",
4732
+ # "currency": "USDT",
4733
+ # "orderId": "1676213270274379776",
4734
+ # "liquidatedPrice": "0.00",
4735
+ # "liquidatedMarginRatio": "0.00",
4736
+ # "filledTime": "2023-07-04T20:56:01.000+0800"
4737
+ # }
4738
+ # ]
4739
+ # }
4740
+ # }
4741
+ #
4686
4742
  return self.parse_trades(fills, market, since, limit, params)
4687
4743
 
4688
4744
  def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
ccxt/bitget.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitget import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, FundingHistory, Int, IsolatedBorrowRate, Leverage, LeverageTier, Liquidation, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
10
+ from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, FundingHistory, Int, IsolatedBorrowRate, Leverage, LeverageTier, Liquidation, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -6819,7 +6819,7 @@ class bitget(Exchange, ImplicitAPI):
6819
6819
  'info': interest,
6820
6820
  }, market)
6821
6821
 
6822
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
6822
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
6823
6823
  """
6824
6824
  fetch a history of internal transfers made on an account
6825
6825
  :see: https://www.bitget.com/api-doc/spot/account/Get-Account-TransferRecords
ccxt/bitmart.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitmart import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -3819,7 +3819,7 @@ class bitmart(Exchange, ImplicitAPI):
3819
3819
  'status': self.parse_transfer_status(self.safe_string(transfer, 'state')),
3820
3820
  }
3821
3821
 
3822
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
3822
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
3823
3823
  """
3824
3824
  fetch a history of internal transfers made on an account, only transfers between spot and swap are supported
3825
3825
  :see: https://developer-pro.bitmart.com/en/futures/#get-transfer-list-signed
ccxt/bitrue.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitrue import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, TransferEntries
10
+ from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -2727,7 +2727,7 @@ class bitrue(Exchange, ImplicitAPI):
2727
2727
  'status': 'ok',
2728
2728
  }
2729
2729
 
2730
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
2730
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
2731
2731
  """
2732
2732
  fetch a history of internal transfers made on an account
2733
2733
  :see: https://www.bitrue.com/api-docs#get-future-account-transfer-history-list-user_data-hmac-sha256
ccxt/btcbox.py CHANGED
@@ -648,7 +648,7 @@ class btcbox(Exchange, ImplicitAPI):
648
648
  'nonce': nonce,
649
649
  }, params)
650
650
  request = self.urlencode(query)
651
- secret = self.hash(self.encode(self.secret), 'sha256')
651
+ secret = self.hash(self.encode(self.secret), 'md5')
652
652
  query['signature'] = self.hmac(self.encode(request), self.encode(secret), hashlib.sha256)
653
653
  body = self.urlencode(query)
654
654
  headers = {
ccxt/bybit.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bybit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, LeverageTier, LeverageTiers, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
9
+ from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, LeverageTier, LeverageTiers, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, 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
@@ -6718,7 +6718,7 @@ class bybit(Exchange, ImplicitAPI):
6718
6718
  'status': status,
6719
6719
  })
6720
6720
 
6721
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
6721
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
6722
6722
  """
6723
6723
  fetch a history of internal transfers made on an account
6724
6724
  :see: https://bybit-exchange.github.io/docs/v5/asset/inter-transfer-list
@@ -74,7 +74,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
74
74
  'fetchCrossBorrowRates': False,
75
75
  'fetchCurrencies': True,
76
76
  'fetchDeposits': True,
77
- 'fetchFundingHistory': False,
77
+ 'fetchFundingHistory': True,
78
78
  'fetchFundingRate': False,
79
79
  'fetchFundingRateHistory': True,
80
80
  'fetchFundingRates': False,
@@ -433,6 +433,77 @@ class coinbaseinternational(Exchange, ImplicitAPI):
433
433
  'previousFundingDatetime': None,
434
434
  }
435
435
 
436
+ def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
437
+ """
438
+ fetch the history of funding payments paid and received on self account
439
+ :see: https://docs.cdp.coinbase.com/intx/reference/gettransfers
440
+ :param str [symbol]: unified market symbol
441
+ :param int [since]: the earliest time in ms to fetch funding history for
442
+ :param int [limit]: the maximum number of funding history structures to retrieve
443
+ :param dict [params]: extra parameters specific to the exchange API endpoint
444
+ :returns dict: a `funding history structure <https://docs.ccxt.com/#/?id=funding-history-structure>`
445
+ """
446
+ self.load_markets()
447
+ request: dict = {
448
+ 'type': 'FUNDING',
449
+ }
450
+ market: Market = None
451
+ if symbol is not None:
452
+ market = self.market(symbol)
453
+ portfolios = None
454
+ portfolios, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'portfolios')
455
+ if portfolios is not None:
456
+ request['portfolios'] = portfolios
457
+ if since is not None:
458
+ request['time_from'] = self.iso8601(since)
459
+ if limit is not None:
460
+ request['result_limit'] = limit
461
+ else:
462
+ request['result_limit'] = 100
463
+ response = self.v1PrivateGetTransfers(self.extend(request, params))
464
+ fundings = self.safe_list(response, 'results', [])
465
+ return self.parse_incomes(fundings, market, since, limit)
466
+
467
+ def parse_income(self, income, market: Market = None):
468
+ #
469
+ # {
470
+ # "amount":"0.0008",
471
+ # "asset":"USDC",
472
+ # "created_at":"2024-02-22T16:00:00Z",
473
+ # "from_portfolio":{
474
+ # "id":"13yuk1fs-1-0",
475
+ # "name":"Eng Test Portfolio - 2",
476
+ # "uuid":"018712f2-5ff9-7de3-9010-xxxxxxxxx"
477
+ # },
478
+ # "instrument_id":"149264164756389888",
479
+ # "instrument_symbol":"ETH-PERP",
480
+ # "position_id":"1xy4v51m-1-2",
481
+ # "status":"PROCESSED",
482
+ # "to_portfolio":{
483
+ # "name":"CB_FUND"
484
+ # },
485
+ # "transfer_type":"FUNDING",
486
+ # "transfer_uuid":"a6b708df-2c44-32c5-bb98-xxxxxxxxxx",
487
+ # "updated_at":"2024-02-22T16:00:00Z"
488
+ # }
489
+ #
490
+ marketId = self.safe_string(income, 'symbol')
491
+ market = self.safe_market(marketId, market, None, 'contract')
492
+ datetime = self.safe_integer(income, 'created_at')
493
+ timestamp = self.parse8601(datetime)
494
+ currencyId = self.safe_string(income, 'asset')
495
+ code = self.safe_currency_code(currencyId)
496
+ return {
497
+ 'info': income,
498
+ 'symbol': market['symbol'],
499
+ 'code': code,
500
+ 'timestamp': timestamp,
501
+ 'datetime': self.iso8601(timestamp),
502
+ 'id': self.safe_string(income, 'transfer_uuid'),
503
+ 'amount': self.safe_number(income, 'amount'),
504
+ 'rate': None,
505
+ }
506
+
436
507
  def create_deposit_address(self, code: str, params={}):
437
508
  """
438
509
  create a currency deposit address
ccxt/coinex.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinex import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, TransferEntries
8
+ from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import AuthenticationError
@@ -4679,7 +4679,7 @@ class coinex(Exchange, ImplicitAPI):
4679
4679
  'status': self.parse_transfer_status(self.safe_string_2(transfer, 'code', 'status')),
4680
4680
  }
4681
4681
 
4682
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
4682
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
4683
4683
  """
4684
4684
  fetch a history of internal transfers made on an account
4685
4685
  :see: https://docs.coinex.com/api/v2/assets/transfer/http/list-transfer-history
ccxt/coinlist.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinlist import ImplicitAPI
8
8
  import hashlib
9
9
  import math
10
- from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry, TransferEntries
10
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -1703,7 +1703,7 @@ class coinlist(Exchange, ImplicitAPI):
1703
1703
  transfer = self.parse_transfer(response, currency)
1704
1704
  return transfer
1705
1705
 
1706
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
1706
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
1707
1707
  """
1708
1708
  fetch a history of internal transfers between CoinList.co and CoinList Pro. It does not return external deposits or withdrawals
1709
1709
  :see: https://trade-docs.coinlist.co/?javascript--nodejs#list-transfers
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, Balances, Currencies, Currency, Greeks, Int, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry, TransferEntries
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Greeks, Int, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, 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
@@ -2618,7 +2618,7 @@ class deribit(Exchange, ImplicitAPI):
2618
2618
  })
2619
2619
  return result
2620
2620
 
2621
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
2621
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
2622
2622
  """
2623
2623
  fetch a history of internal transfers made on an account
2624
2624
  :see: https://docs.deribit.com/#private-get_transfers
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 Balances, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
10
+ from ccxt.base.types import Balances, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, 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
@@ -3461,7 +3461,7 @@ class digifinex(Exchange, ImplicitAPI):
3461
3461
  # }
3462
3462
  #
3463
3463
 
3464
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
3464
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
3465
3465
  """
3466
3466
  fetch the transfer history, only transfers between spot and swap accounts are supported
3467
3467
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#transferrecord
ccxt/hyperliquid.py CHANGED
@@ -816,8 +816,6 @@ class hyperliquid(Exchange, ImplicitAPI):
816
816
  until = self.safe_integer(params, 'until', self.milliseconds())
817
817
  if since is None:
818
818
  since = 0
819
- if limit is None:
820
- limit = 500
821
819
  params = self.omit(params, ['until'])
822
820
  request: dict = {
823
821
  'type': 'candleSnapshot',
ccxt/kucoin.py CHANGED
@@ -1513,20 +1513,26 @@ class kucoin(Exchange, ImplicitAPI):
1513
1513
  },
1514
1514
  'networks': {},
1515
1515
  }
1516
- isWithdrawEnabled = self.safe_bool(fee, 'isWithdrawEnabled')
1516
+ isWithdrawEnabled = self.safe_bool(fee, 'isWithdrawEnabled', True)
1517
+ minFee = None
1517
1518
  if isWithdrawEnabled:
1518
- result['withdraw']['fee'] = self.safe_number_2(fee, 'withdrawalMinFee', 'withdrawMinFee')
1519
1519
  result['withdraw']['percentage'] = False
1520
- networkId = self.safe_string(fee, 'chain')
1521
- if networkId:
1520
+ chains = self.safe_list(fee, 'chains', [])
1521
+ for i in range(0, len(chains)):
1522
+ chain = chains[i]
1523
+ networkId = self.safe_string(chain, 'chainId')
1522
1524
  networkCode = self.network_id_to_code(networkId, self.safe_string(currency, 'code'))
1525
+ withdrawFee = self.safe_string(chain, 'withdrawalMinFee')
1526
+ if minFee is None or (Precise.string_lt(withdrawFee, minFee)):
1527
+ minFee = withdrawFee
1523
1528
  result['networks'][networkCode] = {
1524
- 'withdraw': result['withdraw'],
1529
+ 'withdraw': self.parse_number(withdrawFee),
1525
1530
  'deposit': {
1526
1531
  'fee': None,
1527
1532
  'percentage': None,
1528
1533
  },
1529
1534
  }
1535
+ result['withdraw']['fee'] = self.parse_number(minFee)
1530
1536
  return result
1531
1537
 
1532
1538
  def is_futures_method(self, methodName, params):
ccxt/latoken.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.latoken import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -1476,7 +1476,7 @@ class latoken(Exchange, ImplicitAPI):
1476
1476
  }
1477
1477
  return self.safe_string(types, type, type)
1478
1478
 
1479
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
1479
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
1480
1480
  """
1481
1481
  fetch a history of internal transfers made on an account
1482
1482
  :see: https://api.latoken.com/doc/v2/#tag/Transfer/operation/getUsersTransfers
ccxt/mexc.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.mexc import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry, TransferEntries
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, 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
@@ -4690,7 +4690,7 @@ class mexc(Exchange, ImplicitAPI):
4690
4690
  raise BadRequest(self.id + ' fetchTransfer() is not supported for ' + marketType)
4691
4691
  return None
4692
4692
 
4693
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
4693
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
4694
4694
  """
4695
4695
  fetch a history of internal transfers made on an account
4696
4696
  :param str code: unified currency code of the currency transferred
ccxt/okx.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.okx import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Conversion, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Greeks, Int, Leverage, LeverageTier, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
9
+ from ccxt.base.types import Account, Balances, Conversion, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Greeks, Int, Leverage, LeverageTier, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from typing import Any
12
12
  from ccxt.base.errors import ExchangeError
@@ -5523,7 +5523,7 @@ class okx(Exchange, ImplicitAPI):
5523
5523
  transfer = self.safe_dict(data, 0)
5524
5524
  return self.parse_transfer(transfer)
5525
5525
 
5526
- def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> TransferEntries:
5526
+ def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
5527
5527
  """
5528
5528
  fetch a history of internal transfers made on an account
5529
5529
  :see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
ccxt/oxfun.py CHANGED
@@ -1968,7 +1968,7 @@ class oxfun(Exchange, ImplicitAPI):
1968
1968
  def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
1969
1969
  """
1970
1970
  make a withdrawal
1971
- :see: https://docs.bitflex.com/spot#withdraw
1971
+ :see: https://docs.ox.fun/?json#post-v3-withdrawal
1972
1972
  :param str code: unified currency code
1973
1973
  :param float amount: the amount to withdraw
1974
1974
  :param str address: the address to withdraw to