ccxt 4.4.71__py2.py3-none-any.whl → 4.4.73__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 (99) hide show
  1. ccxt/__init__.py +1 -3
  2. ccxt/abstract/bingx.py +1 -1
  3. ccxt/ace.py +36 -1
  4. ccxt/alpaca.py +46 -0
  5. ccxt/ascendex.py +2 -2
  6. ccxt/async_support/__init__.py +1 -3
  7. ccxt/async_support/ace.py +36 -1
  8. ccxt/async_support/alpaca.py +46 -0
  9. ccxt/async_support/ascendex.py +2 -2
  10. ccxt/async_support/base/exchange.py +1 -1
  11. ccxt/async_support/binance.py +19 -15
  12. ccxt/async_support/bingx.py +2 -2
  13. ccxt/async_support/bit2c.py +11 -0
  14. ccxt/async_support/bitfinex.py +1 -1
  15. ccxt/async_support/bitfinex1.py +1 -1
  16. ccxt/async_support/bitget.py +6 -5
  17. ccxt/async_support/bitrue.py +1 -1
  18. ccxt/async_support/bl3p.py +2 -2
  19. ccxt/async_support/bybit.py +32 -25
  20. ccxt/async_support/cex.py +1 -0
  21. ccxt/async_support/coinbase.py +3 -2
  22. ccxt/async_support/coinbaseexchange.py +3 -2
  23. ccxt/async_support/coinbaseinternational.py +3 -2
  24. ccxt/async_support/coinex.py +1 -1
  25. ccxt/async_support/defx.py +1 -1
  26. ccxt/async_support/deribit.py +2 -1
  27. ccxt/async_support/derive.py +13 -7
  28. ccxt/async_support/gate.py +3 -0
  29. ccxt/async_support/gemini.py +2 -1
  30. ccxt/async_support/hitbtc.py +1 -1
  31. ccxt/async_support/hyperliquid.py +38 -0
  32. ccxt/async_support/kraken.py +1 -1
  33. ccxt/async_support/krakenfutures.py +4 -0
  34. ccxt/async_support/kucoin.py +1 -1
  35. ccxt/async_support/kuna.py +1 -1
  36. ccxt/async_support/mexc.py +1 -1
  37. ccxt/async_support/ndax.py +1 -1
  38. ccxt/async_support/okcoin.py +4 -0
  39. ccxt/async_support/okx.py +21 -30
  40. ccxt/async_support/paradex.py +65 -7
  41. ccxt/async_support/paymium.py +1 -1
  42. ccxt/async_support/poloniex.py +2 -1
  43. ccxt/async_support/upbit.py +1 -1
  44. ccxt/async_support/whitebit.py +98 -2
  45. ccxt/async_support/woo.py +3 -1
  46. ccxt/async_support/woofipro.py +1 -1
  47. ccxt/async_support/yobit.py +2 -1
  48. ccxt/base/errors.py +6 -0
  49. ccxt/base/exchange.py +13 -12
  50. ccxt/binance.py +19 -15
  51. ccxt/bingx.py +2 -2
  52. ccxt/bit2c.py +11 -0
  53. ccxt/bitfinex.py +1 -1
  54. ccxt/bitfinex1.py +1 -1
  55. ccxt/bitget.py +6 -5
  56. ccxt/bitrue.py +1 -1
  57. ccxt/bl3p.py +2 -2
  58. ccxt/bybit.py +32 -25
  59. ccxt/cex.py +1 -0
  60. ccxt/coinbase.py +3 -2
  61. ccxt/coinbaseexchange.py +3 -2
  62. ccxt/coinbaseinternational.py +3 -2
  63. ccxt/coinex.py +1 -1
  64. ccxt/defx.py +1 -1
  65. ccxt/deribit.py +2 -1
  66. ccxt/derive.py +13 -7
  67. ccxt/gate.py +3 -0
  68. ccxt/gemini.py +2 -1
  69. ccxt/hitbtc.py +1 -1
  70. ccxt/hyperliquid.py +38 -0
  71. ccxt/kraken.py +1 -1
  72. ccxt/krakenfutures.py +4 -0
  73. ccxt/kucoin.py +1 -1
  74. ccxt/kuna.py +1 -1
  75. ccxt/mexc.py +1 -1
  76. ccxt/ndax.py +1 -1
  77. ccxt/okcoin.py +4 -0
  78. ccxt/okx.py +21 -30
  79. ccxt/paradex.py +65 -7
  80. ccxt/paymium.py +1 -1
  81. ccxt/poloniex.py +2 -1
  82. ccxt/pro/__init__.py +1 -3
  83. ccxt/pro/bingx.py +1 -1
  84. ccxt/pro/bitmart.py +15 -7
  85. ccxt/pro/derive.py +2 -2
  86. ccxt/pro/krakenfutures.py +1 -1
  87. ccxt/test/tests_async.py +6 -3
  88. ccxt/test/tests_sync.py +6 -3
  89. ccxt/upbit.py +1 -1
  90. ccxt/whitebit.py +98 -2
  91. ccxt/woo.py +3 -1
  92. ccxt/woofipro.py +1 -1
  93. ccxt/yobit.py +2 -1
  94. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/METADATA +5 -5
  95. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/RECORD +98 -99
  96. ccxt/abstract/bitfinex1.py +0 -69
  97. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/LICENSE.txt +0 -0
  98. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/WHEEL +0 -0
  99. {ccxt-4.4.71.dist-info → ccxt-4.4.73.dist-info}/top_level.txt +0 -0
