ccxt 4.2.100__py2.py3-none-any.whl → 4.3.2__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.2.100'
25
+ __version__ = '4.3.2'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.100'
7
+ __version__ = '4.3.2'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.2.100'
5
+ __version__ = '4.3.2'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -25,7 +25,7 @@ from ccxt.async_support.base.throttler import Throttler
25
25
  # -----------------------------------------------------------------------------
26
26
 
27
27
  from ccxt.base.errors import BaseError, BadSymbol, BadRequest, BadResponse, ExchangeError, ExchangeNotAvailable, RequestTimeout, NotSupported, NullResponse, InvalidAddress, RateLimitExceeded
28
- from ccxt.base.types import OrderType, OrderSide, OrderRequest
28
+ from ccxt.base.types import OrderType, OrderSide, OrderRequest, CancellationRequest
29
29
 
30
30
  # -----------------------------------------------------------------------------
31
31
 
@@ -1210,6 +1210,9 @@ class Exchange(BaseExchange):
1210
1210
  async def cancel_all_orders(self, symbol: Str = None, params={}):
1211
1211
  raise NotSupported(self.id + ' cancelAllOrders() is not supported yet')
1212
1212
 
1213
+ async def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
1214
+ raise NotSupported(self.id + ' cancelOrdersForSymbols() is not supported yet')
1215
+
1213
1216
  async def cancel_all_orders_ws(self, symbol: Str = None, params={}):
1214
1217
  raise NotSupported(self.id + ' cancelAllOrdersWs() is not supported yet')
1215
1218
 
@@ -8,7 +8,7 @@ from ccxt.abstract.binance import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
+ from ccxt.base.types import Balances, Conversion, Currencies, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import AuthenticationError
@@ -63,6 +63,7 @@ class binance(Exchange, ImplicitAPI):
63
63
  'cancelOrders': True, # contract only
64
64
  'closeAllPositions': False,
65
65
  'closePosition': False, # exchange specific closePosition parameter for binance createOrder is not synonymous with how CCXT uses closePositions
66
+ 'createConvertTrade': True,
66
67
  'createDepositAddress': False,
67
68
  'createLimitBuyOrder': True,
68
69
  'createLimitSellOrder': True,
@@ -11636,3 +11637,56 @@ class binance(Exchange, ImplicitAPI):
11636
11637
  'created': None,
11637
11638
  }
11638
11639
  return result
11640
+
11641
+ async def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
11642
+ """
11643
+ convert from one currency to another
11644
+ :see: https://binance-docs.github.io/apidocs/spot/en/#busd-convert-trade
11645
+ :param str id: the id of the trade that you want to make
11646
+ :param str fromCode: the currency that you want to sell and convert from
11647
+ :param str toCode: the currency that you want to buy and convert into
11648
+ :param float [amount]: how much you want to trade in units of the from currency
11649
+ :param dict [params]: extra parameters specific to the exchange API endpoint
11650
+ :returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
11651
+ """
11652
+ await self.load_markets()
11653
+ request = {
11654
+ 'clientTranId': id,
11655
+ 'asset': fromCode,
11656
+ 'targetAsset': toCode,
11657
+ 'amount': amount,
11658
+ }
11659
+ response = await self.sapiPostAssetConvertTransfer(self.extend(request, params))
11660
+ #
11661
+ # {
11662
+ # "tranId": 118263407119,
11663
+ # "status": "S"
11664
+ # }
11665
+ #
11666
+ fromCurrency = self.currency(fromCode)
11667
+ toCurrency = self.currency(toCode)
11668
+ return self.parse_conversion(response, fromCurrency, toCurrency)
11669
+
11670
+ def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
11671
+ #
11672
+ # createConvertTrade
11673
+ #
11674
+ # {
11675
+ # "tranId": 118263407119,
11676
+ # "status": "S"
11677
+ # }
11678
+ #
11679
+ fromCode = self.safe_currency_code(None, fromCurrency)
11680
+ toCode = self.safe_currency_code(None, toCurrency)
11681
+ return {
11682
+ 'info': conversion,
11683
+ 'timestamp': None,
11684
+ 'datetime': None,
11685
+ 'id': self.safe_string(conversion, 'tranId'),
11686
+ 'fromCurrency': fromCode,
11687
+ 'fromAmount': None,
11688
+ 'toCurrency': toCode,
11689
+ 'toAmount': None,
11690
+ 'price': None,
11691
+ 'fee': None,
11692
+ }
@@ -21,6 +21,7 @@ from ccxt.base.errors import InsufficientFunds
21
21
  from ccxt.base.errors import OrderNotFound
22
22
  from ccxt.base.errors import NotSupported
23
23
  from ccxt.base.errors import DDoSProtection
