ccxt 4.4.70__py2.py3-none-any.whl → 4.4.72__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 -0
  3. ccxt/abstract/bitmart.py +1 -0
  4. ccxt/abstract/poloniex.py +36 -0
  5. ccxt/ascendex.py +1 -1
  6. ccxt/async_support/__init__.py +1 -3
  7. ccxt/async_support/ascendex.py +1 -1
  8. ccxt/async_support/base/exchange.py +3 -3
  9. ccxt/async_support/binance.py +107 -102
  10. ccxt/async_support/bingx.py +65 -43
  11. ccxt/async_support/bitfinex.py +1 -1
  12. ccxt/async_support/bitfinex1.py +1 -1
  13. ccxt/async_support/bitget.py +0 -3
  14. ccxt/async_support/bitmart.py +12 -1
  15. ccxt/async_support/bitopro.py +1 -0
  16. ccxt/async_support/bitrue.py +1 -0
  17. ccxt/async_support/bl3p.py +2 -2
  18. ccxt/async_support/cex.py +2 -0
  19. ccxt/async_support/coinbase.py +3 -2
  20. ccxt/async_support/coinbaseexchange.py +4 -2
  21. ccxt/async_support/coinbaseinternational.py +3 -2
  22. ccxt/async_support/coinex.py +1 -1
  23. ccxt/async_support/deribit.py +3 -1
  24. ccxt/async_support/derive.py +11 -7
  25. ccxt/async_support/gate.py +3 -0
  26. ccxt/async_support/gemini.py +2 -1
  27. ccxt/async_support/hashkey.py +4 -2
  28. ccxt/async_support/hitbtc.py +1 -1
  29. ccxt/async_support/hyperliquid.py +38 -0
  30. ccxt/async_support/kraken.py +78 -6
  31. ccxt/async_support/krakenfutures.py +4 -0
  32. ccxt/async_support/kucoin.py +5 -3
  33. ccxt/async_support/kuna.py +1 -1
  34. ccxt/async_support/mexc.py +9 -5
  35. ccxt/async_support/ndax.py +1 -1
  36. ccxt/async_support/okcoin.py +4 -0
  37. ccxt/async_support/okx.py +79 -76
  38. ccxt/async_support/paradex.py +65 -7
  39. ccxt/async_support/paymium.py +1 -1
  40. ccxt/async_support/poloniex.py +1265 -86
  41. ccxt/async_support/upbit.py +1 -1
  42. ccxt/async_support/whitebit.py +102 -4
  43. ccxt/async_support/woo.py +3 -1
  44. ccxt/async_support/woofipro.py +1 -1
  45. ccxt/async_support/yobit.py +2 -1
  46. ccxt/base/errors.py +6 -0
  47. ccxt/base/exchange.py +31 -4
  48. ccxt/base/types.py +28 -0
  49. ccxt/binance.py +107 -102
  50. ccxt/bingx.py +65 -43
  51. ccxt/bitfinex.py +1 -1
  52. ccxt/bitfinex1.py +1 -1
  53. ccxt/bitget.py +0 -3
  54. ccxt/bitmart.py +12 -1
  55. ccxt/bitopro.py +1 -0
  56. ccxt/bitrue.py +1 -0
  57. ccxt/bl3p.py +2 -2
  58. ccxt/cex.py +2 -0
  59. ccxt/coinbase.py +3 -2
  60. ccxt/coinbaseexchange.py +4 -2
  61. ccxt/coinbaseinternational.py +3 -2
  62. ccxt/coinex.py +1 -1
  63. ccxt/deribit.py +3 -1
  64. ccxt/derive.py +11 -7
  65. ccxt/gate.py +3 -0
  66. ccxt/gemini.py +2 -1
  67. ccxt/hashkey.py +4 -2
  68. ccxt/hitbtc.py +1 -1
  69. ccxt/hyperliquid.py +38 -0
  70. ccxt/kraken.py +78 -6
  71. ccxt/krakenfutures.py +4 -0
  72. ccxt/kucoin.py +5 -3
  73. ccxt/kuna.py +1 -1
  74. ccxt/mexc.py +9 -5
  75. ccxt/ndax.py +1 -1
  76. ccxt/okcoin.py +4 -0
  77. ccxt/okx.py +79 -76
  78. ccxt/paradex.py +65 -7
  79. ccxt/paymium.py +1 -1
  80. ccxt/poloniex.py +1264 -86
  81. ccxt/pro/__init__.py +1 -3
  82. ccxt/pro/binance.py +102 -102
  83. ccxt/pro/bingx.py +63 -52
  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 +1 -0
  88. ccxt/test/tests_sync.py +1 -0
  89. ccxt/upbit.py +1 -1
  90. ccxt/whitebit.py +102 -4
  91. ccxt/woo.py +3 -1
  92. ccxt/woofipro.py +1 -1
  93. ccxt/yobit.py +2 -1
  94. {ccxt-4.4.70.dist-info → ccxt-4.4.72.dist-info}/METADATA +6 -9
  95. {ccxt-4.4.70.dist-info → ccxt-4.4.72.dist-info}/RECORD +98 -99
  96. ccxt/abstract/poloniexfutures.py +0 -48
  97. {ccxt-4.4.70.dist-info → ccxt-4.4.72.dist-info}/LICENSE.txt +0 -0
  98. {ccxt-4.4.70.dist-info → ccxt-4.4.72.dist-info}/WHEEL +0 -0
  99. {ccxt-4.4.70.dist-info → ccxt-4.4.72.dist-info}/top_level.txt +0 -0