@@ -62,23 +62,34 @@ class bit2c(Exchange, ImplicitAPI):
62
62
  'fetchMarginMode': False,
63
63
  'fetchMarkOHLCV': False,
64
64
  'fetchMyTrades': True,
65
+ 'fetchOpenInterest': False,
65
66
  'fetchOpenInterestHistory': False,
67
+ 'fetchOpenInterests': False,
66
68
  'fetchOpenOrders': True,
67
69
  'fetchOrder': True,
68
70
  'fetchOrderBook': True,
69
71
  'fetchPosition': False,
72
+ 'fetchPositionHistory': False,
70
73
  'fetchPositionMode': False,
71
74
  'fetchPositions': False,
75
+ 'fetchPositionsForSymbol': False,
76
+ 'fetchPositionsHistory': False,
72
77
  'fetchPositionsRisk': False,
73
78
  'fetchPremiumIndexOHLCV': False,
79
+ 'fetchSettlementHistory': False,
74
80
  'fetchTicker': True,
75
81
  'fetchTrades': True,
76
82
  'fetchTradingFee': False,
77
83
  'fetchTradingFees': True,
78
84
  'fetchTransfer': False,
79
85
  'fetchTransfers': False,
86
+ 'fetchUnderlyingAssets': False,
80
87
  'reduceMargin': False,
88
+ 'repayCrossMargin': False,
89
+ 'repayIsolatedMargin': False,
90
+ 'repayMargin': False,
81
91
  'setLeverage': False,
92
+ 'setMargin': False,
82
93
  'setMarginMode': False,
83
94
  'setPositionMode': False,
84
95
  'transfer': False,
@@ -2203,7 +2203,7 @@ class bitfinex(Exchange, ImplicitAPI):
2203
2203
  tradesList.append({'result': response[i]}) # convert to array of dicts to match parseOrder signature
2204
2204
  return self.parse_trades(tradesList, market, since, limit)
2205
2205
 
2206
- async def create_deposit_address(self, code: str, params={}):
2206
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
2207
2207
  """
2208
2208
  create a currency deposit address
2209
2209
 
@@ -1395,7 +1395,7 @@ class bitfinex1(Exchange, ImplicitAPI):
1395
1395
  return self.options['currencyNames'][code]
1396
1396
  raise NotSupported(self.id + ' ' + code + ' not supported for withdrawal')
1397
1397
 
1398
- async def create_deposit_address(self, code: str, params={}):
1398
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1399
1399
  """
1400
1400
  create a currency deposit address
1401
1401
 
@@ -1918,7 +1918,7 @@ class bitget(Exchange, ImplicitAPI):
1918
1918
  priceDecimals = self.safe_integer(market, 'pricePlace')
1919
1919
  amountDecimals = self.safe_integer(market, 'volumePlace')
1920
1920
  priceStep = self.safe_string(market, 'priceEndStep')
1921
- amountStep = self.safe_string(market, 'minTradeNum')
1921
+ amountStep = self.safe_string(market, 'sizeMultiplier')
1922
1922
  precise = Precise(priceStep)
1923
1923
  precise.decimals = max(precise.decimals, priceDecimals)
1924
1924
  precise.reduce()
@@ -2417,16 +2417,17 @@ class bitget(Exchange, ImplicitAPI):
2417
2417
  paginate, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'paginate')
