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

Files changed (56) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/phemex.py +1 -0
  3. ccxt/async_support/__init__.py +1 -1
  4. ccxt/async_support/base/exchange.py +3 -3
  5. ccxt/async_support/bigone.py +8 -1
  6. ccxt/async_support/binance.py +1 -1
  7. ccxt/async_support/bitforex.py +2 -0
  8. ccxt/async_support/bitget.py +9 -4
  9. ccxt/async_support/bitmex.py +2 -0
  10. ccxt/async_support/blockchaincom.py +0 -37
  11. ccxt/async_support/bybit.py +23 -14
  12. ccxt/async_support/coinex.py +12 -0
  13. ccxt/async_support/coinlist.py +2 -0
  14. ccxt/async_support/coinsph.py +2 -0
  15. ccxt/async_support/cryptocom.py +2 -0
  16. ccxt/async_support/gate.py +258 -11
  17. ccxt/async_support/htx.py +223 -207
  18. ccxt/async_support/kuna.py +2 -0
  19. ccxt/async_support/mexc.py +2 -0
  20. ccxt/async_support/okcoin.py +56 -16
  21. ccxt/async_support/phemex.py +151 -28
  22. ccxt/async_support/poloniex.py +23 -2
  23. ccxt/async_support/tokocrypto.py +25 -12
  24. ccxt/async_support/wazirx.py +2 -0
  25. ccxt/async_support/whitebit.py +2 -0
  26. ccxt/async_support/woo.py +38 -12
  27. ccxt/base/exchange.py +3 -3
  28. ccxt/bigone.py +8 -1
  29. ccxt/binance.py +1 -1
  30. ccxt/bitforex.py +2 -0
  31. ccxt/bitget.py +9 -4
  32. ccxt/bitmex.py +2 -0
  33. ccxt/blockchaincom.py +0 -37
  34. ccxt/bybit.py +23 -14
  35. ccxt/coinex.py +12 -0
  36. ccxt/coinlist.py +2 -0
  37. ccxt/coinsph.py +2 -0
  38. ccxt/cryptocom.py +2 -0
  39. ccxt/gate.py +258 -11
  40. ccxt/htx.py +223 -207
  41. ccxt/kuna.py +2 -0
  42. ccxt/mexc.py +2 -0
  43. ccxt/okcoin.py +56 -16
  44. ccxt/phemex.py +151 -28
  45. ccxt/poloniex.py +23 -2
  46. ccxt/pro/__init__.py +1 -1
  47. ccxt/pro/binance.py +6 -6
  48. ccxt/pro/poloniex.py +15 -11
  49. ccxt/tokocrypto.py +25 -12
  50. ccxt/wazirx.py +2 -0
  51. ccxt/whitebit.py +2 -0
  52. ccxt/woo.py +38 -12
  53. {ccxt-4.1.88.dist-info → ccxt-4.1.90.dist-info}/METADATA +5 -5
  54. {ccxt-4.1.88.dist-info → ccxt-4.1.90.dist-info}/RECORD +56 -56
  55. {ccxt-4.1.88.dist-info → ccxt-4.1.90.dist-info}/WHEEL +0 -0
  56. {ccxt-4.1.88.dist-info → ccxt-4.1.90.dist-info}/top_level.txt +0 -0
ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.1.88'
25
+ __version__ = '4.1.90'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/phemex.py CHANGED
@@ -23,6 +23,7 @@ class ImplicitAPI:
23
23
  v1_get_md_spot_ticker_24hr_all = v1GetMdSpotTicker24hrAll = Entry('md/spot/ticker/24hr/all', 'v1', 'GET', {'cost': 5})
24
24
  v1_get_exchange_public_products = v1GetExchangePublicProducts = Entry('exchange/public/products', 'v1', 'GET', {'cost': 5})
25
25
  v1_get_api_data_public_data_funding_rate_history = v1GetApiDataPublicDataFundingRateHistory = Entry('api-data/public/data/funding-rate-history', 'v1', 'GET', {'cost': 5})
