ccxt 4.2.30__py2.py3-none-any.whl → 4.2.34__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 (244) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/coinbase.py +10 -0
  3. ccxt/abstract/okx.py +12 -1
  4. ccxt/ace.py +4 -3
  5. ccxt/alpaca.py +1 -1
  6. ccxt/ascendex.py +6 -6
  7. ccxt/async_support/__init__.py +1 -1
  8. ccxt/async_support/ace.py +4 -3
  9. ccxt/async_support/alpaca.py +1 -1
  10. ccxt/async_support/ascendex.py +6 -6
  11. ccxt/async_support/base/exchange.py +62 -39
  12. ccxt/async_support/bigone.py +25 -5
  13. ccxt/async_support/binance.py +17 -16
  14. ccxt/async_support/bingx.py +10 -9
  15. ccxt/async_support/bit2c.py +13 -1
  16. ccxt/async_support/bitbank.py +2 -2
  17. ccxt/async_support/bitbns.py +1 -1
  18. ccxt/async_support/bitfinex.py +5 -5
  19. ccxt/async_support/bitfinex2.py +386 -40
  20. ccxt/async_support/bitflyer.py +5 -5
  21. ccxt/async_support/bitforex.py +4 -1
  22. ccxt/async_support/bitget.py +11 -11
  23. ccxt/async_support/bithumb.py +2 -2
  24. ccxt/async_support/bitmart.py +9 -9
  25. ccxt/async_support/bitmex.py +3 -3
  26. ccxt/async_support/bitopro.py +2 -2
  27. ccxt/async_support/bitrue.py +8 -8
  28. ccxt/async_support/bitso.py +4 -4
  29. ccxt/async_support/bitstamp.py +2 -2
  30. ccxt/async_support/bitteam.py +1 -1
  31. ccxt/async_support/bitvavo.py +3 -3
  32. ccxt/async_support/bl3p.py +1 -1
  33. ccxt/async_support/blockchaincom.py +3 -3
  34. ccxt/async_support/btcalpha.py +1 -1
  35. ccxt/async_support/btcbox.py +1 -1
  36. ccxt/async_support/btcmarkets.py +2 -2
  37. ccxt/async_support/btcturk.py +1 -1
  38. ccxt/async_support/bybit.py +9 -9
  39. ccxt/async_support/cex.py +1 -1
  40. ccxt/async_support/coinbase.py +16 -6
  41. ccxt/async_support/coinbasepro.py +2 -2
  42. ccxt/async_support/coincheck.py +1 -1
  43. ccxt/async_support/coinex.py +9 -9
  44. ccxt/async_support/coinlist.py +4 -4
  45. ccxt/async_support/coinmate.py +2 -2
  46. ccxt/async_support/coinmetro.py +2 -2
  47. ccxt/async_support/coinone.py +1 -1
  48. ccxt/async_support/coinsph.py +2 -2
  49. ccxt/async_support/coinspot.py +1 -1
  50. ccxt/async_support/cryptocom.py +14 -14
  51. ccxt/async_support/currencycom.py +1 -1
  52. ccxt/async_support/delta.py +2 -2
  53. ccxt/async_support/deribit.py +5 -4
  54. ccxt/async_support/digifinex.py +6 -6
  55. ccxt/async_support/exmo.py +2 -2
  56. ccxt/async_support/gate.py +41 -37
  57. ccxt/async_support/gemini.py +2 -2
  58. ccxt/async_support/hitbtc.py +5 -5
  59. ccxt/async_support/hollaex.py +2 -2
  60. ccxt/async_support/htx.py +11 -11
  61. ccxt/async_support/huobijp.py +4 -4
  62. ccxt/async_support/idex.py +2 -2
  63. ccxt/async_support/independentreserve.py +2 -2
  64. ccxt/async_support/indodax.py +2 -2
  65. ccxt/async_support/kraken.py +45 -5
  66. ccxt/async_support/krakenfutures.py +8 -5
  67. ccxt/async_support/kucoin.py +8 -8
  68. ccxt/async_support/kucoinfutures.py +4 -4
  69. ccxt/async_support/kuna.py +2 -2
  70. ccxt/async_support/latoken.py +3 -3
  71. ccxt/async_support/lbank.py +5 -4
  72. ccxt/async_support/luno.py +1 -1
  73. ccxt/async_support/lykke.py +2 -2
  74. ccxt/async_support/mercado.py +2 -2
  75. ccxt/async_support/mexc.py +7 -6
  76. ccxt/async_support/ndax.py +2 -2
  77. ccxt/async_support/novadax.py +4 -4
  78. ccxt/async_support/oceanex.py +1 -1
  79. ccxt/async_support/okcoin.py +5 -5
  80. ccxt/async_support/okx.py +26 -12
  81. ccxt/async_support/onetrading.py +2 -2
  82. ccxt/async_support/p2b.py +1 -1
  83. ccxt/async_support/paymium.py +3 -3
  84. ccxt/async_support/phemex.py +13 -13
  85. ccxt/async_support/poloniex.py +4 -4
  86. ccxt/async_support/poloniexfutures.py +4 -1
  87. ccxt/async_support/probit.py +5 -5
  88. ccxt/async_support/timex.py +2 -2
  89. ccxt/async_support/tokocrypto.py +4 -4
  90. ccxt/async_support/upbit.py +2 -2
  91. ccxt/async_support/wavesexchange.py +4 -3
  92. ccxt/async_support/wazirx.py +1 -1
  93. ccxt/async_support/whitebit.py +6 -6
  94. ccxt/async_support/woo.py +6 -6
  95. ccxt/async_support/yobit.py +41 -2
  96. ccxt/async_support/zaif.py +2 -2
  97. ccxt/async_support/zonda.py +4 -4
  98. ccxt/base/exchange.py +77 -44
  99. ccxt/base/types.py +10 -0
  100. ccxt/bigone.py +25 -5
  101. ccxt/binance.py +17 -16
  102. ccxt/bingx.py +10 -9
  103. ccxt/bit2c.py +13 -1
  104. ccxt/bitbank.py +2 -2
  105. ccxt/bitbns.py +1 -1
  106. ccxt/bitfinex.py +5 -5
  107. ccxt/bitfinex2.py +386 -40
  108. ccxt/bitflyer.py +5 -5
  109. ccxt/bitforex.py +4 -1
  110. ccxt/bitget.py +11 -11
  111. ccxt/bithumb.py +2 -2
  112. ccxt/bitmart.py +9 -9
  113. ccxt/bitmex.py +3 -3
  114. ccxt/bitopro.py +2 -2
  115. ccxt/bitrue.py +8 -8
  116. ccxt/bitso.py +4 -4
  117. ccxt/bitstamp.py +2 -2
  118. ccxt/bitteam.py +1 -1
  119. ccxt/bitvavo.py +3 -3
  120. ccxt/bl3p.py +1 -1
  121. ccxt/blockchaincom.py +3 -3
  122. ccxt/btcalpha.py +1 -1
  123. ccxt/btcbox.py +1 -1
  124. ccxt/btcmarkets.py +2 -2
  125. ccxt/btcturk.py +1 -1
  126. ccxt/bybit.py +9 -9
  127. ccxt/cex.py +1 -1
  128. ccxt/coinbase.py +16 -6
  129. ccxt/coinbasepro.py +2 -2
  130. ccxt/coincheck.py +1 -1
  131. ccxt/coinex.py +9 -9
  132. ccxt/coinlist.py +4 -4
  133. ccxt/coinmate.py +2 -2
  134. ccxt/coinmetro.py +2 -2
  135. ccxt/coinone.py +1 -1
  136. ccxt/coinsph.py +2 -2
  137. ccxt/coinspot.py +1 -1
  138. ccxt/cryptocom.py +14 -14
  139. ccxt/currencycom.py +1 -1
  140. ccxt/delta.py +2 -2
  141. ccxt/deribit.py +5 -4
  142. ccxt/digifinex.py +6 -6
  143. ccxt/exmo.py +2 -2
  144. ccxt/gate.py +41 -37
  145. ccxt/gemini.py +2 -2
  146. ccxt/hitbtc.py +5 -5
  147. ccxt/hollaex.py +2 -2
  148. ccxt/htx.py +11 -11
  149. ccxt/huobijp.py +4 -4
  150. ccxt/idex.py +2 -2
  151. ccxt/independentreserve.py +2 -2
  152. ccxt/indodax.py +2 -2
  153. ccxt/kraken.py +45 -5
  154. ccxt/krakenfutures.py +8 -5
  155. ccxt/kucoin.py +8 -8
  156. ccxt/kucoinfutures.py +4 -4
  157. ccxt/kuna.py +2 -2
  158. ccxt/latoken.py +3 -3
  159. ccxt/lbank.py +5 -4
  160. ccxt/luno.py +1 -1
  161. ccxt/lykke.py +2 -2
  162. ccxt/mercado.py +2 -2
  163. ccxt/mexc.py +7 -6
  164. ccxt/ndax.py +2 -2
  165. ccxt/novadax.py +4 -4
  166. ccxt/oceanex.py +1 -1
  167. ccxt/okcoin.py +5 -5
  168. ccxt/okx.py +26 -12
  169. ccxt/onetrading.py +2 -2
  170. ccxt/p2b.py +1 -1
  171. ccxt/paymium.py +3 -3
  172. ccxt/phemex.py +13 -13
  173. ccxt/poloniex.py +4 -4
  174. ccxt/poloniexfutures.py +4 -1
  175. ccxt/pro/__init__.py +1 -1
  176. ccxt/pro/alpaca.py +8 -4
  177. ccxt/pro/ascendex.py +1 -2
  178. ccxt/pro/binance.py +14 -10
  179. ccxt/pro/bingx.py +1 -1
  180. ccxt/pro/bitfinex.py +21 -22
  181. ccxt/pro/bitfinex2.py +13 -15
  182. ccxt/pro/bitget.py +3 -1
  183. ccxt/pro/bitmart.py +3 -7
  184. ccxt/pro/bitmex.py +4 -6
  185. ccxt/pro/bitopro.py +2 -4
  186. ccxt/pro/bitrue.py +1 -1
  187. ccxt/pro/bitstamp.py +2 -3
  188. ccxt/pro/bitvavo.py +10 -5
  189. ccxt/pro/blockchaincom.py +22 -22
  190. ccxt/pro/bybit.py +5 -5
  191. ccxt/pro/cex.py +7 -7
  192. ccxt/pro/coinbase.py +3 -2
  193. ccxt/pro/coinbasepro.py +1 -1
  194. ccxt/pro/coinex.py +15 -13
  195. ccxt/pro/currencycom.py +5 -6
  196. ccxt/pro/deribit.py +4 -4
  197. ccxt/pro/exmo.py +15 -13
  198. ccxt/pro/gate.py +1 -1
  199. ccxt/pro/gemini.py +4 -2
  200. ccxt/pro/hitbtc.py +10 -9
  201. ccxt/pro/hollaex.py +2 -2
  202. ccxt/pro/htx.py +6 -6
  203. ccxt/pro/huobijp.py +3 -4
  204. ccxt/pro/idex.py +1 -1
  205. ccxt/pro/independentreserve.py +14 -13
  206. ccxt/pro/kraken.py +10 -14
  207. ccxt/pro/krakenfutures.py +10 -6
  208. ccxt/pro/kucoin.py +10 -10
  209. ccxt/pro/kucoinfutures.py +11 -10
  210. ccxt/pro/lbank.py +10 -10
  211. ccxt/pro/luno.py +12 -14
  212. ccxt/pro/mexc.py +3 -2
  213. ccxt/pro/ndax.py +7 -11
  214. ccxt/pro/okcoin.py +7 -10
  215. ccxt/pro/okx.py +6 -9
  216. ccxt/pro/onetrading.py +16 -15
  217. ccxt/pro/p2b.py +5 -3
  218. ccxt/pro/phemex.py +16 -11
  219. ccxt/pro/poloniex.py +6 -4
  220. ccxt/pro/poloniexfutures.py +13 -9
  221. ccxt/pro/probit.py +15 -12
  222. ccxt/pro/upbit.py +8 -8
  223. ccxt/pro/wazirx.py +6 -3
  224. ccxt/pro/woo.py +9 -7
  225. ccxt/probit.py +5 -5
  226. ccxt/test/base/test_order_book.py +7 -7
  227. ccxt/test/base/test_shared_methods.py +1 -1
  228. ccxt/test/test_async.py +86 -36
  229. ccxt/test/test_sync.py +86 -36
  230. ccxt/timex.py +2 -2
  231. ccxt/tokocrypto.py +4 -4
  232. ccxt/upbit.py +2 -2
  233. ccxt/wavesexchange.py +4 -3
  234. ccxt/wazirx.py +1 -1
  235. ccxt/whitebit.py +6 -6
  236. ccxt/woo.py +6 -6
  237. ccxt/yobit.py +41 -2
  238. ccxt/zaif.py +2 -2
  239. ccxt/zonda.py +4 -4
  240. {ccxt-4.2.30.dist-info → ccxt-4.2.34.dist-info}/METADATA +10 -10
  241. ccxt-4.2.34.dist-info/RECORD +438 -0
  242. ccxt-4.2.30.dist-info/RECORD +0 -438
  243. {ccxt-4.2.30.dist-info → ccxt-4.2.34.dist-info}/WHEEL +0 -0
  244. {ccxt-4.2.30.dist-info → ccxt-4.2.34.dist-info}/top_level.txt +0 -0