2418
2418
  if paginate:
2419
2419
  return await self.fetch_paginated_call_cursor('fetchWithdrawals', None, since, limit, params, 'idLessThan', 'idLessThan', None, 100)
2420
- if code is None:
2421
- raise ArgumentsRequired(self.id + ' fetchWithdrawals() requires a `code` argument')
2422
- currency = self.currency(code)
2420
+ currency = None
2421
+ if code is not None:
2422
+ currency = self.currency(code)
2423
2423
  if since is None:
2424
2424
  since = self.milliseconds() - 7776000000 # 90 days
2425
2425
  request: dict = {
2426
- 'coin': currency['id'],
2427
2426
  'startTime': since,
2428
2427
  'endTime': self.milliseconds(),
2429
2428
  }
2429
+ if currency is not None:
2430
+ request['coin'] = currency['id']
2430
2431
  request, params = self.handle_until_option('endTime', request, params)
2431
2432
  if limit is not None:
2432
2433
  request['limit'] = limit
@@ -1230,7 +1230,7 @@ class bitrue(Exchange, ImplicitAPI):
1230
1230
  # "time": 1699338305000
1231
1231
  # }
1232
1232
  #
1233
- timestamp = self.safe_integer(response, 'time')
1233
+ timestamp = self.safe_integer_2(response, 'time', 'lastUpdateId')
1234
1234
  orderbook = self.parse_order_book(response, symbol, timestamp)
1235
1235
  orderbook['nonce'] = self.safe_integer(response, 'lastUpdateId')
1236
1236
  return orderbook
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.bl3p import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Any, Balances, Currency, IndexType, Int, Market, Num, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees
9
+ from ccxt.base.types import Any, Balances, Currency, DepositAddress, IndexType, Int, Market, Num, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees
10
10
  from typing import List
11
11
  from ccxt.base.decimal_to_precision import TICK_SIZE
12
12
  from ccxt.base.precise import Precise
@@ -477,7 +477,7 @@ class bl3p(Exchange, ImplicitAPI):
477
477
  'info': response,
478
478
  })
479
479
 
480
- async def create_deposit_address(self, code: str, params={}):
480
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
481
481
  """
482
482
  create a currency deposit address
483
483
 
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.bybit import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Any, Balances, BorrowInterest, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, Greeks, Int, LedgerEntry, Leverage, LeverageTier, LeverageTiers, LongShortRatio, Market, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, MarketInterface, TransferEntry
10
+ from ccxt.base.types import Any, Balances, BorrowInterest, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, FundingHistory, Greeks, Int, LedgerEntry, Leverage, LeverageTier, LeverageTiers, Liquidation, LongShortRatio, Market, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, MarketInterface, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -2476,7 +2476,7 @@ class bybit(Exchange, ImplicitAPI):
2476
2476
  tickerList = self.safe_list(result, 'list', [])
2477
2477
  return self.parse_tickers(tickerList, parsedSymbols)
2478
2478
 
2479
- async def fetch_bids_asks(self, symbols: Strings = None, params={}):
2479
+ async def fetch_bids_asks(self, symbols: Strings = None, params={}) -> Tickers:
2480
2480
  """
2481
2481
  fetches the bid and ask price and volume for multiple markets
2482
2482
 
@@ -3690,7 +3690,7 @@ class bybit(Exchange, ImplicitAPI):
3690
3690
  'trades': None,
3691
3691
  }, market)
3692
3692
 
3693
- async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
3693
+ async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}) -> Order:
3694
3694
  """
3695
3695
  create a market buy order by providing the symbol and cost
3696
3696
 
@@ -3707,7 +3707,7 @@ class bybit(Exchange, ImplicitAPI):
3707
3707
  raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
3708
3708
  return await self.create_order(symbol, 'market', 'buy', cost, 1, params)
3709
3709
 
3710
- async def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
3710
+ async def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}) -> Order:
3711
3711
  """
3712
3712
  create a market sell order by providing the symbol and cost
3713
3713
 
@@ -3728,7 +3728,7 @@ class bybit(Exchange, ImplicitAPI):
3728
3728
  raise NotSupported(self.id + ' createMarketSellOrderWithCost() supports spot orders only')
3729
3729
  return await self.create_order(symbol, 'market', 'sell', cost, 1, params)
3730
3730
 