26
+ v2_get_public_products = v2GetPublicProducts = Entry('public/products', 'v2', 'GET', {'cost': 5})
26
27
  v2_get_md_v2_orderbook = v2GetMdV2Orderbook = Entry('md/v2/orderbook', 'v2', 'GET', {'cost': 5})
27
28
  v2_get_md_v2_trade = v2GetMdV2Trade = Entry('md/v2/trade', 'v2', 'GET', {'cost': 5})
28
29
  v2_get_md_v2_ticker_24hr = v2GetMdV2Ticker24hr = Entry('md/v2/ticker/24hr', 'v2', 'GET', {'cost': 5})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.1.88'
7
+ __version__ = '4.1.90'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.1.88'
5
+ __version__ = '4.1.90'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -930,7 +930,7 @@ class Exchange(BaseExchange):
930
930
  :param dict [params]: extra parameters specific to the exchange API endpoint
931
931
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
932
932
  """
933
- if self.options['createMarketOrderWithCost'] or (self.options['createMarketBuyOrderWithCost'] and self.options['createMarketSellOrderWithCost']):
933
+ if self.has['createMarketOrderWithCost'] or (self.has['createMarketBuyOrderWithCost'] and self.has['createMarketSellOrderWithCost']):
934
934
  return await self.create_order(symbol, 'market', side, cost, 1, params)
935
935
  raise NotSupported(self.id + ' createMarketOrderWithCost() is not supported yet')
936
936
 
@@ -942,7 +942,7 @@ class Exchange(BaseExchange):
942
942
  :param dict [params]: extra parameters specific to the exchange API endpoint
943
943
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
944
944
  """
945
- if self.options['createMarketBuyOrderRequiresPrice'] or self.options['createMarketBuyOrderWithCost']:
945
+ if self.options['createMarketBuyOrderRequiresPrice'] or self.has['createMarketBuyOrderWithCost']:
946
946
  return await self.create_order(symbol, 'market', 'buy', cost, 1, params)
947
947
  raise NotSupported(self.id + ' createMarketBuyOrderWithCost() is not supported yet')
948
948
 
@@ -14,6 +14,7 @@ from ccxt.base.errors import BadRequest
14
14
  from ccxt.base.errors import BadSymbol
15
15
  from ccxt.base.errors import InsufficientFunds
16
16
  from ccxt.base.errors import InvalidOrder
17
+ from ccxt.base.errors import NotSupported
17
18
  from ccxt.base.errors import RateLimitExceeded
18
19
  from ccxt.base.errors import AuthenticationError
19
20
  from ccxt.base.decimal_to_precision import TICK_SIZE
@@ -39,6 +40,7 @@ class bigone(Exchange, ImplicitAPI):
39
40
  'cancelAllOrders': True,
40
41
  'cancelOrder': True,
41
42
  'createMarketBuyOrderWithCost': True,
43
+ 'createMarketOrderWithCost': False,
42
44
  'createMarketSellOrderWithCost': False,
43
45
  'createOrder': True,
44
46
  'createPostOnlyOrder': True,
@@ -1108,13 +1110,17 @@ class bigone(Exchange, ImplicitAPI):
1108
1110
 
1109
1111
  async def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
1110
1112
  """
1111
- :see: https://open.big.one/docs/spot_orders.html#create-order
1112
1113
  create a market buy order by providing the symbol and cost
1114
+ :see: https://open.big.one/docs/spot_orders.html#create-order
1113
1115
  :param str symbol: unified symbol of the market to create an order in
1114
1116
  :param float cost: how much you want to trade in units of the quote currency
1115
1117
  :param dict [params]: extra parameters specific to the exchange API endpoint
1116
1118
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1117
1119
  """
1120
+ await self.load_markets()
1121
+ market = self.market(symbol)
1122
+ if not market['spot']:
1123
+ raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
1118
1124
  params['createMarketBuyOrderRequiresPrice'] = False