24
+ from ccxt.base.errors import ExchangeNotAvailable
24
25
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES
25
26
  from ccxt.base.precise import Precise
26
27
 
@@ -398,7 +399,7 @@ class bingx(Exchange, ImplicitAPI):
398
399
  '100400': BadRequest,
399
400
  '100421': BadSymbol, # {"code":100421,"msg":"This pair is currently restricted from API trading","debugMsg":""}
400
401
  '100440': ExchangeError,
401
- '100500': ExchangeError,
402
+ '100500': ExchangeNotAvailable, # {"code":100500,"msg":"The current system is busy, please try again later","debugMsg":""}
402
403
  '100503': ExchangeError,
403
404
  '80001': BadRequest,
404
405
  '80012': InsufficientFunds, # bingx {"code":80012,"msg":"{\"Code\":101253,\"Msg\":\"margin is not enough\"}}
@@ -3718,7 +3719,7 @@ class bingx(Exchange, ImplicitAPI):
3718
3719
  market = None
3719
3720
  if symbol is not None:
3720
3721
  market = self.market(symbol)
3721
- request['symbol'] = symbol
3722
+ request['symbol'] = market['id']
3722
3723
  if since is not None:
3723
3724
  request['startTime'] = since
3724
3725
  if limit is not None:
@@ -59,6 +59,7 @@ class bitget(Exchange, ImplicitAPI):
59
59
  'cancelOrders': True,
60
60
  'closeAllPositions': True,
61
61
  'closePosition': True,
62
+ 'createConvertTrade': True,
62
63
  'createDepositAddress': False,
63
64
  'createMarketBuyOrderWithCost': True,
64
65
  'createMarketOrderWithCost': False,