3731
- async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
3731
+ async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}) -> Order:
3732
3732
  """
3733
3733
  create a trade order
3734
3734
 
@@ -3987,7 +3987,7 @@ class bybit(Exchange, ImplicitAPI):
3987
3987
  params = self.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice', 'hedged'])
3988
3988
  return self.extend(request, params)
3989
3989
 
3990
- async def create_orders(self, orders: List[OrderRequest], params={}):
3990
+ async def create_orders(self, orders: List[OrderRequest], params={}) -> List[Order]:
3991
3991
  """
3992
3992
  create a list of trade orders
3993
3993
 
@@ -4137,7 +4137,7 @@ class bybit(Exchange, ImplicitAPI):
4137
4137
  params = self.omit(params, ['stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'clientOrderId', 'stopLoss', 'takeProfit'])
4138
4138
  return request
4139
4139
 
4140
- async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
4140
+ async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order:
4141
4141
  """
4142
4142
  edit a trade order
4143
4143
 
@@ -4187,7 +4187,7 @@ class bybit(Exchange, ImplicitAPI):
4187
4187
  'id': self.safe_string(result, 'orderId'),
4188
4188
  })
4189
4189
 
4190
- async def edit_orders(self, orders: List[OrderRequest], params={}):
4190
+ async def edit_orders(self, orders: List[OrderRequest], params={}) -> List[Order]:
4191
4191
  """
4192
4192
  edit a list of trade orders
4193
4193
 
@@ -4298,7 +4298,7 @@ class bybit(Exchange, ImplicitAPI):
4298
4298
  request['category'] = 'option'
4299
4299
  return self.extend(request, params)
4300
4300
 
4301
- async def cancel_order(self, id: str, symbol: Str = None, params={}):
4301
+ async def cancel_order(self, id: str, symbol: Str = None, params={}) -> Order:
4302
4302
  """
4303
4303
  cancels an open order
4304
4304
 
@@ -4333,7 +4333,7 @@ class bybit(Exchange, ImplicitAPI):
4333
4333
  result = self.safe_dict(response, 'result', {})
4334
4334
  return self.parse_order(result, market)
4335
4335
 
4336
- async def cancel_orders(self, ids, symbol: Str = None, params={}):
4336
+ async def cancel_orders(self, ids, symbol: Str = None, params={}) -> List[Order]:
4337
4337
  """
4338
4338
  cancel multiple orders
4339
4339
 
@@ -4602,7 +4602,7 @@ class bybit(Exchange, ImplicitAPI):
4602
4602
  return response
4603
4603
  return self.parse_orders(orders, market)
4604
4604
 
4605
- async def fetch_order_classic(self, id: str, symbol: Str = None, params={}):
4605
+ async def fetch_order_classic(self, id: str, symbol: Str = None, params={}) -> Order:
4606
4606
  """
4607
4607
  fetches information on an order made by the user *classic accounts only*
4608
4608
 
@@ -4847,7 +4847,7 @@ classic accounts only/ spot not supported* fetches information on an order made
4847
4847
  data = self.add_pagination_cursor_to_result(response)
4848
4848
  return self.parse_orders(data, market, since, limit)
4849
4849
 
4850
- async def fetch_closed_order(self, id: str, symbol: Str = None, params={}):
4850
+ async def fetch_closed_order(self, id: str, symbol: Str = None, params={}) -> Order:
4851
4851
  """
4852
4852
  fetches information on a closed order made by the user
4853
4853
 
@@ -4877,7 +4877,7 @@ classic accounts only/ spot not supported* fetches information on an order made
4877
4877
  raise InvalidOrder(self.id + ' returned more than one order')
4878
4878
  return self.safe_value(result, 0)
4879
4879
 
4880
- async def fetch_open_order(self, id: str, symbol: Str = None, params={}):
4880
+ async def fetch_open_order(self, id: str, symbol: Str = None, params={}) -> Order:
4881
4881
  """
4882
4882
  fetches information on an open order made by the user
4883
4883
 
@@ -5033,7 +5033,7 @@ classic accounts only/ spot not supported* fetches information on an order made
5033
5033
  }
5034
5034
  return await self.fetch_canceled_and_closed_orders(symbol, since, limit, self.extend(request, params))
5035
5035
 
5036
- async def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5036
+ async def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
5037
5037
  """
5038
5038
  fetches information on multiple canceled orders made by the user
5039
5039
 
@@ -5156,7 +5156,7 @@ classic accounts only/ spot not supported* fetches information on an order made
5156
5156
  data = self.add_pagination_cursor_to_result(response)
5157
5157
  return self.parse_orders(data, market, since, limit)
5158
5158
 
5159
- async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5159
+ async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
5160
5160
  """
5161
5161
  fetch all the trades made from a single order
5162
5162
 
@@ -5178,7 +5178,7 @@ classic accounts only/ spot not supported* fetches information on an order made
5178
5178
  params = self.omit(params, ['clientOrderId', 'orderLinkId'])
5179
5179
  return await self.fetch_my_trades(symbol, since, limit, self.extend(request, params))
5180
5180
 
5181
- async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5181
+ async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
5182
5182
  """
5183
5183
  fetch all trades made by the user
5184
5184
 
@@ -5901,7 +5901,7 @@ classic accounts only/ spot not supported* fetches information on an order made
5901
5901
  result = self.safe_dict(response, 'result', {})
5902
5902
  return self.parse_transaction(result, currency)
5903
5903
 
5904
- async def fetch_position(self, symbol: str, params={}):
5904
+ async def fetch_position(self, symbol: str, params={}) -> Position:
5905
5905
  """
5906
5906
  fetch data on a single open contract trade position
5907
5907
 
@@ -5972,7 +5972,7 @@ classic accounts only/ spot not supported* fetches information on an order made
5972
5972
  position['datetime'] = self.iso8601(timestamp)
5973
5973
  return position
5974
5974
 
5975
- async def fetch_positions(self, symbols: Strings = None, params={}):
5975
+ async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
5976
5976
  """
5977
5977
  fetch all open positions
5978
5978
 
@@ -5984,9 +5984,14 @@ classic accounts only/ spot not supported* fetches information on an order made
5984
5984
  :param str [params.subType]: market subType, ['linear', 'inverse']
5985
5985
  :param str [params.baseCoin]: Base coin. Supports linear, inverse & option
5986
5986
  :param str [params.settleCoin]: Settle coin. Supports linear, inverse & option
5987
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times
5987
5988
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
5988
5989
  """
5989
5990
  await self.load_markets()
5991
+ paginate = False
5992
+ paginate, params = self.handle_option_and_params(params, 'fetchPositions', 'paginate')
5993
+ if paginate:
5994
+ return await self.fetch_paginated_call_cursor('fetchPositions', symbols, None, None, params, 'nextPageCursor', 'cursor', None, 200)
5990
5995
  symbol = None
5991
5996
  if (symbols is not None) and isinstance(symbols, list):
5992
5997
  symbolsLength = len(symbols)
@@ -6017,6 +6022,8 @@ classic accounts only/ spot not supported* fetches information on an order made
6017
6022
  # inverse
6018
6023
  if symbol is None and baseCoin is None:
6019
6024
  request['category'] = 'inverse'
6025
+ if self.safe_integer(params, 'limit') is None:
6026
+ request['limit'] = 200 # max limit
6020
6027
  params = self.omit(params, ['type'])
6021
6028
  request['category'] = type
6022
6029
  response = await self.privateGetV5PositionList(self.extend(request, params))
@@ -6065,7 +6072,7 @@ classic accounts only/ spot not supported* fetches information on an order made
6065
6072
  results.append(self.parse_position(rawPosition))
6066
6073
  return self.filter_by_array_positions(results, 'symbol', symbols, False)
6067
6074
 
6068
- def parse_position(self, position: dict, market: Market = None):
6075
+ def parse_position(self, position: dict, market: Market = None) -> Position:
6069
6076
  #
6070
6077
  # linear swap
6071
6078
  #
@@ -7016,7 +7023,7 @@ classic accounts only/ spot not supported* fetches information on an order made
7016
7023
  'amount': amount,
7017
7024
  })
7018
7025
 
7019
- def parse_margin_loan(self, info, currency: Currency = None):
7026
+ def parse_margin_loan(self, info, currency: Currency = None) -> dict:
7020
7027
  #
7021
7028
  # borrowCrossMargin
7022
7029
  #
@@ -7254,7 +7261,7 @@ classic accounts only/ spot not supported* fetches information on an order made
7254
7261
  result[symbol] = fee
7255
7262
  return result
7256
7263
 
7257
- def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
7264
+ def parse_deposit_withdraw_fee(self, fee, currency: Currency = None) -> Any:
7258
7265
  #
7259
7266
  # {
7260
7267
  # "name": "BTC",
@@ -7702,7 +7709,7 @@ classic accounts only/ spot not supported* fetches information on an order made
7702
7709
  'info': greeks,
7703
7710
  }
7704
7711
 
7705
- async def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
7712
+ async def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Liquidation]:
7706
7713
  """
7707
7714
  retrieves the users liquidated positions
7708
7715
 
@@ -7781,7 +7788,7 @@ classic accounts only/ spot not supported* fetches information on an order made
7781
7788
  liquidations = self.add_pagination_cursor_to_result(response)
7782
7789
  return self.parse_liquidations(liquidations, market, since, limit)
7783
7790
 
7784
- def parse_liquidation(self, liquidation, market: Market = None):
7791
+ def parse_liquidation(self, liquidation, market: Market = None) -> Liquidation:
7785
7792
  #
7786
7793
  # {
7787
7794
  # "symbol": "ETHPERP",
@@ -7944,7 +7951,7 @@ classic accounts only/ spot not supported* fetches information on an order made
7944
7951
  })