@@ -1886,7 +1886,7 @@ class upbit(Exchange, ImplicitAPI):
1886
1886
  #
1887
1887
  return self.parse_deposit_address(response)
1888
1888
 
1889
- async def create_deposit_address(self, code: str, params={}):
1889
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1890
1890
  """
1891
1891
 
1892
1892
  https://docs.upbit.com/reference/%EC%9E%85%EA%B8%88-%EC%A3%BC%EC%86%8C-%EC%83%9D%EC%84%B1-%EC%9A%94%EC%B2%AD
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.whitebit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Any, Balances, BorrowInterest, Bool, Conversion, Currencies, Currency, DepositAddress, FundingHistory, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Balances, BorrowInterest, Bool, Conversion, CrossBorrowRate, Currencies, Currency, DepositAddress, FundingHistory, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Position, 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
@@ -46,13 +46,16 @@ class whitebit(Exchange, ImplicitAPI):
46
46
  'cancelOrder': True,
47
47
  'cancelOrders': False,
48
48
  'createConvertTrade': True,
49
+ 'createDepositAddress': True,
49
50
  'createMarketBuyOrderWithCost': True,
50
51
  'createMarketOrderWithCost': False,
51
52
  'createMarketSellOrderWithCost': False,
52
53
  'createOrder': True,
54
+ 'createPostOnlyOrder': True,
53
55
  'createStopLimitOrder': True,
54
56
  'createStopMarketOrder': True,
55
57
  'createStopOrder': True,
58
+ 'createTriggerOrder': True,
56
59
  'editOrder': False,
57
60
  'fetchBalance': True,
58
61
  'fetchBorrowRateHistories': False,
@@ -61,7 +64,7 @@ class whitebit(Exchange, ImplicitAPI):
61
64
  'fetchConvertQuote': True,
62
65
  'fetchConvertTrade': False,
63
66
  'fetchConvertTradeHistory': True,
64
- 'fetchCrossBorrowRate': False,
67
+ 'fetchCrossBorrowRate': True,
65
68
  'fetchCrossBorrowRates': False,
66
69
  'fetchCurrencies': True,
67
70
  'fetchDeposit': True,
@@ -1342,9 +1345,11 @@ class whitebit(Exchange, ImplicitAPI):
1342
1345
  :param dict [params]: extra parameters specific to the exchange API endpoint
1343
1346
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1344
1347
  """
1345
- params['cost'] = cost
1348
+ req = {
1349
+ 'cost': cost,
1350
+ }
1346
1351
  # only buy side is supported
1347
- return await self.create_order(symbol, 'market', side, 0, None, params)
1352
+ return await self.create_order(symbol, 'market', side, 0, None, self.extend(req, params))
1348
1353
 
1349
1354
  async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}) -> Order:
1350
1355
  """
@@ -1373,6 +1378,10 @@ class whitebit(Exchange, ImplicitAPI):
1373
1378
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1374
1379
  :param dict [params]: extra parameters specific to the exchange API endpoint
1375
1380
  :param float [params.cost]: *market orders only* the cost of the order in units of the base currency
1381
+ :param float [params.triggerPrice]: The price at which a trigger order is triggered at
1382
+ :param bool [params.postOnly]: If True, the order will only be posted to the order book and not executed immediately
1383
+ :param str [params.clientOrderId]: a unique id for the order
1384
+ :param str [params.marginMode]: 'cross' or 'isolated', for margin trading, uses self.options.defaultMarginMode if not passed, defaults to None/None/None
1376
1385
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1377
1386
  """
1378
1387
  await self.load_markets()
@@ -1999,6 +2008,60 @@ class whitebit(Exchange, ImplicitAPI):
1999
2008
  'tag': tag,
2000
2009
  }
2001
2010
 
2011
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
2012
+ """
2013
+ create a currency deposit address
2014
+
2015
+ https://docs.whitebit.com/private/http-main-v4/#create-new-address-for-deposit
2016
+
2017
+ :param str code: unified currency code of the currency for the deposit address
2018
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2019
+ :param str [params.network]: the blockchain network to create a deposit address on
2020
+ :param str [params.type]: address type, available for specific currencies
2021
+ :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
2022
+ """
2023
+ await self.load_markets()
2024
+ currency = self.currency(code)
2025
+ request: dict = {
2026
+ 'ticker': currency['id'],
2027
+ }
2028
+ response = await self.v4PrivatePostMainAccountCreateNewAddress(self.extend(request, params))
2029
+ #
2030
+ # {
2031
+ # "account": {
2032
+ # "address": "GDTSOI56XNVAKJNJBLJGRNZIVOCIZJRBIDKTWSCYEYNFAZEMBLN75RMN",
2033
+ # "memo": "48565488244493"
2034
+ # },
2035
+ # "required": {
2036
+ # "maxAmount": "0",
2037
+ # "minAmount": "1",
2038
+ # "fixedFee": "0",
2039
+ # "flexFee": {
2040
+ # "maxFee": "0",
2041
+ # "minFee": "0",
2042
+ # "percent": "0"
2043
+ # }
2044
+ # }
2045
+ # }
2046
+ #
2047
+ data = self.safe_dict(response, 'account', {})
2048
+ return self.parse_deposit_address(data, currency)
2049
+
2050
+ def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
2051
+ #
2052
+ # {
2053
+ # "address": "GDTSOI56XNVAKJNJBLJGRNZIVOCIZJRBIDKTWSCYEYNFAZEMBLN75RMN",
2054
+ # "memo": "48565488244493"
2055
+ # },
2056
+ #
2057
+ return {
2058
+ 'info': depositAddress,
2059
+ 'currency': self.safe_currency_code(None, currency),
2060
+ 'network': None,
2061
+ 'address': self.safe_string(depositAddress, 'address'),
2062
+ 'tag': self.safe_string(depositAddress, 'memo'),
2063
+ }
2064
+
2002
2065
  async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
