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

@@ -4490,6 +4490,7 @@ class kucoin(Exchange, ImplicitAPI):
4490
4490
  partnerSignature = self.hmac(self.encode(partnerPayload), self.encode(partnerSecret), hashlib.sha256, 'base64')
4491
4491
  headers['KC-API-PARTNER-SIGN'] = partnerSignature
4492
4492
  headers['KC-API-PARTNER'] = partnerId
4493
+ headers['KC-API-PARTNER-VERIFY'] = 'true'
4493
4494
  if isBroker:
4494
4495
  brokerName = self.safe_string(partner, 'name')
4495
4496
  if brokerName is not None:
@@ -3638,7 +3638,8 @@ class phemex(Exchange, ImplicitAPI):
3638
3638
  raise BadRequest(self.id + ' fetchFundingHistory() limit argument cannot exceed 200')
3639
3639
  request['limit'] = limit
3640
3640
  response = None
3641
- if market['settle'] == 'USDT':
3641
+ isUsdt = market['settle'] == 'USDT'
3642
+ if isUsdt:
3642
3643
  response = await self.privateGetApiDataGFuturesFundingFees(self.extend(request, params))
3643
3644
  else:
3644
3645
  response = await self.privateGetApiDataFuturesFundingFees(self.extend(request, params))
@@ -3651,13 +3652,13 @@ class phemex(Exchange, ImplicitAPI):
3651
3652
  # {
3652
3653
  # "symbol": "BTCUSD",
3653
3654
  # "currency": "BTC",
3654
- # "execQty": 18,
3655
+ # "execQty": 18, # "execQty" regular, but "execQtyRq" in hedge
3655
3656
  # "side": "Buy",
3656
- # "execPriceEp": 360086455,
3657
- # "execValueEv": 49987,
3658
- # "fundingRateEr": 10000,
3659
- # "feeRateEr": 10000,
3660
- # "execFeeEv": 5,
3657
+ # "execPriceEp": 360086455, # "execPriceEp" regular, but "execPriceRp" in hedge
3658
+ # "execValueEv": 49987, # "execValueEv" regular, but "execValueRv" in hedge
3659
+ # "fundingRateEr": 10000, # "fundingRateEr" regular, but "fundingRateRr" in hedge
3660
+ # "feeRateEr": 10000, # "feeRateEr" regular, but "feeRateRr" in hedge
3661
+ # "execFeeEv": 5, # "execFeeEv" regular, but "execFeeRv" in hedge
3661
3662
  # "createTime": 1651881600000
3662
3663
  # }
3663
3664
  # ]
@@ -3670,17 +3671,31 @@ class phemex(Exchange, ImplicitAPI):
3670
3671
  for i in range(0, len(rows)):
3671
3672
  entry = rows[i]
3672
3673
  timestamp = self.safe_integer(entry, 'createTime')
3674
+ execFee = self.safe_string_2(entry, 'execFeeEv', 'execFeeRv')
3675
+ currencyCode = self.safe_currency_code(self.safe_string(entry, 'currency'))
3673
3676
  result.append({
3674
3677
  'info': entry,
3675
3678
  'symbol': self.safe_string(entry, 'symbol'),
3676
- 'code': self.safe_currency_code(self.safe_string(entry, 'currency')),
3679
+ 'code': currencyCode,
3677
3680
  'timestamp': timestamp,
3678
3681
  'datetime': self.iso8601(timestamp),
3679
3682
  'id': None,
3680
- 'amount': self.from_ev(self.safe_string(entry, 'execFeeEv'), market),
3683
+ 'amount': self.parse_funding_fee_to_precision(execFee, market, currencyCode),
3681
3684
  })
3682
3685
  return result
3683
3686
 
3687
+ def parse_funding_fee_to_precision(self, value, market: Market = None, currencyCode: Str = None):
3688
+ if value is None or currencyCode is None:
3689
+ return value
3690
+ # it was confirmed by phemex support, that USDT contracts use direct amounts in funding fees, while USD & INVERSE needs 'valueScale'
3691
+ isUsdt = market['settle'] == 'USDT'
3692
+ if not isUsdt:
3693
+ currency = self.safe_currency(currencyCode)
3694
+ scale = self.safe_string(currency['info'], 'valueScale')
3695
+ tickPrecision = self.parse_precision(scale)
3696
+ value = Precise.string_mul(value, tickPrecision)
3697
+ return value
3698
+
3684
3699
  async def fetch_funding_rate(self, symbol: str, params={}):