1119
1125
  return await self.create_order(symbol, 'market', 'buy', cost, None, params)
1120
1126
 
@@ -1131,6 +1137,7 @@ class bigone(Exchange, ImplicitAPI):
1131
1137
  :param float [params.triggerPrice]: the price at which a trigger order is triggered at
1132
1138
  :param bool [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately
1133
1139
  :param str [params.timeInForce]: "GTC", "IOC", or "PO"
1140
+ :param float [params.cost]: *spot market buy only* the quote quantity that can be used alternative for the amount
1134
1141
  *
1135
1142
  * EXCHANGE SPECIFIC PARAMETERS
1136
1143
  :param str operator: *stop order only* GTE or LTE(default)
@@ -61,7 +61,7 @@ class binance(Exchange, ImplicitAPI):
61
61
  'cancelOrder': True,
62
62
  'cancelOrders': True, # contract only
63
63
  'closeAllPositions': False,
64
- 'closePosition': False,
64
+ 'closePosition': False, # exchange specific closePosition parameter for binance createOrder is not synonymous with how CCXT uses closePositions
65
65
  'createDepositAddress': False,
66
66
  'createOrder': True,
67
67
  'createOrders': True,
@@ -84,6 +84,8 @@ class bitforex(Exchange, ImplicitAPI):
84
84
  'fetchWithdrawal': False,
85
85
  'fetchWithdrawals': False,
86
86
  'reduceMargin': False,
87
+ 'repayCrossMargin': False,
88
+ 'repayIsolatedMargin': False,
87
89
  'setLeverage': False,
88
90
  'setMargin': False,
89
91
  'setMarginMode': False,
@@ -3719,17 +3719,22 @@ class bitget(Exchange, ImplicitAPI):
3719
3719
  if feeCostString is not None:
3720
3720
  # swap
3721
3721
  fee = {
3722
- 'cost': feeCostString,
3722
+ 'cost': self.parse_number(Precise.string_abs(feeCostString)),
3723
3723
  'currency': market['settle'],
3724
3724
  }
3725
3725
  feeDetail = self.safe_value(order, 'feeDetail')
3726
3726
  if feeDetail is not None:
3727
3727
  parsedFeeDetail = json.loads(feeDetail)
3728
3728
  feeValues = list(parsedFeeDetail.values())
3729
- first = self.safe_value(feeValues, 0)
3729
+ feeObject = None
3730
+ for i in range(0, len(feeValues)):
3731
+ feeValue = feeValues[i]
3732
+ if self.safe_value(feeValue, 'feeCoinCode') is not None:
3733
+ feeObject = feeValue
3734
+ break
3730
3735
  fee = {
3731
- 'cost': self.safe_string(first, 'totalFee'),
3732
- 'currency': self.safe_currency_code(self.safe_string(first, 'feeCoinCode')),
3736
+ 'cost': self.parse_number(Precise.string_abs(self.safe_string(feeObject, 'totalFee'))),
3737
+ 'currency': self.safe_currency_code(self.safe_string(feeObject, 'feeCoinCode')),
3733
3738
  }
3734
3739
  postOnly = None
3735
3740
  timeInForce = self.safe_string_upper(order, 'force')
@@ -50,6 +50,8 @@ class bitmex(Exchange, ImplicitAPI):
50
50
  'cancelAllOrders': True,
51
51
  'cancelOrder': True,
52
52
  'cancelOrders': True,
53
+ 'closeAllPositions': False,
54
+ 'closePosition': True,
53
55
  'createOrder': True,
54
56
  'createReduceOnlyOrder': True,
55
57
  'editOrder': True,
@@ -857,43 +857,6 @@ class blockchaincom(Exchange, ImplicitAPI):
857
857
  'fee': fee,
858
858
  }
859
859
 