2003
2066
  """
2004
2067
  set the level of leverage for a market
@@ -3067,6 +3130,41 @@ class whitebit(Exchange, ImplicitAPI):
3067
3130
  'takeProfitPrice': self.safe_number(tpsl, 'takeProfit'),
3068
3131
  })
3069
3132
 
3133
+ async def fetch_cross_borrow_rate(self, code: str, params={}) -> CrossBorrowRate:
3134
+ """
3135
+ fetch the rate of interest to borrow a currency for margin trading
3136
+
3137
+ https://docs.whitebit.com/private/http-main-v4/#get-plans
3138
+
3139
+ :param str code: unified currency code
3140
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3141
+ :returns dict: a `borrow rate structure <https://docs.ccxt.com/#/?id=borrow-rate-structure>`
3142
+ """
3143
+ await self.load_markets()
3144
+ currency = self.currency(code)
3145
+ request: dict = {
3146
+ 'ticker': currency['id'],
3147
+ }
3148
+ response = await self.v4PrivatePostMainAccountSmartPlans(self.extend(request, params))
3149
+ #
3150
+ #
3151
+ data = self.safe_list(response, 0, [])
3152
+ return self.parse_borrow_rate(data, currency)
3153
+
3154
+ def parse_borrow_rate(self, info, currency: Currency = None):
3155
+ #
3156
+ #
3157
+ currencyId = self.safe_string(info, 'ticker')
3158
+ percent = self.safe_string(info, 'percent')
3159
+ return {
3160
+ 'currency': self.safe_currency_code(currencyId, currency),
3161
+ 'rate': self.parse_number(Precise.string_div(percent, '100')),
3162
+ 'period': self.safe_integer(info, 'duration'),
3163
+ 'timestamp': None,
3164
+ 'datetime': None,
3165
+ 'info': info,
3166
+ }
3167
+
3070
3168
  def is_fiat(self, currency: str) -> bool:
3071
3169
  fiatCurrencies = self.safe_value(self.options, 'fiatCurrencies', [])
3072
3170
  return self.in_array(currency, fiatCurrencies)
ccxt/async_support/woo.py CHANGED
@@ -563,6 +563,7 @@ class woo(Exchange, ImplicitAPI):
563
563
  symbol = base + '/' + quote
564
564
  contractSize: Num = None
565
565
  linear: Bool = None
566
+ inverse: Bool = None
566
567
  margin = True
567
568
  contract = swap
568
569
  if contract:
@@ -572,6 +573,7 @@ class woo(Exchange, ImplicitAPI):
572
573
  symbol = base + '/' + quote + ':' + settle
573
574
  contractSize = self.parse_number('1')
574
575
  linear = True
576
+ inverse = False
575
577
  return {
576
578
  'id': marketId,
577
579
  'symbol': symbol,
@@ -590,7 +592,7 @@ class woo(Exchange, ImplicitAPI):
590
592
  'active': self.safe_string(market, 'is_trading') == '1',
591
593
  'contract': contract,
592
594
  'linear': linear,
593
- 'inverse': None,
595
+ 'inverse': inverse,
594
596
  'contractSize': contractSize,
595
597
  'expiry': None,
596
598
  'expiryDatetime': None,
@@ -548,7 +548,7 @@ class woofipro(Exchange, ImplicitAPI):
548
548
  'active': None,
549
549
  'contract': True,
550
550
  'linear': True,
551
- 'inverse': None,
551
+ 'inverse': False,
552
552
  'contractSize': self.parse_number('1'),
553
553
  'expiry': None,
554
554
  'expiryDatetime': None,
@@ -1217,7 +1217,7 @@ class yobit(Exchange, ImplicitAPI):
1217
1217
  result.append(trade)
1218
1218
  return self.filter_by_symbol_since_limit(result, market['symbol'], since, limit)
1219
1219
 
1220
- async def create_deposit_address(self, code: str, params={}):
1220
+ async def create_deposit_address(self, code: str, params={}) -> DepositAddress:
1221
1221
  """
1222
1222
 
1223
1223
  https://yobit.net/en/api
@@ -1237,6 +1237,7 @@ class yobit(Exchange, ImplicitAPI):
1237
1237
  'currency': code,
1238
1238
  'address': address,
1239
1239
  'tag': None,
1240
+ 'network': None,
1240
1241
  'info': response['info'],
1241
1242
  }
1242
1243
 