7945
7952
  return tiers
7946
7953
 
7947
- async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
7954
+ async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[FundingHistory]:
7948
7955
  """
7949
7956
  fetch the history of funding payments paid and received on self account
7950
7957
 
@@ -7985,7 +7992,7 @@ classic accounts only/ spot not supported* fetches information on an order made
7985
7992
  fundings = self.add_pagination_cursor_to_result(response)
7986
7993
  return self.parse_incomes(fundings, market, since, limit)
7987
7994
 
7988
- def parse_income(self, income, market: Market = None):
7995
+ def parse_income(self, income, market: Market = None) -> object:
7989
7996
  #
7990
7997
  # {
7991
7998
  # "symbol": "XMRUSDT",
ccxt/async_support/cex.py CHANGED
@@ -329,6 +329,7 @@ class cex(Exchange, ImplicitAPI):
329
329
  'margin': None,
330
330
  'deposit': deposit,
331
331
  'withdraw': withdraw,
332
+ 'active': None,
332
333
  'fee': self.safe_number(rawNetwork, 'withdrawalFee'),
333
334
  'precision': currencyPrecision,
334
335
  'limits': {
@@ -735,7 +735,7 @@ class coinbase(Exchange, ImplicitAPI):
735
735
  'info': account,
736
736
  }
737
737
 
738
- async def create_deposit_address(self, code: str, params={}):
738
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
739
739
  """