ccxt/phemex.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.phemex import ImplicitAPI
8
8
  import hashlib
9
9
  import numbers
10
- from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Num, Str, Strings, Ticker, Tickers, Trade, Transaction
10
+ from ccxt.base.types import Balances, Currency, Int, Market, Order, TransferEntry, OrderBook, OrderSide, OrderType, Num, Str, Strings, Ticker, Tickers, Trade, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -1123,7 +1123,7 @@ class phemex(Exchange, ImplicitAPI):
1123
1123
  return orderbook
1124
1124
 
1125
1125
  def to_en(self, n, scale):
1126
- stringN = str(n)
1126
+ stringN = self.number_to_string(n)
1127
1127
  precise = Precise(stringN)
1128
1128
  precise.decimals = precise.decimals - scale
1129
1129
  precise.reduce()
@@ -2341,7 +2341,7 @@ class phemex(Exchange, ImplicitAPI):
2341
2341
  return self.parse_swap_order(order, market)
2342
2342
  return self.parse_spot_order(order, market)
2343
2343
 
2344
- def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
2344
+ def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}):
2345
2345
  """
2346
2346
  create a trade order
2347
2347
  :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#place-order
@@ -2427,10 +2427,10 @@ class phemex(Exchange, ImplicitAPI):
2427
2427
  elif cost is None:
2428
2428
  raise ArgumentsRequired(self.id + ' createOrder() ' + qtyType + ' requires a price argument or a cost parameter')
2429
2429
  cost = amount if (cost is None) else cost
2430
- costString = str(cost)
2430
+ costString = self.number_to_string(cost)
2431
2431
  request['quoteQtyEv'] = self.to_ev(costString, market)
2432
2432
  else:
2433
- amountString = str(amount)
2433
+ amountString = self.number_to_string(amount)
2434
2434
  request['baseQtyEv'] = self.to_ev(amountString, market)
2435
2435
  elif market['swap']:
2436
2436
  posSide = self.safe_string_lower(params, 'posSide')
@@ -2443,7 +2443,7 @@ class phemex(Exchange, ImplicitAPI):
2443
2443
  if market['settle'] == 'USDT':
2444
2444
  request['orderQtyRq'] = amount
2445
2445
  else:
2446
- request['orderQty'] = int(amount)
2446
+ request['orderQty'] = self.parse_to_int(amount)
2447
2447
  if stopPrice is not None:
2448
2448
  triggerType = self.safe_string(params, 'triggerType', 'ByMarkPrice')
2449
2449
  request['triggerType'] = triggerType
@@ -4013,7 +4013,7 @@ class phemex(Exchange, ImplicitAPI):
4013
4013
  url = self.implode_hostname(self.urls['api'][api]) + url
4014
4014
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
4015
4015
 
4016
- def set_leverage(self, leverage, symbol: Str = None, params={}):
4016
+ def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
4017
4017
  """
