ccxt 4.3.34__py2.py3-none-any.whl → 4.3.36__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 (54) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bitbay.py +6 -0
  3. ccxt/abstract/zonda.py +6 -0
  4. ccxt/alpaca.py +1 -1
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/alpaca.py +1 -1
  7. ccxt/async_support/base/exchange.py +42 -42
  8. ccxt/async_support/binance.py +2 -2
  9. ccxt/async_support/bingx.py +4 -3
  10. ccxt/async_support/bit2c.py +2 -1
  11. ccxt/async_support/bitget.py +11 -5
  12. ccxt/async_support/bitmart.py +2 -7
  13. ccxt/async_support/btcmarkets.py +3 -1
  14. ccxt/async_support/bybit.py +1 -1
  15. ccxt/async_support/coinbase.py +60 -3
  16. ccxt/async_support/coinex.py +26 -19
  17. ccxt/async_support/gemini.py +1 -1
  18. ccxt/async_support/kraken.py +3 -1
  19. ccxt/async_support/paymium.py +4 -1
  20. ccxt/async_support/whitebit.py +24 -3
  21. ccxt/async_support/zaif.py +30 -2
  22. ccxt/async_support/zonda.py +6 -0
  23. ccxt/base/exchange.py +85 -76
  24. ccxt/binance.py +2 -2
  25. ccxt/bingx.py +4 -3
  26. ccxt/bit2c.py +2 -1
  27. ccxt/bitget.py +11 -5
  28. ccxt/bitmart.py +2 -7
  29. ccxt/btcmarkets.py +3 -1
  30. ccxt/bybit.py +1 -1
  31. ccxt/coinbase.py +60 -3
  32. ccxt/coinex.py +26 -19
  33. ccxt/gemini.py +1 -1
  34. ccxt/kraken.py +3 -1
  35. ccxt/paymium.py +4 -1
  36. ccxt/pro/__init__.py +1 -1
  37. ccxt/pro/binance.py +4 -4
  38. ccxt/pro/bingx.py +9 -4
  39. ccxt/pro/bitfinex2.py +4 -4
  40. ccxt/pro/bitget.py +24 -1
  41. ccxt/pro/bitmart.py +9 -7
  42. ccxt/pro/bybit.py +6 -6
  43. ccxt/pro/htx.py +5 -6
  44. ccxt/pro/kraken.py +1 -1
  45. ccxt/pro/okx.py +4 -5
  46. ccxt/pro/woo.py +4 -4
  47. ccxt/test/base/test_crypto.py +1 -1
  48. ccxt/whitebit.py +24 -3
  49. ccxt/zaif.py +30 -2
  50. ccxt/zonda.py +6 -0
  51. {ccxt-4.3.34.dist-info → ccxt-4.3.36.dist-info}/METADATA +4 -4
  52. {ccxt-4.3.34.dist-info → ccxt-4.3.36.dist-info}/RECORD +54 -54
  53. {ccxt-4.3.34.dist-info → ccxt-4.3.36.dist-info}/WHEEL +0 -0
  54. {ccxt-4.3.34.dist-info → ccxt-4.3.36.dist-info}/top_level.txt +0 -0
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.34'
7
+ __version__ = '4.3.36'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -1742,10 +1742,10 @@ class Exchange(object):
1742
1742
  def string_to_chars_array(self, value):
1743
1743
  return list(value)
1744
1744
 
1745
- def valueIsDefined(self, value):
1745
+ def value_is_defined(self, value):
1746
1746
  return value is not None
1747
1747
 
1748
- def arraySlice(self, array, first, second=None):
1748
+ def array_slice(self, array, first, second=None):
1749
1749
  return array[first:second] if second else array[first:]
1750
1750
 
1751
1751
  def get_property(self, obj, property, defaultValue=None):
@@ -1952,10 +1952,10 @@ class Exchange(object):
1952
1952
  httpsProxy = None
1953
1953
  socksProxy = None
1954
1954
  # httpProxy
1955
- if self.valueIsDefined(self.httpProxy):
1955
+ if self.value_is_defined(self.httpProxy):
1956
1956
  usedProxies.append('httpProxy')
1957
1957
  httpProxy = self.httpProxy
1958
- if self.valueIsDefined(self.http_proxy):
1958
+ if self.value_is_defined(self.http_proxy):
1959
1959
  usedProxies.append('http_proxy')
1960
1960
  httpProxy = self.http_proxy
1961
1961
  if self.httpProxyCallback is not None:
@@ -1965,10 +1965,10 @@ class Exchange(object):
1965
1965
  usedProxies.append('http_proxy_callback')
1966
1966
  httpProxy = self.http_proxy_callback(url, method, headers, body)
1967
1967
  # httpsProxy
1968
- if self.valueIsDefined(self.httpsProxy):
1968
+ if self.value_is_defined(self.httpsProxy):
1969
1969
  usedProxies.append('httpsProxy')
1970
1970
  httpsProxy = self.httpsProxy
1971
- if self.valueIsDefined(self.https_proxy):
1971
+ if self.value_is_defined(self.https_proxy):
1972
1972
  usedProxies.append('https_proxy')
1973
1973
  httpsProxy = self.https_proxy
1974
1974
  if self.httpsProxyCallback is not None:
@@ -1978,10 +1978,10 @@ class Exchange(object):
1978
1978
  usedProxies.append('https_proxy_callback')
1979
1979
  httpsProxy = self.https_proxy_callback(url, method, headers, body)
1980
1980
  # socksProxy