740
740
  create a currency deposit address
741
741
 
@@ -803,6 +803,7 @@ class coinbase(Exchange, ImplicitAPI):
803
803
  'currency': code,
804
804
  'tag': tag,
805
805
  'address': address,
806
+ 'network': None,
806
807
  'info': response,
807
808
  }
808
809
 
@@ -2301,7 +2302,7 @@ class coinbase(Exchange, ImplicitAPI):
2301
2302
  # "ending_before":null,
2302
2303
  # "starting_after":null,
2303
2304
  # "previous_ending_before":null,
2304
- # "next_starting_after":"6b17acd6-2e68-5eb0-9f45-72d67cef578b",
2305
+ # "next_starting_after":"6b17acd6-2e68-5eb0-9f45-72d67cef578a",
2305
2306
  # "limit":100,
2306
2307
  # "order":"desc",
2307
2308
  # "previous_uri":null,
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbaseexchange import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Any, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
9
+ from ccxt.base.types import Account, Any, Balances, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -1783,7 +1783,7 @@ class coinbaseexchange(Exchange, ImplicitAPI):
1783
1783
  'fee': fee,
1784
1784
  }
1785
1785
 
1786
- async def create_deposit_address(self, code: str, params={}):
1786
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1787
1787
  """
1788
1788
  create a currency deposit address
1789
1789
 
@@ -1814,6 +1814,7 @@ class coinbaseexchange(Exchange, ImplicitAPI):
1814
1814
  return {
1815
1815
  'currency': code,
1816
1816
  'address': self.check_address(address),
1817
+ 'network': None,
1817
1818
  'tag': tag,
1818
1819
  'info': response,
1819
1820
  }
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbaseinternational import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Any, Balances, Currencies, Currency, Int, Market, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Market, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -736,7 +736,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
736
736
  }
737
737
  return self.safe_string(statuses, status, status)
738
738
 
739
- async def create_deposit_address(self, code: str, params={}):
739
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
740
740
  """
741
741
  create a currency deposit address
742
742
 