@@ -7867,8 +7868,8 @@ class bitget(Exchange, ImplicitAPI):
7867
7868
  """
7868
7869
  await self.load_markets()
7869
7870
  request = {
7870
- 'fromCoin': fromCode.upper(),
7871
- 'toCoin': toCode.upper(),
7871
+ 'fromCoin': fromCode,
7872
+ 'toCoin': toCode,
7872
7873
  'fromCoinSize': self.number_to_string(amount),
7873
7874
  }
7874
7875
  response = await self.privateConvertGetV2ConvertQuotedPrice(self.extend(request, params))
@@ -7895,6 +7896,54 @@ class bitget(Exchange, ImplicitAPI):
7895
7896
  toCurrency = self.currency(toCurrencyId)
7896
7897
  return self.parse_conversion(data, fromCurrency, toCurrency)
7897
7898
 
7899
+ async def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
7900
+ """
7901
+ convert from one currency to another
7902
+ :see: https://www.bitget.com/api-doc/common/convert/Trade
7903
+ :param str id: the id of the trade that you want to make
7904
+ :param str fromCode: the currency that you want to sell and convert from
7905
+ :param str toCode: the currency that you want to buy and convert into
7906
+ :param float amount: how much you want to trade in units of the from currency
7907
+ :param dict [params]: extra parameters specific to the exchange API endpoint
7908
+ :param str params['price']: the price of the conversion, obtained from fetchConvertQuote()
7909
+ :param str params['toAmount']: the amount you want to trade in units of the toCurrency, obtained from fetchConvertQuote()
7910
+ :returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
7911
+ """
7912
+ await self.load_markets()
7913
+ price = self.safe_string_2(params, 'price', 'cnvtPrice')
7914
+ if price is None:
7915
+ raise ArgumentsRequired(self.id + ' createConvertTrade() requires a price parameter')
7916
+ toAmount = self.safe_string_2(params, 'toAmount', 'toCoinSize')
7917
+ if toAmount is None:
7918
+ raise ArgumentsRequired(self.id + ' createConvertTrade() requires a toAmount parameter')
7919
+ params = self.omit(params, ['price', 'toAmount'])
7920
+ request = {
7921
+ 'traceId': id,
7922
+ 'fromCoin': fromCode,
7923
+ 'toCoin': toCode,
7924
+ 'fromCoinSize': self.number_to_string(amount),
7925
+ 'toCoinSize': toAmount,
7926
+ 'cnvtPrice': price,
7927
+ }
7928
+ response = await self.privateConvertPostV2ConvertTrade(self.extend(request, params))
7929
+ #
7930
+ # {
7931
+ # "code": "00000",
7932
+ # "msg": "success",
7933
+ # "requestTime": 1712123746203,
7934
+ # "data": {
7935
+ # "cnvtPrice": "0.99940076",
7936
+ # "toCoin": "USDC",
7937
+ # "toCoinSize": "4.99700379",
7938
+ # "ts": "1712123746217"
7939
+ # }
7940
+ # }
7941
+ #
7942
+ data = self.safe_dict(response, 'data', {})
7943
+ toCurrencyId = self.safe_string(data, 'toCoin', toCode)
7944
+ toCurrency = self.currency(toCurrencyId)
7945
+ return self.parse_conversion(data, None, toCurrency)
7946
+
7898
7947
  def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
7899
7948
  #
7900
7949
  # fetchConvertQuote
@@ -7909,6 +7958,15 @@ class bitget(Exchange, ImplicitAPI):
7909
7958
  # "fee": "0"
7910
7959
  # }
7911
7960
  #
7961
+ # createConvertTrade
7962
+ #
7963
+ # {
7964
+ # "cnvtPrice": "0.99940076",
7965
+ # "toCoin": "USDC",
7966
+ # "toCoinSize": "4.99700379",
7967
+ # "ts": "1712123746217"
7968
+ # }
7969
+ #
7912
7970
  timestamp = self.safe_integer(conversion, 'ts')
7913
7971
  fromCoin = self.safe_string(conversion, 'fromCoin')
7914
7972
  fromCode = self.safe_currency_code(fromCoin, fromCurrency)
@@ -7993,6 +8051,8 @@ class bitget(Exchange, ImplicitAPI):
7993
8051
  #
7994
8052
  # spot
7995
8053
  #
8054
+ # {"code":"00000","msg":"success","requestTime":1713294492511,"data":[...]}"
8055
+ #
7996
8056
  # {"status":"fail","err_code":"01001","err_msg":"系统异常,请稍后重试"}
7997
8057
  # {"status":"error","ts":1595594160149,"err_code":"invalid-parameter","err_msg":"invalid size, valid range: [1,2000]"}
7998
8058
  # {"status":"error","ts":1595684716042,"err_code":"invalid-parameter","err_msg":"illegal sign invalid"}
@@ -8014,13 +8074,13 @@ class bitget(Exchange, ImplicitAPI):
8014
8074
  # {"code":"40108","msg":"","requestTime":1595885064600,"data":null}
8015
8075
  # {"order_id":"513468410013679613","client_oid":null,"symbol":"ethusd","result":false,"err_code":"order_no_exist_error","err_msg":"订单不存在!"}
8016
8076
  #
8017
- message = self.safe_string(response, 'err_msg')
8018
- errorCode = self.safe_string_2(response, 'code', 'err_code')
8077
+ message = self.safe_string_2(response, 'err_msg', 'msg')
8019
8078
  feedback = self.id + ' ' + body
8020
- nonEmptyMessage = ((message is not None) and (message != ''))
8079
+ nonEmptyMessage = ((message is not None) and (message != '') and (message != 'success'))
8021
8080
  if nonEmptyMessage:
8022
8081
  self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
8023
8082
  self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
8083
+ errorCode = self.safe_string_2(response, 'code', 'err_code')
8024
8084
  nonZeroErrorCode = (errorCode is not None) and (errorCode != '00000')
8025
8085
  if nonZeroErrorCode:
8026
8086
  self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
@@ -4998,7 +4998,7 @@ class bybit(Exchange, ImplicitAPI):
4998
4998
  coin = self.safe_string(result, 'coin')
4999
4999
  currency = self.currency(coin)
5000
5000
  parsed = self.parse_deposit_addresses(chains, [currency['code']], False, {
5001
- 'currency': currency['id'],
5001
+ 'currency': currency['code'],
5002
5002
  })
5003
5003
  return self.index_by(parsed, 'network')
5004
5004
 
@@ -28,9 +28,10 @@ class coinbase(Exchange, ImplicitAPI):
28
28
  def describe(self):
29
29
  return self.deep_extend(super(coinbase, self).describe(), {
30
30
  'id': 'coinbase',
31
- 'name': 'Coinbase',
31
+ 'name': 'Coinbase Advanced',
32
32
  'countries': ['US'],
33
33
  'pro': True,
34
+ 'certified': True,
34
35
  # rate-limits:
35
36
  # ADVANCED API: https://docs.cloud.coinbase.com/advanced-trade-api/docs/rest-api-rate-limits
36
37
  # - max 30 req/second for private data, 10 req/s for public data
@@ -27,7 +27,7 @@ class coinbasepro(Exchange, ImplicitAPI):
27
27
  def describe(self):
28
28
  return self.deep_extend(super(coinbasepro, self).describe(), {
29
29
  'id': 'coinbasepro',
30
- 'name': 'Coinbase Pro',
30
+ 'name': 'Coinbase Pro(Deprecated)',
31
31
  'countries': ['US'],
32
32
  'rateLimit': 100,
33
33
  'userAgent': self.userAgents['chrome'],