4018
4018
  set the level of leverage for a market
4019
4019
  :see: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#set-leverage
@@ -4044,17 +4044,17 @@ class phemex(Exchange, ImplicitAPI):
4044
4044
  if not isHedged and longLeverageRr is None and shortLeverageRr is None:
4045
4045
  request['leverageRr'] = leverage
4046
4046
  else:
4047
- long = longLeverageRr if (longLeverageRr is not None) else leverage
4048
- short = shortLeverageRr if (shortLeverageRr is not None) else leverage
4049
- request['longLeverageRr'] = long
4050
- request['shortLeverageRr'] = short
4047
+ longVar = longLeverageRr if (longLeverageRr is not None) else leverage
4048
+ shortVar = shortLeverageRr if (shortLeverageRr is not None) else leverage
4049
+ request['longLeverageRr'] = longVar
4050
+ request['shortLeverageRr'] = shortVar
4051
4051
  response = self.privatePutGPositionsLeverage(self.extend(request, params))
4052
4052
  else:
4053
4053
  request['leverage'] = leverage
4054
4054
  response = self.privatePutPositionsLeverage(self.extend(request, params))
4055
4055
  return response
4056
4056
 
4057
- def transfer(self, code: str, amount, fromAccount, toAccount, params={}):
4057
+ def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
4058
4058
  """
4059
4059
  transfer currency internally between wallets on the same account
4060
4060
  :param str code: unified currency code
@@ -4311,7 +4311,7 @@ class phemex(Exchange, ImplicitAPI):
4311
4311
  sorted = self.sort_by(result, 'timestamp')
4312
4312
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
4313
4313
 
4314
- def withdraw(self, code: str, amount, address, tag=None, params={}):
4314
+ def withdraw(self, code: str, amount: float, address, tag=None, params={}):
4315
4315
  """