3685
3700
  """
3686
3701
  fetch the current funding rate
@@ -220,41 +220,22 @@ class probit(Exchange, ImplicitAPI):
220
220
  },
221
221
  },
222
222
  'commonCurrencies': {
223
- 'AUTO': 'Cube',
224
- 'AZU': 'Azultec',
225
- 'BCC': 'BCC',
226
- 'BDP': 'BidiPass',
227
- 'BIRD': 'Birdchain',
228
- 'BTCBEAR': 'BEAR',
229
- 'BTCBULL': 'BULL',
223
+ 'BB': 'Baby Bali',
230
224
  'CBC': 'CryptoBharatCoin',
231
- 'CHE': 'Chellit',
232
- 'CLR': 'Color Platform',
233
225
  'CTK': 'Cryptyk',
234
226
  'CTT': 'Castweet',
235
- 'DIP': 'Dipper',
236
227
  'DKT': 'DAKOTA',
237
228
  'EGC': 'EcoG9coin',
238
229
  'EPS': 'Epanus', # conflict with EPS Ellipsis https://github.com/ccxt/ccxt/issues/8909
239
230
  'FX': 'Fanzy',
240
- 'GDT': 'Gorilla Diamond',
241
231
  'GM': 'GM Holding',
242
232
  'GOGOL': 'GOL',
243
233
  'GOL': 'Goldofir',
244
- 'GRB': 'Global Reward Bank',
245
- 'HBC': 'Hybrid Bank Cash',
246
234
  'HUSL': 'The Hustle App',
247
235
  'LAND': 'Landbox',
248
- 'LBK': 'Legal Block',
249
- 'ORC': 'Oracle System',
250
- 'PXP': 'PIXSHOP COIN',
251
- 'PYE': 'CreamPYE',
252
- 'ROOK': 'Reckoon',
253
- 'SOC': 'Soda Coin',
254
236
  'SST': 'SocialSwap',
255
237
  'TCT': 'Top Coin Token',
256
238
  'TOR': 'Torex',
257
- 'TPAY': 'Tetra Pay',
258
239
  'UNI': 'UNICORN Token',
259
240
  'UNISWAP': 'UNI',
260
241
  },
@@ -245,6 +245,15 @@ class whitebit(Exchange, ImplicitAPI):
245
245
  'convert/estimate',
246
246
  'convert/confirm',
247
247
  'convert/history',
248
+ 'sub-account/create',
249
+ 'sub-account/delete',
250
+ 'sub-account/edit',
251
+ 'sub-account/list',
252
+ 'sub-account/transfer',
253
+ 'sub-account/block',
254
+ 'sub-account/unblock',
255
+ 'sub-account/balances',
256
+ 'sub-account/transfer/history',
248
257
  ],
249
258
  },
250
259
  },
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.22'
7
+ __version__ = '4.3.24'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -5566,8 +5566,9 @@ class Exchange(object):
5566
5566
  errors = 0
5567
5567
  responseLength = len(response)
5568
5568
  if self.verbose:
5569
- iteration = (i + str(1))
5570
- cursorMessage = 'Cursor pagination call ' + iteration + ' method ' + method + ' response length ' + str(responseLength) + ' cursor ' + cursorValue
5569
+ cursorString = '' if (cursorValue is None) else cursorValue
5570
+ iteration = (i + 1)
5571
+ cursorMessage = 'Cursor pagination call ' + str(iteration) + ' method ' + method + ' response length ' + str(responseLength) + ' cursor ' + cursorString
5571
5572
  self.log(cursorMessage)
5572
5573
  if responseLength == 0:
5573
5574
  break
ccxt/binance.py CHANGED
@@ -9003,7 +9003,7 @@ class binance(Exchange, ImplicitAPI):
9003
9003
  self.load_markets()
9004
9004
  # by default cache the leverage bracket
9005
9005
  # it contains useful stuff like the maintenance margin and initial margin for positions
9006
- leverageBrackets = self.safe_dict(self.options, 'leverageBrackets', {})
9006
+ leverageBrackets = self.safe_dict(self.options, 'leverageBrackets')
9007
9007
  if (leverageBrackets is None) or (reload):
9008
9008
  defaultType = self.safe_string(self.options, 'defaultType', 'future')
9009
9009
  type = self.safe_string(params, 'type', defaultType)
ccxt/bitrue.py CHANGED
@@ -2932,6 +2932,10 @@ class bitrue(Exchange, ImplicitAPI):
2932
2932
  signPath = signPath + '/' + version + '/' + path
2933
2933
  signMessage = timestamp + method + signPath
2934
2934
  if method == 'GET':
2935
+ keys = list(params.keys())
2936
+ keysLength = len(keys)
2937
+ if keysLength > 0:
2938
+ signMessage += '?' + self.urlencode(params)
2935
2939
  signature = self.hmac(self.encode(signMessage), self.encode(self.secret), hashlib.sha256)
2936
2940
  headers = {
2937
2941
  'X-CH-APIKEY': self.apiKey,
@@ -2944,7 +2948,7 @@ class bitrue(Exchange, ImplicitAPI):
2944
2948
  'recvWindow': recvWindow,
2945
2949
  }, params)
2946
2950
  body = self.json(query)
2947
- signMessage = signMessage + json.dumps(body)
2951
+ signMessage += body
2948
2952
  signature = self.hmac(self.encode(signMessage), self.encode(self.secret), hashlib.sha256)
2949
2953
  headers = {
2950
2954
  'Content-Type': 'application/json',
ccxt/coinbase.py CHANGED
@@ -1753,6 +1753,10 @@ class coinbase(Exchange, ImplicitAPI):
1753
1753
  request = {}
1754
1754
  if symbols is not None:
1755
1755
  request['product_ids'] = self.market_ids(symbols)
1756
+ marketType = None
1757
+ marketType, params = self.handle_market_type_and_params('fetchTickers', self.get_market_from_symbols(symbols), params, 'default')
1758
+ if marketType is not None and marketType != 'default':
1759
+ request['product_type'] = 'FUTURE' if (marketType == 'swap') else 'SPOT'
1756
1760
  response = self.v3PublicGetBrokerageMarketProducts(self.extend(request, params))
1757
1761
  #
1758
1762
  # {
@@ -0,0 +1,17 @@
1
+ # -*- coding: utf-8 -*-
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
+
6
+ from ccxt.coinbase import coinbase
7
+ from ccxt.abstract.coinbaseadvanced import ImplicitAPI
8
+
9
+
10
+ class coinbaseadvanced(coinbase, ImplicitAPI):
11
+
12
+ def describe(self):
13
+ return self.deep_extend(super(coinbaseadvanced, self).describe(), {
14
+ 'id': 'coinbaseadvanced',
15
+ 'name': 'Coinbase Advanced',
16
+ 'alias': True,
17
+ })
@@ -4,7 +4,7 @@
4
4
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
- from ccxt.abstract.coinbasepro import ImplicitAPI
7
+ from ccxt.abstract.coinbaseexchange import ImplicitAPI
8
8
  import hashlib
9
9
  from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
10
10
  from typing import List
@@ -22,12 +22,12 @@ from ccxt.base.decimal_to_precision import TICK_SIZE
22
22
  from ccxt.base.precise import Precise
23
23
 
24
24
 
25
- class coinbasepro(Exchange, ImplicitAPI):
25
+ class coinbaseexchange(Exchange, ImplicitAPI):
26
26
 
27
27
  def describe(self):
28
- return self.deep_extend(super(coinbasepro, self).describe(), {
29
- 'id': 'coinbasepro',
30
- 'name': 'Coinbase Pro(Deprecated)',
28
+ return self.deep_extend(super(coinbaseexchange, self).describe(), {
29
+ 'id': 'coinbaseexchange',
30
+ 'name': 'Coinbase Exchange',
31
31
  'countries': ['US'],
32
32
  'rateLimit': 100,
33
33
  'userAgent': self.userAgents['chrome'],
@@ -89,19 +89,19 @@ class coinbasepro(Exchange, ImplicitAPI):
89
89
  '6h': 21600,
90
90
  '1d': 86400,
91
91
  },
92
- 'hostname': 'pro.coinbase.com',
92
+ 'hostname': 'exchange.coinbase.com',
93
93
  'urls': {
94
94
  'test': {
95
- 'public': 'https://api-public.sandbox.pro.coinbase.com',
96
- 'private': 'https://api-public.sandbox.pro.coinbase.com',
95
+ 'public': 'https://api-public.sandbox.exchange.coinbase.com',
96
+ 'private': 'https://api-public.sandbox.exchange.coinbase.com',
97
97
  },
98
- 'logo': 'https://user-images.githubusercontent.com/1294454/41764625-63b7ffde-760a-11e8-996d-a6328fa9347a.jpg',
98
+ 'logo': 'https://github.com/ccxt/ccxt/assets/43336371/34a65553-88aa-4a38-a714-064bd228b97e',
99
99
  'api': {
100
100
  'public': 'https://api.{hostname}',
101
101
  'private': 'https://api.{hostname}',
102
102
  },
103
- 'www': 'https://pro.coinbase.com/',
104
- 'doc': 'https://docs.pro.coinbase.com',
103
+ 'www': 'https://coinbase.com/',
104
+ 'doc': 'https://docs.cloud.coinbase.com/exchange/docs/',
105
105
  'fees': [
106
106
  'https://docs.pro.coinbase.com/#fees',
107
107
  'https://support.pro.coinbase.com/customer/en/portal/articles/2945310-fees',
@@ -315,7 +315,7 @@ class coinbasepro(Exchange, ImplicitAPI):
315
315
 
316
316
  def fetch_markets(self, params={}) -> List[Market]:
317
317
  """
318
- retrieves data on all markets for coinbasepro
318
+ retrieves data on all markets for coinbaseexchange
319
319
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproducts
320
320
  :param dict [params]: extra parameters specific to the exchange API endpoint
321
321
  :returns dict[]: an array of objects representing market data
@@ -1047,7 +1047,7 @@ class coinbasepro(Exchange, ImplicitAPI):
1047
1047
  """
1048
1048
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorder
1049
1049
  fetches information on an order made by the user
1050
- :param str symbol: not used by coinbasepro fetchOrder
1050
+ :param str symbol: not used by coinbaseexchange fetchOrder
1051
1051
  :param dict [params]: extra parameters specific to the exchange API endpoint
1052
1052
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1053
1053
  """