1981
- if self.valueIsDefined(self.socksProxy):
1981
+ if self.value_is_defined(self.socksProxy):
1982
1982
  usedProxies.append('socksProxy')
1983
1983
  socksProxy = self.socksProxy
1984
- if self.valueIsDefined(self.socks_proxy):
1984
+ if self.value_is_defined(self.socks_proxy):
1985
1985
  usedProxies.append('socks_proxy')
1986
1986
  socksProxy = self.socks_proxy
1987
1987
  if self.socksProxyCallback is not None:
@@ -2003,24 +2003,24 @@ class Exchange(object):
2003
2003
  wssProxy = None
2004
2004
  wsSocksProxy = None
2005
2005
  # ws proxy
2006
- if self.valueIsDefined(self.wsProxy):
2006
+ if self.value_is_defined(self.wsProxy):
2007
2007
  usedProxies.append('wsProxy')
2008
2008
  wsProxy = self.wsProxy
2009
- if self.valueIsDefined(self.ws_proxy):
2009
+ if self.value_is_defined(self.ws_proxy):
2010
2010
  usedProxies.append('ws_proxy')
2011
2011
  wsProxy = self.ws_proxy
2012
2012
  # wss proxy
2013
- if self.valueIsDefined(self.wssProxy):
2013
+ if self.value_is_defined(self.wssProxy):
2014
2014
  usedProxies.append('wssProxy')
2015
2015
  wssProxy = self.wssProxy
2016
- if self.valueIsDefined(self.wss_proxy):
2016
+ if self.value_is_defined(self.wss_proxy):
2017
2017
  usedProxies.append('wss_proxy')
2018
2018
  wssProxy = self.wss_proxy
2019
2019
  # ws socks proxy
2020
- if self.valueIsDefined(self.wsSocksProxy):
2020
+ if self.value_is_defined(self.wsSocksProxy):
2021
2021
  usedProxies.append('wsSocksProxy')
2022
2022
  wsSocksProxy = self.wsSocksProxy
2023
- if self.valueIsDefined(self.ws_socks_proxy):
2023
+ if self.value_is_defined(self.ws_socks_proxy):
2024
2024
  usedProxies.append('ws_socks_proxy')
2025
2025
  wsSocksProxy = self.ws_socks_proxy
2026
2026
  # check
@@ -2044,7 +2044,7 @@ class Exchange(object):
2044
2044
  return result
2045
2045
 
2046
2046
  def filter_by_limit(self, array: List[object], limit: Int = None, key: IndexType = 'timestamp', fromStart: bool = False):
2047
- if self.valueIsDefined(limit):
2047
+ if self.value_is_defined(limit):
2048
2048
  arrayLength = len(array)
2049
2049
  if arrayLength > 0:
2050
2050
  ascending = True
@@ -2056,13 +2056,13 @@ class Exchange(object):
2056
2056
  if fromStart:
2057
2057
  if limit > arrayLength:
2058
2058
  limit = arrayLength
2059
- array = self.arraySlice(array, 0, limit) if ascending else self.arraySlice(array, -limit)
2059
+ array = self.array_slice(array, 0, limit) if ascending else self.array_slice(array, -limit)
2060
2060
  else:
2061
- array = self.arraySlice(array, -limit) if ascending else self.arraySlice(array, 0, limit)
2061
+ array = self.array_slice(array, -limit) if ascending else self.array_slice(array, 0, limit)
2062
2062
  return array
2063
2063
 
2064
2064
  def filter_by_since_limit(self, array: List[object], since: Int = None, limit: Int = None, key: IndexType = 'timestamp', tail=False):
2065
- sinceIsDefined = self.valueIsDefined(since)
2065
+ sinceIsDefined = self.value_is_defined(since)
2066
2066
  parsedArray = self.to_array(array)
2067
2067
  result = parsedArray
2068
2068
  if sinceIsDefined:
@@ -2073,15 +2073,15 @@ class Exchange(object):
2073
2073
  if value and (value >= since):
2074
2074
  result.append(entry)
2075
2075
  if tail and limit is not None:
2076
- return self.arraySlice(result, -limit)
2076
+ return self.array_slice(result, -limit)
2077
2077
  # if the user provided a 'since' argument
2078
2078
  # we want to limit the result starting from the 'since'
2079
2079
  shouldFilterFromStart = not tail and sinceIsDefined
2080
2080
  return self.filter_by_limit(result, limit, key, shouldFilterFromStart)
2081
2081
 
2082
2082
  def filter_by_value_since_limit(self, array: List[object], field: IndexType, value=None, since: Int = None, limit: Int = None, key='timestamp', tail=False):
2083
- valueIsDefined = self.valueIsDefined(value)
2084
- sinceIsDefined = self.valueIsDefined(since)
2083
+ valueIsDefined = self.value_is_defined(value)
2084
+ sinceIsDefined = self.value_is_defined(since)
2085
2085
  parsedArray = self.to_array(array)
2086
2086
  result = parsedArray
2087
2087
  # single-pass filter for both symbol and since
@@ -2097,7 +2097,7 @@ class Exchange(object):
2097
2097
  if firstCondition and secondCondition:
2098
2098
  result.append(entry)
2099
2099
  if tail and limit is not None:
2100
- return self.arraySlice(result, -limit)
2100
+ return self.array_slice(result, -limit)
2101
2101
  return self.filter_by_limit(result, limit, key, sinceIsDefined)
2102
2102
 
2103
2103
  def set_sandbox_mode(self, enabled: bool):
@@ -2133,7 +2133,7 @@ class Exchange(object):
2133
2133
 
2134
2134
  def watch_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
2135
2135
  if self.has['watchLiquidationsForSymbols']:
2136
- return self.watchLiquidationsForSymbols([symbol], since, limit, params)
2136
+ return self.watch_liquidations_for_symbols([symbol], since, limit, params)
2137
2137
  raise NotSupported(self.id + ' watchLiquidations() is not supported yet')
2138
2138
 
2139
2139
  def watch_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
@@ -2141,7 +2141,7 @@ class Exchange(object):
2141
2141
 
2142
2142
  def watch_my_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
2143
2143
  if self.has['watchMyLiquidationsForSymbols']:
2144
- return self.watchMyLiquidationsForSymbols([symbol], since, limit, params)
2144
+ return self.watch_my_liquidations_for_symbols([symbol], since, limit, params)
2145
2145
  raise NotSupported(self.id + ' watchMyLiquidations() is not supported yet')
2146
2146
 
2147
2147
  def watch_my_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
@@ -2173,7 +2173,7 @@ class Exchange(object):
2173
2173
 
2174
2174
  def fetch_margin_mode(self, symbol: str, params={}):
2175
2175
  if self.has['fetchMarginModes']:
2176
- marginModes = self.fetchMarginModes([symbol], params)
2176
+ marginModes = self.fetch_margin_modes([symbol], params)
2177
2177
  return self.safe_dict(marginModes, symbol)
2178
2178
  else:
2179
2179
  raise NotSupported(self.id + ' fetchMarginMode() is not supported yet')
@@ -2182,7 +2182,7 @@ class Exchange(object):
2182
2182
  raise NotSupported(self.id + ' fetchMarginModes() is not supported yet')
2183
2183
 
2184
2184
  def fetch_rest_order_book_safe(self, symbol, limit=None, params={}):
2185
- fetchSnapshotMaxRetries = self.handleOption('watchOrderBook', 'maxRetries', 3)
2185
+ fetchSnapshotMaxRetries = self.handle_option('watchOrderBook', 'maxRetries', 3)
2186
2186
  for i in range(0, fetchSnapshotMaxRetries):
2187
2187
  try:
2188
2188
  orderBook = self.fetch_order_book(symbol, limit, params)
@@ -2280,7 +2280,7 @@ class Exchange(object):
2280
2280
  raise NotSupported(self.id + ' watchFundingRates() is not supported yet')
2281
2281
 
2282
2282
  def watch_funding_rates_for_symbols(self, symbols: List[str], params={}):
2283
- return self.watchFundingRates(symbols, params)
2283
+ return self.watch_funding_rates(symbols, params)
2284
2284
 
2285
2285
  def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}):
2286
2286
  raise NotSupported(self.id + ' transfer() is not supported yet')
@@ -2296,7 +2296,7 @@ class Exchange(object):
2296
2296
 
2297
2297
  def fetch_leverage(self, symbol: str, params={}):
2298
2298
  if self.has['fetchLeverages']:
2299
- leverages = self.fetchLeverages([symbol], params)
2299
+ leverages = self.fetch_leverages([symbol], params)
2300
2300
  return self.safe_dict(leverages, symbol)
2301
2301
  else:
2302
2302
  raise NotSupported(self.id + ' fetchLeverage() is not supported yet')
@@ -3023,6 +3023,15 @@ class Exchange(object):
3023
3023
  trade['cost'] = self.parse_number(cost)
3024
3024
  return trade
3025
3025
 
3026
+ def find_nearest_ceiling(self, arr: List[float], providedValue: float):
3027
+ # i.e. findNearestCeiling([10, 30, 50], 23) returns 30
3028
+ length = len(arr)
3029
+ for i in range(0, length):
3030
+ current = arr[i]
3031
+ if providedValue <= current:
3032
+ return current
3033
+ return arr[length - 1]
3034
+
3026
3035
  def invert_flat_string_dictionary(self, dict):
3027
3036
  reversed = {}
3028
3037
  keys = list(dict.keys())
@@ -3220,7 +3229,7 @@ class Exchange(object):
3220
3229
  result[close] = []
3221
3230
  result[volume] = []
3222
3231
  for i in range(0, len(ohlcvs)):
3223
- ts = ohlcvs[i][0] if ms else self.parseToInt(ohlcvs[i][0] / 1000)
3232
+ ts = ohlcvs[i][0] if ms else self.parse_to_int(ohlcvs[i][0] / 1000)
3224
3233
  result[timestamp].append(ts)
3225
3234
  result[open].append(ohlcvs[i][1])
3226
3235
  result[high].append(ohlcvs[i][2])
@@ -3799,12 +3808,12 @@ class Exchange(object):
3799
3808
  return self.edit_order(id, symbol, 'limit', side, amount, price, params)
3800
3809
 
3801
3810
  def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
3802
- self.cancelOrder(id, symbol)
3811
+ self.cancel_order(id, symbol)
3803
3812
  return self.create_order(symbol, type, side, amount, price, params)
3804
3813
 