860
- async def fetch_withdrawal_whitelist(self, params={}):
861
- """
862
- fetch the list of withdrawal addresses on the whitelist
863
- :param dict [params]: extra parameters specific to the exchange API endpoint
864
- :returns dict: dictionary with keys beneficiaryId, name, currency
865
- """
866
- await self.load_markets()
867
- response = await self.privateGetWhitelist()
868
- result = []
869
- for i in range(0, len(response)):
870
- entry = response[i]
871
- result.append({
872
- 'beneficiaryId': self.safe_string(entry, 'whitelistId'),
873
- 'name': self.safe_string(entry, 'name'),
874
- 'currency': self.safe_string(entry, 'currency'),
875
- 'info': entry,
876
- })
877
- return result
878
-
879
- async def fetch_withdrawal_whitelist_by_currency(self, code: str, params={}):
880
- await self.load_markets()
881
- currency = self.currency(code)
882
- request = {
883
- 'currency': currency['id'],
884
- }
885
- response = await self.privateGetWhitelistCurrency(self.extend(request, params))
886
- result = []
887
- for i in range(0, len(response)):
888
- entry = response[i]
889
- result.append({
890
- 'beneficiaryId': self.safe_string(entry, 'whitelistId'),
891
- 'name': self.safe_string(entry, 'name'),
892
- 'currency': self.safe_string(entry, 'currency'),
893
- 'info': entry,
894
- })
895
- return result
896
-
897
860
  async def withdraw(self, code: str, amount, address, tag=None, params={}):
898
861
  """
899
862
  make a withdrawal
@@ -960,6 +960,7 @@ class bybit(Exchange, ImplicitAPI):
960
960
  },
961
961
  'precisionMode': TICK_SIZE,
962
962
  'options': {
963
+ 'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
963
964
  'enableUnifiedMargin': None,
964
965
  'enableUnifiedAccount': None,
965
966
  'createMarketBuyOrderRequiresPrice': True,
@@ -1426,21 +1427,29 @@ class bybit(Exchange, ImplicitAPI):
1426
1427
  """
1427
1428
  if self.options['adjustForTimeDifference']:
1428
1429
  await self.load_time_difference()
1429
- promisesUnresolved = [
1430
- self.fetch_spot_markets(params),
1431
- self.fetch_future_markets({'category': 'linear'}),
1432
- self.fetch_future_markets({'category': 'inverse'}),
1433
- self.fetch_option_markets({'baseCoin': 'BTC'}),
1434
- self.fetch_option_markets({'baseCoin': 'ETH'}),
1435
- self.fetch_option_markets({'baseCoin': 'SOL'}),
1436
- ]
1430
+ promisesUnresolved = []
1431
+ fetchMarkets = self.safe_value(self.options, 'fetchMarkets', ['spot', 'linear', 'inverse'])
1432
+ for i in range(0, len(fetchMarkets)):
1433
+ marketType = fetchMarkets[i]
1434
+ if marketType == 'spot':
1435
+ promisesUnresolved.append(self.fetch_spot_markets(params))
1436
+ elif marketType == 'linear':
1437
+ promisesUnresolved.append(self.fetch_future_markets({'category': 'linear'}))
1438
+ elif marketType == 'inverse':
1439
+ promisesUnresolved.append(self.fetch_future_markets({'category': 'inverse'}))
1440
+ elif marketType == 'option':
1441
+ promisesUnresolved.append(self.fetch_option_markets({'baseCoin': 'BTC'}))
1442
+ promisesUnresolved.append(self.fetch_option_markets({'baseCoin': 'ETH'}))
1443
+ promisesUnresolved.append(self.fetch_option_markets({'baseCoin': 'SOL'}))
1444
+ else:
1445
+ raise ExchangeError(self.id + ' fetchMarkets() self.options fetchMarkets "' + marketType + '" is not a supported market type')
1437
1446
  promises = await asyncio.gather(*promisesUnresolved)