@@ -783,6 +783,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
783
783
  'currency': code,
784
784
  'tag': tag,
785
785
  'address': address,
786
+ 'network': None,
786
787
  'info': response,
787
788
  }
788
789
 
@@ -3679,7 +3679,7 @@ class coinex(Exchange, ImplicitAPI):
3679
3679
  """
3680
3680
  return await self.fetch_orders_by_status('finished', symbol, since, limit, params)
3681
3681
 
3682
- async def create_deposit_address(self, code: str, params={}):
3682
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
3683
3683
  """
3684
3684
  create a currency deposit address
3685
3685
 
@@ -614,7 +614,7 @@ class defx(Exchange, ImplicitAPI):
614
614
  'active': self.safe_string(market, 'status', '') == 'active',
615
615
  'contract': True,
616
616
  'linear': True,
617
- 'inverse': None,
617
+ 'inverse': False,
618
618
  'taker': self.safe_number(fees, 'taker'),
619
619
  'maker': self.safe_number(fees, 'maker'),
620
620
  'contractSize': self.parse_number('1'),
@@ -1100,7 +1100,7 @@ class deribit(Exchange, ImplicitAPI):
1100
1100
  result = self.safe_dict(response, 'result', {})
1101
1101
  return self.parse_balance(result)
1102
1102
 
1103
- async def create_deposit_address(self, code: str, params={}):
1103
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1104
1104
  """
1105
1105
  create a currency deposit address
1106
1106
 
@@ -1135,6 +1135,7 @@ class deribit(Exchange, ImplicitAPI):
1135
1135
  'currency': code,
1136
1136
  'address': address,
1137
1137
  'tag': None,
1138
+ 'network': None,
1138
1139
  'info': response,
1139
1140
  }
1140
1141
 
@@ -601,6 +601,7 @@ class derive(Exchange, ImplicitAPI):
601
601
  swap = False
602
602
  option = False
603
603
  linear: Bool = None
604
+ inverse: Bool = None
604
605
  baseId = self.safe_string(market, 'base_currency')
605
606
  quoteId = self.safe_string(market, 'quote_currency')
606
607
  base = self.safe_currency_code(baseId)
@@ -623,6 +624,7 @@ class derive(Exchange, ImplicitAPI):
623
624
  symbol = base + '/' + quote + ':' + settle
624
625
  swap = True
625
626
  linear = True
627
+ inverse = False
626
628
  marketType = 'swap'
627
629
  elif type == 'option':
628
630
  settleId = 'USDC'
@@ -639,6 +641,8 @@ class derive(Exchange, ImplicitAPI):
639
641
  optionType = 'put'
640
642
  else:
641
643
  optionType = 'call'
644
+ linear = True
645
+ inverse = False
642
646
  return self.safe_market_structure({
643
647
  'id': marketId,
644
648
  'symbol': symbol,
@@ -657,7 +661,7 @@ class derive(Exchange, ImplicitAPI):
657
661
  'active': self.safe_bool(market, 'is_active'),
658
662
  'contract': (swap or option),
659
663
  'linear': linear,
660
- 'inverse': None,
664
+ 'inverse': inverse,
661
665
  'contractSize': None if (spot) else 1,
662
666
  'expiry': expiry,
663
667
  'expiryDatetime': self.iso8601(expiry),
@@ -1812,7 +1816,7 @@ class derive(Exchange, ImplicitAPI):
1812
1816
  order = self.safe_dict(rawOrder, 'data')
1813
1817
  if order is None:
1814
1818
  order = rawOrder
1815
- timestamp = self.safe_integer(rawOrder, 'nonce')
1819
+ timestamp = self.safe_integer_2(rawOrder, 'creation_timestamp', 'nonce')
1816
1820
  orderId = self.safe_string(order, 'order_id')
1817
1821
  marketId = self.safe_string(order, 'instrument_name')
1818
1822
  if marketId is not None:
@@ -2329,17 +2333,19 @@ class derive(Exchange, ImplicitAPI):
2329
2333
  result: dict = {
2330
2334
  'info': response,
2331
2335
  }
2332
- # TODO:
2333
- # checked multiple subaccounts
2334
- # checked balance after open orders / positions
2335
2336
  for i in range(0, len(response)):
2336
2337
  subaccount = response[i]
2337
2338
  collaterals = self.safe_list(subaccount, 'collaterals', [])
2338
2339
  for j in range(0, len(collaterals)):
2339
2340
  balance = collaterals[j]
2340
2341
  code = self.safe_currency_code(self.safe_string(balance, 'currency'))
2341
- account = self.account()
2342
- account['total'] = self.safe_string(balance, 'amount')
2342
+ account = self.safe_dict(result, code)
2343
+ if account is None:
2344
+ account = self.account()
2345
+ account['total'] = self.safe_string(balance, 'amount')
2346
+ else:
2347
+ amount = self.safe_string(balance, 'amount')
2348
+ account['total'] = Precise.string_add(account['total'], amount)
2343
2349
  result[code] = account
2344
2350
  return self.safe_balance(result)
2345
2351
 
@@ -6364,6 +6364,9 @@ class gate(Exchange, ImplicitAPI):
6364
6364
  if (method == 'GET') or (method == 'DELETE') or requiresURLEncoding or (method == 'PATCH'):
6365
6365
  if query:
6366
6366
  queryString = self.urlencode(query)
6367
+ # https://github.com/ccxt/ccxt/issues/25570
6368
+ if queryString.find('currencies=') >= 0 and queryString.find('%2C') >= 0:
6369
+ queryString = queryString.replace('%2', ',')
6367
6370
  url += '?' + queryString
6368
6371
  if method == 'PATCH':
6369
6372
  body = self.json(query)
@@ -1874,7 +1874,7 @@ class gemini(Exchange, ImplicitAPI):
1874
1874
  raise ExchangeError(feedback) # unknown message
1875
1875
  return None
1876
1876
 
1877
- async def create_deposit_address(self, code: str, params={}):
1877
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1878
1878
  """