3805
3814
  def edit_order_ws(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
3806
- self.cancelOrderWs(id, symbol)
3807
- return self.createOrderWs(symbol, type, side, amount, price, params)
3815
+ self.cancel_order_ws(id, symbol)
3816
+ return self.create_order_ws(symbol, type, side, amount, price, params)
3808
3817
 
3809
3818
  def fetch_permissions(self, params={}):
3810
3819
  raise NotSupported(self.id + ' fetchPermissions() is not supported yet')
@@ -3822,7 +3831,7 @@ class Exchange(object):
3822
3831
  raise NotSupported(self.id + ' watchPositions() is not supported yet')
3823
3832
 
3824
3833
  def watch_position_for_symbols(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
3825
- return self.watchPositions(symbols, since, limit, params)
3834
+ return self.watch_positions(symbols, since, limit, params)
3826
3835
 
3827
3836
  def fetch_positions_for_symbol(self, symbol: str, params={}):
3828
3837
  """
@@ -3987,7 +3996,7 @@ class Exchange(object):
3987
3996
  def fetch_deposit_withdraw_fee(self, code: str, params={}):
3988
3997
  if not self.has['fetchDepositWithdrawFees']:
3989
3998
  raise NotSupported(self.id + ' fetchDepositWithdrawFee() is not supported yet')
3990
- fees = self.fetchDepositWithdrawFees([code], params)
3999
+ fees = self.fetch_deposit_withdraw_fees([code], params)
3991
4000
  return self.safe_value(fees, code)
3992
4001
 
3993
4002
  def get_supported_mapping(self, key, mapping={}):
@@ -4000,7 +4009,7 @@ class Exchange(object):
4000
4009
  self.load_markets()
4001
4010
  if not self.has['fetchBorrowRates']:
4002
4011
  raise NotSupported(self.id + ' fetchCrossBorrowRate() is not supported yet')
4003
- borrowRates = self.fetchCrossBorrowRates(params)
4012
+ borrowRates = self.fetch_cross_borrow_rates(params)
4004
4013
  rate = self.safe_value(borrowRates, code)
4005
4014
  if rate is None:
4006
4015
  raise ExchangeError(self.id + ' fetchCrossBorrowRate() could not find the borrow rate for currency code ' + code)
@@ -4154,7 +4163,7 @@ class Exchange(object):
4154
4163
  self.load_markets()
4155
4164
  market = self.market(symbol)
4156
4165
  symbol = market['symbol']
4157
- tickers = self.fetchTickerWs(symbol, params)
4166
+ tickers = self.fetch_ticker_ws(symbol, params)
4158
4167
  ticker = self.safe_dict(tickers, symbol)
4159
4168
  if ticker is None:
4160
4169
  raise NullResponse(self.id + ' fetchTickers() could not find a ticker for ' + symbol)
@@ -4240,7 +4249,7 @@ class Exchange(object):
4240
4249
  if trailingTriggerPrice is not None:
4241
4250
  params['trailingTriggerPrice'] = trailingTriggerPrice
4242
4251
  if self.has['createTrailingAmountOrderWs']:
4243
- return self.createOrderWs(symbol, type, side, amount, price, params)
4252
+ return self.create_order_ws(symbol, type, side, amount, price, params)
4244
4253
  raise NotSupported(self.id + ' createTrailingAmountOrderWs() is not supported yet')
4245
4254
 
4246
4255
  def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}):
@@ -4284,7 +4293,7 @@ class Exchange(object):
4284
4293
  if trailingTriggerPrice is not None:
4285
4294
  params['trailingTriggerPrice'] = trailingTriggerPrice
4286
4295
  if self.has['createTrailingPercentOrderWs']:
4287
- return self.createOrderWs(symbol, type, side, amount, price, params)
4296
+ return self.create_order_ws(symbol, type, side, amount, price, params)
4288
4297
  raise NotSupported(self.id + ' createTrailingPercentOrderWs() is not supported yet')
4289
4298
 
4290
4299
  def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
@@ -4334,7 +4343,7 @@ class Exchange(object):
4334
4343
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
4335
4344
  """
4336
4345
  if self.has['createMarketOrderWithCostWs'] or (self.has['createMarketBuyOrderWithCostWs'] and self.has['createMarketSellOrderWithCostWs']):
4337
- return self.createOrderWs(symbol, 'market', side, cost, 1, params)
4346
+ return self.create_order_ws(symbol, 'market', side, cost, 1, params)
4338
4347
  raise NotSupported(self.id + ' createMarketOrderWithCostWs() is not supported yet')
4339
4348
 
4340
4349
  def create_trigger_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
@@ -4372,7 +4381,7 @@ class Exchange(object):
4372
4381
  raise ArgumentsRequired(self.id + ' createTriggerOrderWs() requires a triggerPrice argument')
4373
4382
  params['triggerPrice'] = triggerPrice
4374
4383
  if self.has['createTriggerOrderWs']:
4375
- return self.createOrderWs(symbol, type, side, amount, price, params)
4384
+ return self.create_order_ws(symbol, type, side, amount, price, params)
4376
4385
  raise NotSupported(self.id + ' createTriggerOrderWs() is not supported yet')
4377
4386
 
4378
4387
  def create_stop_loss_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopLossPrice: Num = None, params={}):
@@ -4410,7 +4419,7 @@ class Exchange(object):
4410
4419
  raise ArgumentsRequired(self.id + ' createStopLossOrderWs() requires a stopLossPrice argument')
4411
4420
  params['stopLossPrice'] = stopLossPrice
4412
4421
  if self.has['createStopLossOrderWs']:
4413
- return self.createOrderWs(symbol, type, side, amount, price, params)
4422
+ return self.create_order_ws(symbol, type, side, amount, price, params)
4414
4423
  raise NotSupported(self.id + ' createStopLossOrderWs() is not supported yet')
4415
4424
 
4416
4425
  def create_take_profit_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfitPrice: Num = None, params={}):
@@ -4448,7 +4457,7 @@ class Exchange(object):
4448
4457
  raise ArgumentsRequired(self.id + ' createTakeProfitOrderWs() requires a takeProfitPrice argument')
4449
4458
  params['takeProfitPrice'] = takeProfitPrice
4450
4459
  if self.has['createTakeProfitOrderWs']:
4451
- return self.createOrderWs(symbol, type, side, amount, price, params)
4460
+ return self.create_order_ws(symbol, type, side, amount, price, params)
4452
4461
  raise NotSupported(self.id + ' createTakeProfitOrderWs() is not supported yet')
4453
4462
 
4454
4463
  def create_order_with_take_profit_and_stop_loss(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfit: Num = None, stopLoss: Num = None, params={}):
@@ -4538,7 +4547,7 @@ class Exchange(object):
4538
4547
  """
4539
4548
  params = self.set_take_profit_and_stop_loss_params(symbol, type, side, amount, price, takeProfit, stopLoss, params)
4540
4549
  if self.has['createOrderWithTakeProfitAndStopLossWs']:
4541
- return self.createOrderWs(symbol, type, side, amount, price, params)
4550
+ return self.create_order_ws(symbol, type, side, amount, price, params)
4542
4551
  raise NotSupported(self.id + ' createOrderWithTakeProfitAndStopLossWs() is not supported yet')
4543
4552
 
4544
4553
  def create_orders(self, orders: List[OrderRequest], params={}):
@@ -4569,7 +4578,7 @@ class Exchange(object):
4569
4578
  raise NotSupported(self.id + ' cancelAllOrdersWs() is not supported yet')
4570
4579
 
4571
4580
  def cancel_unified_order(self, order, params={}):
4572
- return self.cancelOrder(self.safe_string(order, 'id'), self.safe_string(order, 'symbol'), params)
4581
+ return self.cancel_order(self.safe_string(order, 'id'), self.safe_string(order, 'symbol'), params)
4573
4582
 
4574
4583
  def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4575
4584
  if self.has['fetchOpenOrders'] and self.has['fetchClosedOrders']:
@@ -4593,7 +4602,7 @@ class Exchange(object):
4593
4602
 
4594
4603
  def fetch_open_orders_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4595
4604
  if self.has['fetchOrdersWs']:
4596
- orders = self.fetchOrdersWs(symbol, since, limit, params)
4605
+ orders = self.fetch_orders_ws(symbol, since, limit, params)
4597
4606
  return self.filter_by(orders, 'status', 'open')
4598
4607
  raise NotSupported(self.id + ' fetchOpenOrdersWs() is not supported yet')
4599
4608
 
@@ -4608,7 +4617,7 @@ class Exchange(object):
4608
4617
 
4609
4618
  def fetch_closed_orders_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4610
4619
  if self.has['fetchOrdersWs']:
4611
- orders = self.fetchOrdersWs(symbol, since, limit, params)
4620
+ orders = self.fetch_orders_ws(symbol, since, limit, params)
4612
4621
  return self.filter_by(orders, 'status', 'closed')
4613
4622
  raise NotSupported(self.id + ' fetchClosedOrdersWs() is not supported yet')
4614
4623
 
@@ -4682,7 +4691,7 @@ class Exchange(object):
4682
4691
 
4683
4692
  def fetch_deposit_address(self, code: str, params={}):
4684
4693
  if self.has['fetchDepositAddresses']:
4685
- depositAddresses = self.fetchDepositAddresses([code], params)
4694
+ depositAddresses = self.fetch_deposit_addresses([code], params)
4686
4695
  depositAddress = self.safe_value(depositAddresses, code)
4687
4696
  if depositAddress is None:
4688
4697
  raise InvalidAddress(self.id + ' fetchDepositAddress() could not find a deposit address for ' + code + ', make sure you have created a corresponding deposit address in your wallet on the exchange website')
@@ -4691,7 +4700,7 @@ class Exchange(object):
4691
4700
  elif self.has['fetchDepositAddressesByNetwork']:
4692
4701
  network = self.safe_string(params, 'network')
4693
4702
  params = self.omit(params, 'network')
4694
- addressStructures = self.fetchDepositAddressesByNetwork(code, params)
4703
+ addressStructures = self.fetch_deposit_addresses_by_network(code, params)
4695
4704
  if network is not None:
4696
4705
  return self.safe_dict(addressStructures, network)
4697
4706
  else:
@@ -4737,7 +4746,7 @@ class Exchange(object):
4737
4746
  return market
4738
4747
  return markets[0]
4739
4748
  elif (symbol.endswith('-C')) or (symbol.endswith('-P')) or (symbol.startswith('C-')) or (symbol.startswith('P-')):
4740
- return self.createExpiredOptionMarket(symbol)
4749
+ return self.create_expired_option_market(symbol)
4741
4750
  raise BadSymbol(self.id + ' does not have market symbol ' + symbol)
4742
4751
 
4743
4752
  def create_expired_option_market(self, symbol: str):
@@ -4757,37 +4766,37 @@ class Exchange(object):
4757
4766
  return self.create_order(symbol, 'limit', side, amount, price, params)
4758
4767
 
4759
4768
  def create_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, params={}):
4760
- return self.createOrderWs(symbol, 'limit', side, amount, price, params)
4769
+ return self.create_order_ws(symbol, 'limit', side, amount, price, params)
4761
4770
 
4762
4771
  def create_market_order(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
4763
4772
  return self.create_order(symbol, 'market', side, amount, price, params)
4764
4773
 
4765
4774
  def create_market_order_ws(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
4766
- return self.createOrderWs(symbol, 'market', side, amount, price, params)
4775
+ return self.create_order_ws(symbol, 'market', side, amount, price, params)
4767
4776
 
4768
4777
  def create_limit_buy_order(self, symbol: str, amount: float, price: float, params={}):
4769
4778
  return self.create_order(symbol, 'limit', 'buy', amount, price, params)
4770
4779
 
4771
4780
  def create_limit_buy_order_ws(self, symbol: str, amount: float, price: float, params={}):
4772
- return self.createOrderWs(symbol, 'limit', 'buy', amount, price, params)
4781
+ return self.create_order_ws(symbol, 'limit', 'buy', amount, price, params)
4773
4782
 
4774
4783
  def create_limit_sell_order(self, symbol: str, amount: float, price: float, params={}):
4775
4784
  return self.create_order(symbol, 'limit', 'sell', amount, price, params)
4776
4785
 
4777
4786
  def create_limit_sell_order_ws(self, symbol: str, amount: float, price: float, params={}):
4778
- return self.createOrderWs(symbol, 'limit', 'sell', amount, price, params)
4787
+ return self.create_order_ws(symbol, 'limit', 'sell', amount, price, params)
4779
4788
 
4780
4789
  def create_market_buy_order(self, symbol: str, amount: float, params={}):
4781
4790
  return self.create_order(symbol, 'market', 'buy', amount, None, params)
4782
4791
 
4783
4792
  def create_market_buy_order_ws(self, symbol: str, amount: float, params={}):
4784
- return self.createOrderWs(symbol, 'market', 'buy', amount, None, params)
4793
+ return self.create_order_ws(symbol, 'market', 'buy', amount, None, params)
4785
4794
 
4786
4795
  def create_market_sell_order(self, symbol: str, amount: float, params={}):
4787
4796
  return self.create_order(symbol, 'market', 'sell', amount, None, params)
4788
4797
 
4789
4798
  def create_market_sell_order_ws(self, symbol: str, amount: float, params={}):
4790
- return self.createOrderWs(symbol, 'market', 'sell', amount, None, params)
4799
+ return self.create_order_ws(symbol, 'market', 'sell', amount, None, params)
4791
4800
 
4792
4801
  def cost_to_precision(self, symbol: str, cost):
4793
4802
  market = self.market(symbol)
@@ -4819,7 +4828,7 @@ class Exchange(object):
4819
4828
  networkItem = self.safe_dict(networks, networkCode, {})
4820
4829
  precision = self.safe_value(networkItem, 'precision', precision)
4821
4830
  if precision is None:
4822
- return self.forceString(fee)
4831
+ return self.force_string(fee)
4823
4832
  else:
4824
4833
  return self.decimal_to_precision(fee, ROUND, precision, self.precisionMode, self.paddingMode)
4825
4834
 
@@ -4909,7 +4918,7 @@ class Exchange(object):
4909
4918
  if not self.has['createPostOnlyOrderWs']:
4910
4919
  raise NotSupported(self.id + 'createPostOnlyOrderWs() is not supported yet')
4911
4920
  query = self.extend(params, {'postOnly': True})
4912
- return self.createOrderWs(symbol, type, side, amount, price, query)
4921
+ return self.create_order_ws(symbol, type, side, amount, price, query)
4913
4922
 
4914
4923
  def create_reduce_only_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
4915
4924
  if not self.has['createReduceOnlyOrder']:
@@ -4921,7 +4930,7 @@ class Exchange(object):
4921
4930
  if not self.has['createReduceOnlyOrderWs']:
4922
4931
  raise NotSupported(self.id + 'createReduceOnlyOrderWs() is not supported yet')
4923
4932
  query = self.extend(params, {'reduceOnly': True})
4924
- return self.createOrderWs(symbol, type, side, amount, price, query)
4933
+ return self.create_order_ws(symbol, type, side, amount, price, query)
4925
4934
 
4926
4935
  def create_stop_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopPrice: Num = None, params={}):
4927
4936
  if not self.has['createStopOrder']:
@@ -4937,7 +4946,7 @@ class Exchange(object):
4937
4946
  if stopPrice is None:
4938
4947
  raise ArgumentsRequired(self.id + ' createStopOrderWs() requires a stopPrice argument')
4939
4948
  query = self.extend(params, {'stopPrice': stopPrice})
4940
- return self.createOrderWs(symbol, type, side, amount, price, query)
4949
+ return self.create_order_ws(symbol, type, side, amount, price, query)
4941
4950
 
4942
4951
  def create_stop_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, stopPrice: float, params={}):
4943
4952
  if not self.has['createStopLimitOrder']:
@@ -4949,7 +4958,7 @@ class Exchange(object):
4949
4958
  if not self.has['createStopLimitOrderWs']:
4950
4959
  raise NotSupported(self.id + ' createStopLimitOrderWs() is not supported yet')
4951
4960
  query = self.extend(params, {'stopPrice': stopPrice})
4952
- return self.createOrderWs(symbol, 'limit', side, amount, price, query)
4961
+ return self.create_order_ws(symbol, 'limit', side, amount, price, query)
4953
4962
 
4954
4963
  def create_stop_market_order(self, symbol: str, side: OrderSide, amount: float, stopPrice: float, params={}):
4955
4964
  if not self.has['createStopMarketOrder']:
@@ -4961,7 +4970,7 @@ class Exchange(object):
4961
4970
  if not self.has['createStopMarketOrderWs']:
4962
4971
  raise NotSupported(self.id + ' createStopMarketOrderWs() is not supported yet')
4963
4972
  query = self.extend(params, {'stopPrice': stopPrice})
4964
- return self.createOrderWs(symbol, 'market', side, amount, None, query)
4973
+ return self.create_order_ws(symbol, 'market', side, amount, None, query)
4965
4974
 
4966
4975
  def safe_currency_code(self, currencyId: Str, currency: Currency = None):
4967
4976
  currency = self.safe_currency(currencyId, currency)
@@ -5000,14 +5009,14 @@ class Exchange(object):
5000
5009
  results = []
5001
5010
  if isinstance(pricesData, list):
5002
5011
  for i in range(0, len(pricesData)):
5003
- priceData = self.extend(self.parseLastPrice(pricesData[i]), params)
5012
+ priceData = self.extend(self.parse_last_price(pricesData[i]), params)
5004
5013
  results.append(priceData)
5005
5014
  else:
5006
5015
  marketIds = list(pricesData.keys())
5007
5016
  for i in range(0, len(marketIds)):
5008
5017
  marketId = marketIds[i]
5009
5018
  market = self.safe_market(marketId)
5010
- priceData = self.extend(self.parseLastPrice(pricesData[marketId], market), params)
5019
+ priceData = self.extend(self.parse_last_price(pricesData[marketId], market), params)
5011
5020
  results.append(priceData)
5012
5021
  symbols = self.market_symbols(symbols)
5013
5022
  return self.filter_by_array(results, 'symbol', symbols)
@@ -5072,7 +5081,7 @@ class Exchange(object):
5072
5081
  result = {}
5073
5082
  for i in range(0, len(info)):
5074
5083
  item = info[i]
5075
- borrowRate = self.parseIsolatedBorrowRate(item)
5084
+ borrowRate = self.parse_isolated_borrow_rate(item)
5076
5085
  symbol = self.safe_string(borrowRate, 'symbol')
5077
5086
  result[symbol] = borrowRate
5078
5087
  return result
@@ -5108,7 +5117,7 @@ class Exchange(object):
5108
5117
 
5109
5118
  def is_trigger_order(self, params):
5110
5119
  # for backwards compatibility
5111
- return self.handleTriggerAndParams(params)
5120
+ return self.handle_trigger_and_params(params)
5112
5121
 
5113
5122
  def is_post_only(self, isMarketOrder: bool, exchangeSpecificParam, params={}):
5114
5123
  """