ccxt/base/errors.py CHANGED
@@ -1,3 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+
3
+ # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ # EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
1
7
  error_hierarchy = {
2
8
  'BaseError': {
3
9
  'ExchangeError': {
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.70'
7
+ __version__ = '4.4.72'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -33,7 +33,7 @@ from ccxt.base.decimal_to_precision import decimal_to_precision
33
33
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES, TICK_SIZE, NO_PADDING, TRUNCATE, ROUND, ROUND_UP, ROUND_DOWN, SIGNIFICANT_DIGITS
34
34
  from ccxt.base.decimal_to_precision import number_to_string
35
35
  from ccxt.base.precise import Precise
36
- from ccxt.base.types import BalanceAccount, Currency, IndexType, OrderSide, OrderType, Trade, OrderRequest, Market, MarketType, Str, Num, Strings, CancellationRequest, Bool
36
+ from ccxt.base.types import ConstructorArgs, BalanceAccount, Currency, IndexType, OrderSide, OrderType, Trade, OrderRequest, Market, MarketType, Str, Num, Strings, CancellationRequest, Bool
37
37
 
38
38
  # -----------------------------------------------------------------------------
39
39
 
@@ -369,7 +369,7 @@ class Exchange(object):
369
369
  }
370
370
  synchronous = True
371
371
 
372
- def __init__(self, config={}):
372
+ def __init__(self, config: ConstructorArgs = {}):
373
373
  self.aiohttp_trust_env = self.aiohttp_trust_env or self.trust_env
374
374
  self.requests_trust_env = self.requests_trust_env or self.trust_env
375
375
 
@@ -410,6 +410,9 @@ class Exchange(object):
410
410
 
411
411
  self.after_construct()
412
412
 
413
+ if self.safe_bool(config, 'sandbox') or self.safe_bool(config, 'testnet'):
414
+ self.set_sandbox_mode(True)
415
+
413
416
  # convert all properties from underscore notation foo_bar to camelcase notation fooBar
414
417
  cls = type(self)
415
418
  for name in dir(self):
@@ -2918,7 +2921,8 @@ class Exchange(object):
2918
2921
  length = len(keys)
2919
2922
  if length != 0:
2920
2923
  for i in range(0, length):
2921
- network = networks[keys[i]]
2924
+ key = keys[i]
2925
+ network = networks[key]
2922
2926
  deposit = self.safe_bool(network, 'deposit')
2923
2927
  if currencyDeposit is None or deposit:
2924
2928
  currency['deposit'] = deposit
@@ -2928,6 +2932,12 @@ class Exchange(object):
2928
2932
  active = self.safe_bool(network, 'active')
2929
2933
  if currencyActive is None or active:
2930
2934
  currency['active'] = active
2935
+ # set network 'active' to False if D or W is disabled
2936
+ if self.safe_bool(network, 'active') is None:
2937
+ if deposit and withdraw:
2938
+ currency['networks'][key]['active'] = True
2939
+ elif deposit is not None and withdraw is not None:
2940
+ currency['networks'][key]['active'] = False
2931
2941
  # find lowest fee(which is more desired)
2932
2942
  fee = self.safe_string(network, 'fee')
2933
2943
  feeMain = self.safe_string(currency, 'fee')
@@ -4286,6 +4296,23 @@ class Exchange(object):
4286
4296
  params = self.omit(params, [paramName1, paramName2])
4287
4297
  return [value, params]
4288
4298
 
4299
+ def handle_request_network(self, params: dict, request: dict, exchangeSpecificKey: str, currencyCode: Str = None, isRequired: bool = False):
4300
+ """
4301
+ :param dict params: - extra parameters
4302
+ :param dict request: - existing dictionary of request
4303
+ :param str exchangeSpecificKey: - the key for chain id to be set in request
4304
+ :param dict currencyCode: - (optional) existing dictionary of request
4305
+ :param boolean isRequired: - (optional) whether that param is required to be present
4306
+ :returns dict[]: - returns [request, params] where request is the modified request object and params is the modified params object
4307
+ """
4308
+ networkCode = None
4309
+ networkCode, params = self.handle_network_code_and_params(params)
4310
+ if networkCode is not None:
4311
+ request[exchangeSpecificKey] = self.network_code_to_id(networkCode, currencyCode)
4312
+ elif isRequired:
4313
+ raise ArgumentsRequired(self.id + ' - "network" param is required for self request')
4314
+ return [request, params]
4315
+
4289
4316
  def resolve_path(self, path, params):
4290
4317
  return [
4291
4318
  self.implode_params(path, params),
ccxt/base/types.py CHANGED
@@ -575,3 +575,31 @@ LeverageTiers = Dict[Str, List[LeverageTier]]
575
575
 
576
576
  Market = Optional[MarketInterface]
577
577
  Currency = Optional[CurrencyInterface]
578
+
579
+ class ConstructorArgs(TypedDict, total=False):
580
+ apiKey: str
581
+ secret: str
582
+ passphrase: str
583
+ password: str
584
+ privateKey: str
585
+ walletAddress: str
586
+ uid: str
587
+ verbose: bool
588
+ testnet: bool
589
+ sandbox: bool # redudant but kept for backwards compatibility
590
+ options: Dict[str, Any]
591
+ enableRateLimit: bool
592
+ httpsProxy: str
593
+ socksProxy: str
594
+ wssProxy: str
595
+ proxy: str
596
+ rateLimit: Num
597
+ commonCurrencies: Dict[str, Any]
598
+ userAgent: str
599
+ userAgents: Dict[str, Any]
600
+ timeout: Num
601
+ markets: Dict[str, Any]
602
+ currencies: Dict[str, Any]
603
+ hostname: str
604
+ urls: Dict[str, Any]
605
+ headers: Dict[str, Any]