4316
4316
  make a withdrawal
4317
4317
  :see: https://phemex-docs.github.io/#create-withdraw-request
ccxt/poloniex.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.poloniex import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Order, TransferEntry, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -1212,7 +1212,7 @@ class poloniex(Exchange, ImplicitAPI):
1212
1212
  extension = {'status': 'open'}
1213
1213
  return self.parse_orders(response, market, since, limit, extension)
1214
1214
 
1215
- def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
1215
+ def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}):
1216
1216
  """
1217
1217
  create a trade order
1218
1218
  :see: https://docs.poloniex.com/#authenticated-endpoints-orders-create-order
@@ -1736,7 +1736,7 @@ class poloniex(Exchange, ImplicitAPI):
1736
1736
  'info': response,
1737
1737
  }
1738
1738
 
1739
- def transfer(self, code: str, amount, fromAccount, toAccount, params={}):
1739
+ def transfer(self, code: str, amount: float, fromAccount, toAccount, params={}) -> TransferEntry:
1740
1740
  """
1741
1741
  transfer currency internally between wallets on the same account
1742
1742
  :see: https://docs.poloniex.com/#authenticated-endpoints-accounts-accounts-transfer
@@ -1785,7 +1785,7 @@ class poloniex(Exchange, ImplicitAPI):
1785
1785
  'status': None,
1786
1786
  }
1787
1787
 
1788
- def withdraw(self, code: str, amount, address, tag=None, params={}):
1788
+ def withdraw(self, code: str, amount: float, address, tag=None, params={}):
1789
1789
  """
1790
1790
  make a withdrawal
1791
1791
  :see: https://docs.poloniex.com/#authenticated-endpoints-wallets-withdraw-currency
ccxt/poloniexfutures.py CHANGED
@@ -45,6 +45,9 @@ class poloniexfutures(Exchange, ImplicitAPI):
45
45
  'fetchBalance': True,
46
46
  'fetchClosedOrders': True,
47
47
  'fetchCurrencies': False,
48
+ 'fetchDepositAddress': False,
49
+ 'fetchDepositAddresses': False,
50
+ 'fetchDepositAddressesByNetwork': False,
48
51
  'fetchFundingRate': True,
49
52
  'fetchFundingRateHistory': False,
50
53
  'fetchL3OrderBook': True,
@@ -777,7 +780,7 @@ class poloniexfutures(Exchange, ImplicitAPI):
777
780
  #
778
781
  return self.parse_balance(response)
779
782
 
780
- def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
783
+ def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}):
781
784
  """
782
785
  Create an order on the exchange
783
786
  :see: https://futures-docs.poloniex.com/#place-an-order
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.30'
7
+ __version__ = '4.2.34'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/alpaca.py CHANGED
@@ -591,11 +591,14 @@ class alpaca(ccxt.async_support.alpaca):
591
591
  T = self.safe_string(data, 'T')
592
592
  msg = self.safe_value(data, 'msg', {})
593
593
  if T == 'subscription':
594
- return self.handle_subscription(client, data)
594
+ self.handle_subscription(client, data)
595
+ return
595
596
  if T == 'success' and msg == 'connected':
596
- return self.handle_connected(client, data)
597
+ self.handle_connected(client, data)
598
+ return
597
599
  if T == 'success' and msg == 'authenticated':