1438
- spotMarkets = promises[0]
1439
- linearMarkets = promises[1]
1440
- inverseMarkets = promises[2]
1441
- btcOptionMarkets = promises[3]
1442
- ethOptionMarkets = promises[4]
1443
- solOptionMarkets = promises[5]
1447
+ spotMarkets = self.safe_value(promises, 0, [])
1448
+ linearMarkets = self.safe_value(promises, 1, [])
1449
+ inverseMarkets = self.safe_value(promises, 2, [])
1450
+ btcOptionMarkets = self.safe_value(promises, 3, [])
1451
+ ethOptionMarkets = self.safe_value(promises, 4, [])
1452
+ solOptionMarkets = self.safe_value(promises, 5, [])
1444
1453
  futureMarkets = self.array_concat(linearMarkets, inverseMarkets)
1445
1454
  optionMarkets = self.array_concat(btcOptionMarkets, ethOptionMarkets)
1446
1455
  optionMarkets = self.array_concat(optionMarkets, solOptionMarkets)
@@ -59,6 +59,8 @@ class coinex(Exchange, ImplicitAPI):
59
59
  'cancelOrders': True,
60
60
  'createDepositAddress': True,
61
61
  'createMarketBuyOrderWithCost': True,
62
+ 'createMarketOrderWithCost': False,
63
+ 'createMarketSellOrderWithCost': False,
62
64
  'createOrder': True,
63
65
  'createOrders': True,
64
66
  'createReduceOnlyOrder': True,
@@ -1867,11 +1869,16 @@ class coinex(Exchange, ImplicitAPI):
1867
1869
  async def create_market_buy_order_with_cost(self, symbol: str, cost, params={}):
1868
1870
  """
1869
1871
  create a market buy order by providing the symbol and cost
1872
+ :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade003_market_order
1870
1873
  :param str symbol: unified symbol of the market to create an order in
1871
1874
  :param float cost: how much you want to trade in units of the quote currency
1872
1875
  :param dict [params]: extra parameters specific to the exchange API endpoint
1873
1876
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1874
1877
  """
1878
+ await self.load_markets()
1879
+ market = self.market(symbol)
1880
+ if not market['spot']:
1881
+ raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
1875
1882
  params['createMarketBuyOrderRequiresPrice'] = False
1876
1883
  return await self.create_order(symbol, 'market', 'buy', cost, None, params)
1877
1884
 
@@ -1993,6 +2000,11 @@ class coinex(Exchange, ImplicitAPI):
1993
2000
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
1994
2001
  """
1995
2002
  create a trade order
2003
+ :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade001_limit_order
2004
+ :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade003_market_order
2005
+ :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade004_IOC_order
2006
+ :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade005_stop_limit_order
2007
+ :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade006_stop_market_order
1996
2008
  :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http017_put_limit
1997
2009
  :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http018_put_market
1998
2010
  :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http019_put_limit_stop
@@ -122,6 +122,8 @@ class coinlist(Exchange, ImplicitAPI):
122
122
  'fetchWithdrawals': False,
123
123
  'fetchWithdrawalWhitelist': False,
124
124
  'reduceMargin': False,
125
+ 'repayCrossMargin': False,
126
+ 'repayIsolatedMargin': False,
125
127
  'setLeverage': False,
126
128
  'setMargin': False,
127
129
  'setMarginMode': False,
@@ -127,6 +127,8 @@ class coinsph(Exchange, ImplicitAPI):
127
127
  'fetchWithdrawals': True,
128
128
  'fetchWithdrawalWhitelist': False,
129
129
  'reduceMargin': False,
130
+ 'repayCrossMargin': False,
131
+ 'repayIsolatedMargin': False,
130
132
  'setLeverage': False,
131
133
  'setMargin': False,
132
134
  'setMarginMode': False,
@@ -111,6 +111,8 @@ class cryptocom(Exchange, ImplicitAPI):
111
111
  'fetchVolatilityHistory': False,
112
112
  'fetchWithdrawals': True,
113
113
  'reduceMargin': False,
114
+ 'repayCrossMargin': False,
115
+ 'repayIsolatedMargin': False,
114
116
  'setLeverage': False,
115
117
  'setMarginMode': False,
116
118
  'setPositionMode': False,