@@ -5199,7 +5208,7 @@ class Exchange(object):
5199
5208
  symbol = market['symbol']
5200
5209
  if not market['contract']:
5201
5210
  raise BadSymbol(self.id + ' fetchFundingRate() supports contract markets only')
5202
- rates = self.fetchFundingRates([symbol], params)
5211
+ rates = self.fetch_funding_rates([symbol], params)
5203
5212
  rate = self.safe_value(rates, symbol)
5204
5213
  if rate is None:
5205
5214
  raise NullResponse(self.id + ' fetchFundingRate() returned no data for ' + symbol)
@@ -5342,7 +5351,7 @@ class Exchange(object):
5342
5351
  currency = self.safe_currency(currencyId)
5343
5352
  code = self.safe_string(currency, 'code')
5344
5353
  if (codes is None) or (self.in_array(code, codes)):
5345
- depositWithdrawFees[code] = self.parseDepositWithdrawFee(dictionary, currency)
5354
+ depositWithdrawFees[code] = self.parse_deposit_withdraw_fee(dictionary, currency)
5346
5355
  return depositWithdrawFees
5347
5356
 
5348
5357
  def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
@@ -5429,7 +5438,7 @@ class Exchange(object):
5429
5438
  :returns dict: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
5430
5439
  """
5431
5440
  if self.has['fetchDepositsWithdrawals']:
5432
- return self.fetchDepositsWithdrawals(code, since, limit, params)
5441
+ return self.fetch_deposits_withdrawals(code, since, limit, params)
5433
5442
  else:
5434
5443
  raise NotSupported(self.id + ' fetchTransactions() is not supported yet')
5435
5444
 
@@ -5592,7 +5601,7 @@ class Exchange(object):
5592
5601
  try:
5593
5602
  if cursorValue is not None:
5594
5603
  if cursorIncrement is not None:
5595
- cursorValue = self.parseToInt(cursorValue) + cursorIncrement
5604
+ cursorValue = self.parse_to_int(cursorValue) + cursorIncrement
5596
5605
  params[cursorSent] = cursorValue
5597
5606
  response = None
5598
5607
  if method == 'fetchAccounts':
@@ -5623,7 +5632,7 @@ class Exchange(object):
5623
5632
  if errors > maxRetries:
5624
5633
  raise e
5625
5634
  i += 1
5626
- sorted = self.sortCursorPaginatedResult(result)
5635
+ sorted = self.sort_cursor_paginated_result(result)
5627
5636
  key = 0 if (method == 'fetchOHLCV') else 'timestamp'
5628
5637
  return self.filter_by_since_limit(sorted, since, limit, key)
5629
5638
 
@@ -5654,7 +5663,7 @@ class Exchange(object):
5654
5663
  if errors > maxRetries:
5655
5664
  raise e
5656
5665
  i += 1
5657
- sorted = self.sortCursorPaginatedResult(result)
5666
+ sorted = self.sort_cursor_paginated_result(result)
5658
5667
  key = 0 if (method == 'fetchOHLCV') else 'timestamp'
5659
5668
  return self.filter_by_since_limit(sorted, since, limit, key)
5660
5669
 
@@ -5689,7 +5698,7 @@ class Exchange(object):
5689
5698
  def handle_until_option(self, key: str, request, params, multiplier=1):
5690
5699
  until = self.safe_integer_2(params, 'until', 'till')
5691
5700
  if until is not None:
5692
- request[key] = self.parseToInt(until * multiplier)
5701
+ request[key] = self.parse_to_int(until * multiplier)
5693
5702
  params = self.omit(params, ['until', 'till'])
5694
5703
  return [request, params]
5695
5704
 
@@ -5721,7 +5730,7 @@ class Exchange(object):
5721
5730
  result = []
5722
5731
  for i in range(0, len(liquidations)):
5723
5732
  entry = liquidations[i]
5724
- parsed = self.parseLiquidation(entry, market)
5733
+ parsed = self.parse_liquidation(entry, market)
5725
5734
  result.append(parsed)
5726
5735
  sorted = self.sort_by(result, 'timestamp')
5727
5736
  symbol = self.safe_string(market, 'symbol')
@@ -5741,7 +5750,7 @@ class Exchange(object):
5741
5750
  currency = self.safe_currency(currencyId)
5742
5751
  marketId = self.safe_string(info, symbolKey)
5743
5752
  market = self.safe_market(marketId, None, None, 'option')
5744
- optionStructures[market['symbol']] = self.parseOption(info, currency, market)
5753
+ optionStructures[market['symbol']] = self.parse_option(info, currency, market)
5745
5754
  return optionStructures
5746
5755
 
5747
5756
  def parse_margin_modes(self, response: List[object], symbols: List[str] = None, symbolKey: Str = None, marketType: MarketType = None):
@@ -5787,7 +5796,7 @@ class Exchange(object):
5787
5796
  fromCurrency = self.safe_currency(fromId)
5788
5797
  if toId is not None:
5789
5798
  toCurrency = self.safe_currency(toId)
5790
- conversion = self.extend(self.parseConversion(entry, fromCurrency, toCurrency), params)
5799
+ conversion = self.extend(self.parse_conversion(entry, fromCurrency, toCurrency), params)
5791
5800
  result.append(conversion)
5792
5801
  sorted = self.sort_by(result, 'timestamp')
5793
5802
  currency = None
ccxt/binance.py CHANGED
@@ -4750,7 +4750,7 @@ class binance(Exchange, ImplicitAPI):
4750
4750
  cancelId = self.safe_string_2(params, 'cancelNewClientOrderId', 'cancelOrigClientOrderId')
4751
4751
  if cancelId is None:
4752
4752
  request['cancelOrderId'] = id # user can provide either cancelOrderId, cancelOrigClientOrderId or cancelOrigClientOrderId
4753
- # remove timeInForce from params because PO is only used by self.is_post_onlyand it's not a valid value for Binance
4753
+ # remove timeInForce from params because PO is only used by self.is_post_only and it's not a valid value for Binance
4754
4754
  if self.safe_string(params, 'timeInForce') == 'PO':
4755
4755
  params = self.omit(params, ['timeInForce'])
4756
4756
  params = self.omit(params, ['quoteOrderQty', 'cost', 'stopPrice', 'newClientOrderId', 'clientOrderId', 'postOnly'])
@@ -5810,7 +5810,7 @@ class binance(Exchange, ImplicitAPI):
5810
5810
  request['timeInForce'] = self.options['defaultTimeInForce'] # 'GTC' = Good To Cancel(default), 'IOC' = Immediate Or Cancel
5811
5811
  if not isPortfolioMargin and market['contract'] and postOnly:
5812
5812
  request['timeInForce'] = 'GTX'
5813
- # remove timeInForce from params because PO is only used by self.is_post_onlyand it's not a valid value for Binance
5813
+ # remove timeInForce from params because PO is only used by self.is_post_only and it's not a valid value for Binance
5814
5814
  if self.safe_string(params, 'timeInForce') == 'PO':
5815
5815
  params = self.omit(params, 'timeInForce')
5816
5816
  requestParams = self.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test'])
ccxt/bingx.py CHANGED
@@ -1016,7 +1016,7 @@ class bingx(Exchange, ImplicitAPI):
1016
1016
  if time == 0:
1017
1017
  time = None
1018
1018
  cost = self.safe_string(trade, 'quoteQty')
1019
- type = 'spot' if (cost is None) else 'swap'
1019
+ # type = 'spot' if (cost is None) else 'swap'; self is not reliable
1020
1020
  currencyId = self.safe_string_n(trade, ['currency', 'N', 'commissionAsset'])
1021
1021
  currencyCode = self.safe_currency_code(currencyId)
1022
1022
  m = self.safe_bool(trade, 'm')
@@ -1047,7 +1047,7 @@ class bingx(Exchange, ImplicitAPI):
1047
1047
  'info': trade,
1048
1048
  'timestamp': time,
1049
1049
  'datetime': self.iso8601(time),
1050
- 'symbol': self.safe_symbol(marketId, market, '-', type),
1050
+ 'symbol': self.safe_symbol(marketId, market, '-'),
1051
1051
  'order': self.safe_string_2(trade, 'orderId', 'i'),
1052
1052
  'type': self.safe_string_lower(trade, 'o'),
1053
1053
  'side': self.parse_order_side(side),
@@ -1985,7 +1985,8 @@ class bingx(Exchange, ImplicitAPI):
1985
1985
  #
1986
1986
  if isinstance(response, str):
1987
1987
  # broken api engine : order-ids are too long numbers(i.e. 1742930526912864656)
1988
- # and json.loadscan not handle them in JS, so we have to use .parse_json # however, when order has an attached SL/TP, their value types need extra parsing
1988
+ # and json.loadscan not handle them in JS, so we have to use .parseJson
1989
+ # however, when order has an attached SL/TP, their value types need extra parsing
1989
1990
  response = self.fix_stringified_json_members(response)
1990
1991
  response = self.parse_json(response)
1991
1992
  data = self.safe_value(response, 'data', {})