598
- return self.handle_authenticate(client, data)
600
+ self.handle_authenticate(client, data)
601
+ return
599
602
  methods = {
600
603
  'error': self.handle_error_message,
601
604
  'b': self.handle_ohlcv,
@@ -620,7 +623,8 @@ class alpaca(ccxt.async_support.alpaca):
620
623
 
621
624
  def handle_message(self, client: Client, message):
622
625
  if isinstance(message, list):
623
- return self.handle_crypto_message(client, message)
626
+ self.handle_crypto_message(client, message)
627
+ return
624
628
  self.handle_trading_message(client, message)
625
629
 
626
630
  def handle_authenticate(self, client: Client, message):
ccxt/pro/ascendex.py CHANGED
@@ -843,7 +843,6 @@ class ascendex(ccxt.async_support.ascendex):
843
843
  self.handle_order(client, message)
844
844
  if subject == 'order':
845
845
  self.handle_balance(client, message)
846
- return message
847
846
 
848
847
  def handle_subscription_status(self, client: Client, message):
849
848
  #
@@ -879,7 +878,7 @@ class ascendex(ccxt.async_support.ascendex):
879
878
  def handle_ping(self, client: Client, message):
880
879
  self.spawn(self.pong, client, message)
881
880
 
882
- def authenticate(self, url, params={}):
881
+ async def authenticate(self, url, params={}):
883
882
  self.check_required_credentials()
884
883
  messageHash = 'authenticated'
885
884
  client = self.client(url)
ccxt/pro/binance.py CHANGED
@@ -491,7 +491,7 @@ class binance(ccxt.async_support.binance):
491
491
  """
492
492
  return await self.watch_trades_for_symbols([symbol], since, limit, params)
493
493
 
494
- def parse_trade(self, trade, market=None) -> Trade:
494
+ def parse_ws_trade(self, trade, market=None) -> Trade:
495
495
  #
496
496
  # public watchTrades
497
497
  #
@@ -599,7 +599,7 @@ class binance(ccxt.async_support.binance):
599
599
  executionType = self.safe_string(trade, 'x')
600
600
  isTradeExecution = (executionType == 'TRADE')
601
601
  if not isTradeExecution:
602
- return super(binance, self).parse_trade(trade, market)
602
+ return self.parse_trade(trade, market)
603
603
  id = self.safe_string_2(trade, 't', 'a')
604
604
  timestamp = self.safe_integer(trade, 'T')
605
605
  price = self.safe_string_2(trade, 'L', 'p')
@@ -657,7 +657,7 @@ class binance(ccxt.async_support.binance):
657
657
  lowerCaseId = self.safe_string_lower(message, 's')
658
658
  event = self.safe_string(message, 'e')
659
659
  messageHash = lowerCaseId + '@' + event
660
- trade = self.parse_trade(message, market)
660
+ trade = self.parse_ws_trade(message, market)
661
661
  tradesArray = self.safe_value(self.trades, symbol)
662
662
  if tradesArray is None:
663
663
  limit = self.safe_integer(self.options, 'tradesLimit', 1000)
@@ -1146,11 +1146,12 @@ class binance(ccxt.async_support.binance):
1146
1146
  for j in range(0, len(subscriptionKeys)):
1147
1147
  subscribeType = subscriptionKeys[j]
1148
1148
  if subscribeType == type:
1149
- return self.delay(listenKeyRefreshRate, self.keep_alive_listen_key, params)
1149
+ self.delay(listenKeyRefreshRate, self.keep_alive_listen_key, params)
1150
+ return
1150
1151
 
1151
1152
  def set_balance_cache(self, client: Client, type):
1152
1153
  if type in client.subscriptions:
1153
- return None
1154
+ return
1154
1155
  options = self.safe_value(self.options, 'watchBalance')
1155
1156
  fetchBalanceSnapshot = self.safe_bool(options, 'fetchBalanceSnapshot', False)
1156
1157
  if fetchBalanceSnapshot:
@@ -1245,7 +1246,7 @@ class binance(ccxt.async_support.binance):
1245
1246
  #
1246
1247
  messageHash = self.safe_string(message, 'id')
1247
1248
  result = self.safe_value(message, 'result', {})
1248
- parsedBalances = self.parse_balance(result, 'spot')
1249
+ parsedBalances = self.parse_balance(result)
1249
1250
  client.resolve(parsedBalances, messageHash)
1250
1251
 
1251
1252
  async def watch_balance(self, params={}) -> Balances:
@@ -2501,12 +2502,14 @@ class binance(ccxt.async_support.binance):
2501
2502
  status = self.safe_string(message, 'status')
2502
2503
  error = self.safe_value(message, 'error')
2503
2504
  if (error is not None) or (status is not None and status != '200'):
2504
- return self.handle_ws_error(client, message)
2505
+ self.handle_ws_error(client, message)
2506
+ return
2505
2507
  id = self.safe_string(message, 'id')
2506
2508
  subscriptions = self.safe_value(client.subscriptions, id)
2507
2509
  method = self.safe_value(subscriptions, 'method')
2508
2510
  if method is not None:
2509
- return method(client, message)
2511
+ method(client, message)
2512
+ return
2510
2513
  # handle other APIs
2511
2514
  methods = {
2512
2515
  'depthUpdate': self.handle_order_book,
@@ -2534,7 +2537,8 @@ class binance(ccxt.async_support.binance):
2534
2537
  if method is None:
2535
2538
  requestId = self.safe_string(message, 'id')
2536
2539
  if requestId is not None:
2537
- return self.handle_subscription_status(client, message)
2540
+ self.handle_subscription_status(client, message)
2541
+ return
2538
2542
  # special case for the real-time bookTicker, since it comes without an event identifier
2539
2543
  #
2540
2544
  # {
@@ -2550,4 +2554,4 @@ class binance(ccxt.async_support.binance):
2550
2554
  self.handle_ticker(client, message)
2551
2555
  self.handle_tickers(client, message)
2552
2556
  else:
2553
- return method(client, message)
2557
+ method(client, message)
ccxt/pro/bingx.py CHANGED
@@ -675,7 +675,7 @@ class bingx(ccxt.async_support.bingx):
675
675
 
676
676
  def set_balance_cache(self, client: Client, type, subscriptionHash, params):
677
677
  if subscriptionHash in client.subscriptions:
678
- return None
678
+ return
679
679
  fetchBalanceSnapshot = self.handle_option_and_params(params, 'watchBalance', 'fetchBalanceSnapshot', True)
680
680
  if fetchBalanceSnapshot:
681
681
  messageHash = type + ':fetchBalanceSnapshot'
ccxt/pro/bitfinex.py CHANGED
@@ -129,7 +129,6 @@ class bitfinex(ccxt.async_support.bitfinex):
129
129
  trade = self.parse_trade(message, market)
130
130
  stored.append(trade)
131
131
  client.resolve(stored, messageHash)
132
- return message
133
132
 
134
133
  def parse_trade(self, trade, market=None) -> Trade:
135
134
  #
@@ -308,35 +307,39 @@ class bitfinex(ccxt.async_support.bitfinex):
308
307
  delta = deltas[i]
309
308
  id = self.safe_string(delta, 0)
310
309
  price = self.safe_float(delta, 1)
311
- size = -delta[2] if (delta[2] < 0) else delta[2]
312
- side = 'asks' if (delta[2] < 0) else 'bids'
310
+ delta2Value = delta[2]
311
+ size = -delta2Value if (delta2Value < 0) else delta2Value
312
+ side = 'asks' if (delta2Value < 0) else 'bids'
313
313
  bookside = orderbook[side]
314
314
  bookside.store(price, size, id)
315
315
  else:
316
316
  deltas = message[1]
317
317
  for i in range(0, len(deltas)):
318
318
  delta = deltas[i]
319
- size = -delta[2] if (delta[2] < 0) else delta[2]
320
- side = 'asks' if (delta[2] < 0) else 'bids'
321
- bookside = orderbook[side]
322
- bookside.store(delta[0], size, delta[1])
319
+ delta2 = delta[2]
320
+ size = -delta2 if (delta2 < 0) else delta2
321
+ side = 'asks' if (delta2 < 0) else 'bids'
322
+ countedBookSide = orderbook[side]
323
+ countedBookSide.store(delta[0], size, delta[1])
323
324
  client.resolve(orderbook, messageHash)
324
325
  else:
325
326
  orderbook = self.orderbooks[symbol]
326
327
  if isRaw:
327
328
  id = self.safe_string(message, 1)
328
329
  price = self.safe_string(message, 2)
329
- size = -message[3] if (message[3] < 0) else message[3]
330
- side = 'asks' if (message[3] < 0) else 'bids'
330
+ message3 = message[3]
331
+ size = -message3 if (message3 < 0) else message3
332
+ side = 'asks' if (message3 < 0) else 'bids'
331
333
  bookside = orderbook[side]
332
334
  # price = 0 means that you have to remove the order from your book
333
335
  amount = size if Precise.string_gt(price, '0') else '0'
334
336
  bookside.store(self.parse_number(price), self.parse_number(amount), id)
335
337
  else:
336
- size = -message[3] if (message[3] < 0) else message[3]
337
- side = 'asks' if (message[3] < 0) else 'bids'
338
- bookside = orderbook[side]
339
- bookside.store(message[1], size, message[2])
338
+ message3Value = message[3]
339
+ size = -message3Value if (message3Value < 0) else message3Value
340
+ side = 'asks' if (message3Value < 0) else 'bids'
341
+ countedBookSide = orderbook[side]
342
+ countedBookSide.store(message[1], size, message[2])
340
343
  client.resolve(orderbook, messageHash)
341
344
 
342
345
  def handle_heartbeat(self, client: Client, message):
@@ -579,7 +582,7 @@ class bitfinex(ccxt.async_support.bitfinex):
579
582
  # ]
580
583
  #
581
584
  if message[1] == 'hb':
582
- return message # skip heartbeats within subscription channels for now
585
+ return # skip heartbeats within subscription channels for now
583
586
  subscription = self.safe_value(client.subscriptions, channelId, {})
584
587
  channel = self.safe_string(subscription, 'channel')
585
588
  name = self.safe_string(message, 1)
@@ -593,10 +596,8 @@ class bitfinex(ccxt.async_support.bitfinex):
593
596
  'oc': self.handle_orders,
594
597
  }
595
598
  method = self.safe_value_2(methods, channel, name)
596
- if method is None:
597
- return message
598
- else:
599
- return method(client, message, subscription)
599
+ if method is not None:
600
+ method(client, message, subscription)
600
601
  else:
601
602
  # todo add bitfinex handleErrorMessage
602
603
  #
@@ -616,7 +617,5 @@ class bitfinex(ccxt.async_support.bitfinex):
616
617
  'auth': self.handle_authentication_message,
617
618
  }
618
619
  method = self.safe_value(methods, event)
619
- if method is None:
620
- return message
621
- else:
622
- return method(client, message)
620
+ if method is not None:
621
+ method(client, message)
ccxt/pro/bitfinex2.py CHANGED
@@ -324,7 +324,6 @@ class bitfinex2(ccxt.async_support.bitfinex2):
324
324
  parsed = self.parse_ws_trade(trade, market)
325
325
  stored.append(parsed)
326
326
  client.resolve(stored, messageHash)
327
- return message
328
327
 
329
328
  def parse_ws_trade(self, trade, market=None):
330
329
  #
@@ -563,8 +562,9 @@ class bitfinex2(ccxt.async_support.bitfinex2):
563
562
  deltas = message[1]
564
563
  for i in range(0, len(deltas)):
565
564
  delta = deltas[i]
566
- size = -delta[2] if (delta[2] < 0) else delta[2]
567
- side = 'asks' if (delta[2] < 0) else 'bids'
565
+ delta2 = delta[2]
566
+ size = -delta2 if (delta2 < 0) else delta2
567
+ side = 'asks' if (delta2 < 0) else 'bids'
568
568
  bookside = orderbook[side]
569
569
  idString = self.safe_string(delta, 0)
570
570
  price = self.safe_float(delta, 1)
@@ -587,8 +587,9 @@ class bitfinex2(ccxt.async_support.bitfinex2):
587
587
  orderbookItem = self.orderbooks[symbol]
588
588
  if isRaw:
589
589
  price = self.safe_string(deltas, 1)
590
- size = -deltas[2] if (deltas[2] < 0) else deltas[2]
591
- side = 'asks' if (deltas[2] < 0) else 'bids'
590
+ deltas2 = deltas[2]
591
+ size = -deltas2 if (deltas2 < 0) else deltas2
592
+ side = 'asks' if (deltas2 < 0) else 'bids'
592
593
  bookside = orderbookItem[side]
593
594
  # price = 0 means that you have to remove the order from your book
594
595
  amount = size if Precise.string_gt(price, '0') else '0'
@@ -631,7 +632,8 @@ class bitfinex2(ccxt.async_support.bitfinex2):
631
632
  stringArray.append(self.number_to_string(bids[i][1]))
632
633
  if ask is not None:
633
634
  stringArray.append(self.number_to_string(asks[i][idToCheck]))
634
- stringArray.append(self.number_to_string(-asks[i][1]))
635
+ aski1 = asks[i][1]
636
+ stringArray.append(self.number_to_string(-aski1))
635
637
  payload = ':'.join(stringArray)
636
638
  localChecksum = self.crc32(payload, True)
637
639
  responseChecksum = self.safe_integer(message, 2)
@@ -1036,7 +1038,7 @@ class bitfinex2(ccxt.async_support.bitfinex2):
1036
1038
  #
1037
1039
  if isinstance(message, list):
1038
1040
  if message[1] == 'hb':
1039
- return message # skip heartbeats within subscription channels for now
1041
+ return # skip heartbeats within subscription channels for now
1040
1042
  subscription = self.safe_value(client.subscriptions, channelId, {})
1041
1043
  channel = self.safe_string(subscription, 'channel')
1042
1044
  name = self.safe_string(message, 1)
@@ -1061,10 +1063,8 @@ class bitfinex2(ccxt.async_support.bitfinex2):
1061
1063
  method = self.safe_value(privateMethods, name)
1062
1064
  else:
1063
1065
  method = self.safe_value_2(publicMethods, name, channel)
1064
- if method is None:
1065
- return message
1066
- else:
1067
- return method(client, message, subscription)
1066
+ if method is not None:
1067
+ method(client, message, subscription)
1068
1068
  else:
1069
1069
  event = self.safe_string(message, 'event')
1070
1070
  if event is not None:
@@ -1074,7 +1074,5 @@ class bitfinex2(ccxt.async_support.bitfinex2):
1074
1074
  'auth': self.handle_authentication_message,
1075
1075
  }
1076
1076
  method = self.safe_value(methods, event)
1077
- if method is None:
1078
- return message
1079
- else:
1080
- return method(client, message)
1077
+ if method is not None:
1078
+ method(client, message)
ccxt/pro/bitget.py CHANGED
@@ -100,7 +100,9 @@ class bitget(ccxt.async_support.bitget):
100
100
  instType, params = self.handleProductTypeAndParams(market, params)
101
101
  else:
102
102
  instType = 'SPOT'
103
- instType, params = self.handle_option_and_params(params, 'getInstType', 'instType', instType)
103
+ instypeAux = None
104
+ instypeAux, params = self.handle_option_and_params(params, 'getInstType', 'instType', instType)
105
+ instType = instypeAux
104
106
  return [instType, params]
105
107
 
106
108
  async def watch_ticker(self, symbol: str, params={}) -> Ticker:
ccxt/pro/bitmart.py CHANGED
@@ -766,7 +766,6 @@ class bitmart(ccxt.async_support.bitmart):
766
766
  if isSpot:
767
767
  messageHash += ':' + self.safe_string(data[0], 'symbol')
768
768
  client.resolve(stored, messageHash)
769
- return message
770
769
 
771
770
  def parse_ws_trade(self, trade, market: Market = None):
772
771
  # spot
@@ -864,7 +863,6 @@ class bitmart(ccxt.async_support.bitmart):
864
863
  self.tickers[symbol] = ticker
865
864
  client.resolve(ticker, 'tickers::swap')
866
865
  self.resolve_message_hashes_for_symbol(client, symbol, ticker, 'tickers::')
867
- return message
868
866
 
869
867
  def resolve_message_hashes_for_symbol(self, client, symbol, result, prexif):
870
868
  prefixSeparator = '::'
@@ -1357,10 +1355,8 @@ class bitmart(ccxt.async_support.bitmart):
1357
1355
  'subscribe': self.handle_subscription_status,
1358
1356
  }
1359
1357
  method = self.safe_value(methods, event)
1360
- if method is None:
1361
- return message
1362
- else:
1363
- return method(client, message)
1358
+ if method is not None:
1359
+ method(client, message)
1364
1360
  else:
1365
1361
  methods = {
1366
1362
  'depth': self.handle_order_book,
@@ -1377,4 +1373,4 @@ class bitmart(ccxt.async_support.bitmart):
1377
1373
  key = keys[i]
1378
1374
  if channel.find(key) >= 0:
1379
1375
  method = self.safe_value(methods, key)
1380
- return method(client, message)
1376
+ method(client, message)
ccxt/pro/bitmex.py CHANGED
@@ -1462,7 +1462,7 @@ class bitmex(ccxt.async_support.bitmex):
1462
1462
  #
1463
1463
  # {"error": "Rate limit exceeded, retry in 29 seconds."}
1464
1464
  #
1465
- error = self.safe_value(message, 'error')
1465
+ error = self.safe_string(message, 'error')
1466
1466
  if error is not None:
1467
1467
  request = self.safe_value(message, 'request', {})
1468
1468
  args = self.safe_value(request, 'args', [])
@@ -1473,7 +1473,7 @@ class bitmex(ccxt.async_support.bitmex):
1473
1473
  broadKey = self.find_broadly_matched_key(broad, error)
1474
1474
  exception = None
1475
1475
  if broadKey is None:
1476
- exception = ExchangeError(error)
1476
+ exception = ExchangeError(error) # c# requirement for now
1477
1477
  else:
1478
1478
  exception = broad[broadKey](error)
1479
1479
  client.reject(exception, messageHash)
@@ -1537,8 +1537,6 @@ class bitmex(ccxt.async_support.bitmex):
1537
1537
  request = self.safe_value(message, 'request', {})
1538
1538
  op = self.safe_value(request, 'op')
1539
1539
  if op == 'authKeyExpires':
1540
- return self.handle_authentication_message(client, message)
1541
- else:
1542
- return message
1540
+ self.handle_authentication_message(client, message)
1543
1541
  else:
1544
- return method(client, message)
1542
+ method(client, message)
ccxt/pro/bitopro.py CHANGED
@@ -440,7 +440,5 @@ class bitopro(ccxt.async_support.bitopro):
440
440
  }
441
441
  event = self.safe_string(message, 'event')
442
442
  method = self.safe_value(methods, event)
443
- if method is None:
444
- return message
445
- else:
446
- return method(client, message)
443
+ if method is not None:
444
+ method(client, message)
ccxt/pro/bitrue.py CHANGED
@@ -408,7 +408,7 @@ class bitrue(ccxt.async_support.bitrue):
408
408
  except Exception as error:
409
409
  self.options['listenKey'] = None
410
410
  self.options['listenKeyUrl'] = None
411
- return
411
+ return None
412
412
  #
413
413
  # {
414
414
  # "msg": "succ",
ccxt/pro/bitstamp.py CHANGED
@@ -482,9 +482,9 @@ class bitstamp(ccxt.async_support.bitstamp):
482
482
  #
483
483
  event = self.safe_string(message, 'event')
484
484
  if event == 'bts:subscription_succeeded':
485
- return self.handle_subscription_status(client, message)
485
+ self.handle_subscription_status(client, message)
486
486
  else:
487
- return self.handle_subject(client, message)
487
+ self.handle_subject(client, message)
488
488
 
489
489
  async def authenticate(self, params={}):
490
490
  self.check_required_credentials()
@@ -506,7 +506,6 @@ class bitstamp(ccxt.async_support.bitstamp):
506
506
  self.options['expiresIn'] = self.sum(time, validity)
507
507
  self.options['userId'] = userId
508
508
  self.options['wsSessionToken'] = sessionToken
509
- return response
510
509
 
511
510
  async def subscribe_private(self, subscription, messageHash, params={}):
512
511
  url = self.urls['api']['ws']
ccxt/pro/bitvavo.py CHANGED
@@ -400,7 +400,7 @@ class bitvavo(ccxt.async_support.bitvavo):
400
400
  #
401
401
  response = self.safe_value(message, 'response')
402
402
  if response is None:
403
- return message
403
+ return
404
404
  marketId = self.safe_string(response, 'market')
405
405
  symbol = self.safe_symbol(marketId, None, '-')
406
406
  name = 'book'
@@ -502,7 +502,7 @@ class bitvavo(ccxt.async_support.bitvavo):
502
502
  limit = trades.getLimit(symbol, limit)
503
503
  return self.filter_by_symbol_since_limit(trades, symbol, since, limit, True)
504
504
 
505
- async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}) -> Order:
505
+ async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}) -> Order:
506
506
  """
507
507
  create a trade order
508
508
  :see: https://docs.bitvavo.com/#tag/Orders/paths/~1order/post
@@ -1122,7 +1122,7 @@ class bitvavo(ccxt.async_support.bitvavo):
1122
1122
  method(client, message, subscription)
1123
1123
  return message
1124
1124
 
1125
- def authenticate(self, params={}):
1125
+ async def authenticate(self, params={}):
1126
1126
  url = self.urls['api']['ws']
1127
1127
  client = self.client(url)
1128
1128
  messageHash = 'authenticated'
@@ -1259,7 +1259,12 @@ class bitvavo(ccxt.async_support.bitvavo):
1259
1259
  'getCandles': self.handle_fetch_ohlcv,
1260
1260
  'getMarkets': self.handle_markets,
1261
1261
  }
1262
- event = self.safe_string_2(message, 'event', 'action')
1262
+ event = self.safe_string(message, 'event')
1263
1263
  method = self.safe_value(methods, event)
1264
- if method is not None:
1264
+ if method is None:
1265
+ action = self.safe_string(message, 'action')
1266
+ method = self.safe_value(methods, action)
1267
+ if method is not None:
1268
+ method(client, message)
1269
+ else:
1265
1270
  method(client, message)