1879
1879
  create a currency deposit address
1880
1880
 
@@ -1896,6 +1896,7 @@ class gemini(Exchange, ImplicitAPI):
1896
1896
  'currency': code,
1897
1897
  'address': address,
1898
1898
  'tag': None,
1899
+ 'network': None,
1899
1900
  'info': response,
1900
1901
  }
1901
1902
 
@@ -1020,7 +1020,7 @@ class hitbtc(Exchange, ImplicitAPI):
1020
1020
  }
1021
1021
  return result
1022
1022
 
1023
- async def create_deposit_address(self, code: str, params={}):
1023
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1024
1024
  """
1025
1025
  create a currency deposit address
1026
1026
 
@@ -1898,6 +1898,44 @@ class hyperliquid(Exchange, ImplicitAPI):
1898
1898
  statuses = self.safe_list(dataObject, 'statuses', [])
1899
1899
  return self.parse_orders(statuses)
1900
1900
 
1901
+ async def create_vault(self, name: str, description: str, initialUsd: int, params={}):
1902
+ """
1903
+ creates a value
1904
+ :param str name: The name of the vault
1905
+ :param str description: The description of the vault
1906
+ :param number initialUsd: The initialUsd of the vault
1907
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1908
+ :returns dict: the api result
1909
+ """
1910
+ self.check_required_credentials()
1911
+ await self.load_markets()
1912
+ nonce = self.milliseconds()
1913
+ request: dict = {
1914
+ 'nonce': nonce,
1915
+ }
1916
+ usd = self.parse_to_int(Precise.string_mul(self.number_to_string(initialUsd), '1000000'))
1917
+ action: dict = {
1918
+ 'type': 'createVault',
1919
+ 'name': name,
1920
+ 'description': description,
1921
+ 'initialUsd': usd,
1922
+ 'nonce': nonce,
1923
+ }
1924
+ signature = self.sign_l1_action(action, nonce)
1925
+ request['action'] = action
1926
+ request['signature'] = signature
1927
+ response = await self.privatePostExchange(self.extend(request, params))
1928
+ #
1929
+ # {
1930
+ # "status": "ok",
1931
+ # "response": {
1932
+ # "type": "createVault",
1933
+ # "data": "0x04fddcbc9ce80219301bd16f18491bedf2a8c2b8"
1934
+ # }
1935
+ # }
1936
+ #
1937
+ return response
1938
+
1901
1939
  async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1902
1940
  """
1903
1941
  fetches historical funding rate prices
@@ -2900,7 +2900,7 @@ class kraken(Exchange, ImplicitAPI):
2900
2900
  data[dataLength - 1] = last
2901
2901
  return data
2902
2902
 
2903
- async def create_deposit_address(self, code: str, params={}):
2903
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
2904
2904
  """
2905
2905
  create a currency deposit address
2906
2906