ccxt 4.3.33__py2.py3-none-any.whl → 4.3.35__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 (204) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +1 -0
  3. ccxt/abstract/binancecoinm.py +1 -0
  4. ccxt/abstract/binanceus.py +1 -0
  5. ccxt/abstract/binanceusdm.py +1 -0
  6. ccxt/ace.py +2 -2
  7. ccxt/alpaca.py +2 -2
  8. ccxt/ascendex.py +2 -2
  9. ccxt/async_support/__init__.py +1 -1
  10. ccxt/async_support/ace.py +2 -2
  11. ccxt/async_support/alpaca.py +2 -2
  12. ccxt/async_support/ascendex.py +2 -2
  13. ccxt/async_support/base/exchange.py +56 -40
  14. ccxt/async_support/bigone.py +2 -2
  15. ccxt/async_support/binance.py +6 -5
  16. ccxt/async_support/bingx.py +4 -3
  17. ccxt/async_support/bit2c.py +1 -1
  18. ccxt/async_support/bitbank.py +1 -1
  19. ccxt/async_support/bitbns.py +1 -1
  20. ccxt/async_support/bitfinex.py +2 -2
  21. ccxt/async_support/bitfinex2.py +1 -1
  22. ccxt/async_support/bitflyer.py +1 -1
  23. ccxt/async_support/bitget.py +4 -4
  24. ccxt/async_support/bithumb.py +1 -1
  25. ccxt/async_support/bitmart.py +4 -9
  26. ccxt/async_support/bitmex.py +3 -3
  27. ccxt/async_support/bitopro.py +3 -3
  28. ccxt/async_support/bitrue.py +2 -2
  29. ccxt/async_support/bitso.py +2 -2
  30. ccxt/async_support/bitstamp.py +2 -2
  31. ccxt/async_support/bitteam.py +3 -3
  32. ccxt/async_support/bitvavo.py +2 -2
  33. ccxt/async_support/blockchaincom.py +1 -1
  34. ccxt/async_support/blofin.py +3 -3
  35. ccxt/async_support/btcalpha.py +3 -3
  36. ccxt/async_support/btcbox.py +1 -1
  37. ccxt/async_support/btcmarkets.py +6 -4
  38. ccxt/async_support/btcturk.py +1 -1
  39. ccxt/async_support/bybit.py +3 -3
  40. ccxt/async_support/cex.py +1 -1
  41. ccxt/async_support/coinbase.py +156 -58
  42. ccxt/async_support/coinbaseexchange.py +1 -1
  43. ccxt/async_support/coinbaseinternational.py +3 -3
  44. ccxt/async_support/coincheck.py +2 -2
  45. ccxt/async_support/coinex.py +28 -21
  46. ccxt/async_support/coinlist.py +2 -2
  47. ccxt/async_support/coinmate.py +2 -2
  48. ccxt/async_support/coinmetro.py +2 -2
  49. ccxt/async_support/coinone.py +1 -1
  50. ccxt/async_support/coinsph.py +2 -2
  51. ccxt/async_support/cryptocom.py +1 -1
  52. ccxt/async_support/currencycom.py +2 -2
  53. ccxt/async_support/delta.py +1 -1
  54. ccxt/async_support/deribit.py +2 -2
  55. ccxt/async_support/digifinex.py +2 -2
  56. ccxt/async_support/exmo.py +2 -2
  57. ccxt/async_support/gate.py +2 -2
  58. ccxt/async_support/gemini.py +3 -3
  59. ccxt/async_support/hitbtc.py +2 -2
  60. ccxt/async_support/hollaex.py +1 -1
  61. ccxt/async_support/htx.py +2 -2
  62. ccxt/async_support/huobijp.py +2 -2
  63. ccxt/async_support/hyperliquid.py +2 -2
  64. ccxt/async_support/idex.py +2 -2
  65. ccxt/async_support/indodax.py +2 -2
  66. ccxt/async_support/kraken.py +5 -3
  67. ccxt/async_support/krakenfutures.py +1 -1
  68. ccxt/async_support/kucoin.py +2 -2
  69. ccxt/async_support/kuna.py +2 -2
  70. ccxt/async_support/latoken.py +2 -2
  71. ccxt/async_support/lbank.py +1 -1
  72. ccxt/async_support/luno.py +1 -1
  73. ccxt/async_support/lykke.py +1 -1
  74. ccxt/async_support/mercado.py +1 -1
  75. ccxt/async_support/mexc.py +1 -1
  76. ccxt/async_support/ndax.py +2 -2
  77. ccxt/async_support/novadax.py +3 -3
  78. ccxt/async_support/oceanex.py +2 -2
  79. ccxt/async_support/okcoin.py +3 -3
  80. ccxt/async_support/okx.py +3 -3
  81. ccxt/async_support/onetrading.py +2 -2
  82. ccxt/async_support/p2b.py +2 -2
  83. ccxt/async_support/paymium.py +1 -1
  84. ccxt/async_support/phemex.py +4 -4
  85. ccxt/async_support/poloniex.py +3 -3
  86. ccxt/async_support/poloniexfutures.py +2 -2
  87. ccxt/async_support/probit.py +3 -3
  88. ccxt/async_support/timex.py +2 -2
  89. ccxt/async_support/tokocrypto.py +1 -1
  90. ccxt/async_support/tradeogre.py +1 -1
  91. ccxt/async_support/upbit.py +3 -3
  92. ccxt/async_support/wavesexchange.py +1 -1
  93. ccxt/async_support/wazirx.py +3 -3
  94. ccxt/async_support/whitebit.py +3 -3
  95. ccxt/async_support/woo.py +3 -3
  96. ccxt/async_support/woofipro.py +3 -3
  97. ccxt/async_support/yobit.py +1 -1
  98. ccxt/async_support/zaif.py +2 -2
  99. ccxt/async_support/zonda.py +1 -1
  100. ccxt/base/exchange.py +107 -76
  101. ccxt/base/types.py +0 -1
  102. ccxt/bigone.py +2 -2
  103. ccxt/binance.py +6 -5
  104. ccxt/bingx.py +4 -3
  105. ccxt/bit2c.py +1 -1
  106. ccxt/bitbank.py +1 -1
  107. ccxt/bitbns.py +1 -1
  108. ccxt/bitfinex.py +2 -2
  109. ccxt/bitfinex2.py +1 -1
  110. ccxt/bitflyer.py +1 -1
  111. ccxt/bitget.py +4 -4
  112. ccxt/bithumb.py +1 -1
  113. ccxt/bitmart.py +4 -9
  114. ccxt/bitmex.py +3 -3
  115. ccxt/bitopro.py +3 -3
  116. ccxt/bitrue.py +2 -2
  117. ccxt/bitso.py +2 -2
  118. ccxt/bitstamp.py +2 -2
  119. ccxt/bitteam.py +3 -3
  120. ccxt/bitvavo.py +2 -2
  121. ccxt/blockchaincom.py +1 -1
  122. ccxt/blofin.py +3 -3
  123. ccxt/btcalpha.py +3 -3
  124. ccxt/btcbox.py +1 -1
  125. ccxt/btcmarkets.py +6 -4
  126. ccxt/btcturk.py +1 -1
  127. ccxt/bybit.py +3 -3
  128. ccxt/cex.py +1 -1
  129. ccxt/coinbase.py +156 -58
  130. ccxt/coinbaseexchange.py +1 -1
  131. ccxt/coinbaseinternational.py +3 -3
  132. ccxt/coincheck.py +2 -2
  133. ccxt/coinex.py +28 -21
  134. ccxt/coinlist.py +2 -2
  135. ccxt/coinmate.py +2 -2
  136. ccxt/coinmetro.py +2 -2
  137. ccxt/coinone.py +1 -1
  138. ccxt/coinsph.py +2 -2
  139. ccxt/cryptocom.py +1 -1
  140. ccxt/currencycom.py +2 -2
  141. ccxt/delta.py +1 -1
  142. ccxt/deribit.py +2 -2
  143. ccxt/digifinex.py +2 -2
  144. ccxt/exmo.py +2 -2
  145. ccxt/gate.py +2 -2
  146. ccxt/gemini.py +3 -3
  147. ccxt/hitbtc.py +2 -2
  148. ccxt/hollaex.py +1 -1
  149. ccxt/htx.py +2 -2
  150. ccxt/huobijp.py +2 -2
  151. ccxt/hyperliquid.py +2 -2
  152. ccxt/idex.py +2 -2
  153. ccxt/indodax.py +2 -2
  154. ccxt/kraken.py +5 -3
  155. ccxt/krakenfutures.py +1 -1
  156. ccxt/kucoin.py +2 -2
  157. ccxt/kuna.py +2 -2
  158. ccxt/latoken.py +2 -2
  159. ccxt/lbank.py +1 -1
  160. ccxt/luno.py +1 -1
  161. ccxt/lykke.py +1 -1
  162. ccxt/mercado.py +1 -1
  163. ccxt/mexc.py +1 -1
  164. ccxt/ndax.py +2 -2
  165. ccxt/novadax.py +3 -3
  166. ccxt/oceanex.py +2 -2
  167. ccxt/okcoin.py +3 -3
  168. ccxt/okx.py +3 -3
  169. ccxt/onetrading.py +2 -2
  170. ccxt/p2b.py +2 -2
  171. ccxt/paymium.py +1 -1
  172. ccxt/phemex.py +4 -4
  173. ccxt/poloniex.py +3 -3
  174. ccxt/poloniexfutures.py +2 -2
  175. ccxt/pro/__init__.py +1 -1
  176. ccxt/pro/binance.py +331 -2
  177. ccxt/pro/bitget.py +24 -1
  178. ccxt/pro/bitmart.py +1 -1
  179. ccxt/pro/bitmex.py +98 -1
  180. ccxt/pro/bybit.py +82 -1
  181. ccxt/pro/gate.py +173 -1
  182. ccxt/pro/kraken.py +1 -1
  183. ccxt/pro/kucoinfutures.py +4 -0
  184. ccxt/pro/okx.py +244 -1
  185. ccxt/probit.py +3 -3
  186. ccxt/test/base/__init__.py +1 -0
  187. ccxt/test/base/test_crypto.py +1 -1
  188. ccxt/test/base/test_liquidation.py +50 -0
  189. ccxt/timex.py +2 -2
  190. ccxt/tokocrypto.py +1 -1
  191. ccxt/tradeogre.py +1 -1
  192. ccxt/upbit.py +3 -3
  193. ccxt/wavesexchange.py +1 -1
  194. ccxt/wazirx.py +3 -3
  195. ccxt/whitebit.py +3 -3
  196. ccxt/woo.py +3 -3
  197. ccxt/woofipro.py +3 -3
  198. ccxt/yobit.py +1 -1
  199. ccxt/zaif.py +2 -2
  200. ccxt/zonda.py +1 -1
  201. {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/METADATA +4 -4
  202. {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/RECORD +204 -203
  203. {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/WHEEL +0 -0
  204. {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/top_level.txt +0 -0
ccxt/bigone.py CHANGED
@@ -1780,7 +1780,7 @@ class bigone(Exchange, ImplicitAPI):
1780
1780
  'info': response,
1781
1781
  }
1782
1782
 
1783
- def parse_transaction_status(self, status):
1783
+ def parse_transaction_status(self, status: Str):
1784
1784
  statuses: dict = {
1785
1785
  # what are other statuses here?
1786
1786
  'WITHHOLD': 'ok', # deposits
@@ -2094,7 +2094,7 @@ class bigone(Exchange, ImplicitAPI):
2094
2094
  data = self.safe_dict(response, 'data', {})
2095
2095
  return self.parse_transaction(data, currency)
2096
2096
 
2097
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
2097
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2098
2098
  if response is None:
2099
2099
  return None # fallback to default error handler
2100
2100
  #
ccxt/binance.py CHANGED
@@ -262,6 +262,7 @@ class binance(Exchange, ImplicitAPI):
262
262
  'system/status': 0.1,
263
263
  # these endpoints require self.apiKey
264
264
  'accountSnapshot': 240, # Weight(IP): 2400 => cost = 0.1 * 2400 = 240
265
+ 'account/info': 0.1,
265
266
  'margin/asset': 1, # Weight(IP): 10 => cost = 0.1 * 10 = 1
266
267
  'margin/pair': 1,
267
268
  'margin/allAssets': 0.1,
@@ -3042,7 +3043,7 @@ class binance(Exchange, ImplicitAPI):
3042
3043
  result.append(self.parse_market(markets[i]))
3043
3044
  return result
3044
3045
 
3045
- def parse_market(self, market) -> Market:
3046
+ def parse_market(self, market: dict) -> Market:
3046
3047
  swap = False
3047
3048
  future = False
3048
3049
  option = False
@@ -4749,7 +4750,7 @@ class binance(Exchange, ImplicitAPI):
4749
4750
  cancelId = self.safe_string_2(params, 'cancelNewClientOrderId', 'cancelOrigClientOrderId')
4750
4751
  if cancelId is None:
4751
4752
  request['cancelOrderId'] = id # user can provide either cancelOrderId, cancelOrigClientOrderId or cancelOrigClientOrderId
4752
- # 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
4753
4754
  if self.safe_string(params, 'timeInForce') == 'PO':
4754
4755
  params = self.omit(params, ['timeInForce'])
4755
4756
  params = self.omit(params, ['quoteOrderQty', 'cost', 'stopPrice', 'newClientOrderId', 'clientOrderId', 'postOnly'])
@@ -5809,7 +5810,7 @@ class binance(Exchange, ImplicitAPI):
5809
5810
  request['timeInForce'] = self.options['defaultTimeInForce'] # 'GTC' = Good To Cancel(default), 'IOC' = Immediate Or Cancel
5810
5811
  if not isPortfolioMargin and market['contract'] and postOnly:
5811
5812
  request['timeInForce'] = 'GTX'
5812
- # 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
5813
5814
  if self.safe_string(params, 'timeInForce') == 'PO':
5814
5815
  params = self.omit(params, 'timeInForce')
5815
5816
  requestParams = self.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test'])
@@ -10224,7 +10225,7 @@ class binance(Exchange, ImplicitAPI):
10224
10225
  url += '?' + self.urlencode(params)
10225
10226
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
10226
10227
 
10227
- def get_exceptions_by_url(self, url, exactOrBroad):
10228
+ def get_exceptions_by_url(self, url: str, exactOrBroad: str):
10228
10229
  marketType = None
10229
10230
  hostname = self.hostname if (self.hostname is not None) else 'binance.com'
10230
10231
  if url.startswith('https://api.' + hostname + '/'):
@@ -10242,7 +10243,7 @@ class binance(Exchange, ImplicitAPI):
10242
10243
  return self.safe_dict(exceptionsForMarketType, exactOrBroad, {})
10243
10244
  return {}
10244
10245
 
10245
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
10246
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
10246
10247
  if (code == 418) or (code == 429):
10247
10248
  raise DDoSProtection(self.id + ' ' + str(code) + ' ' + reason + ' ' + body)
10248
10249
  # error response in a form: {"code": -1013, "msg": "Invalid quantity."}
ccxt/bingx.py CHANGED
@@ -635,7 +635,7 @@ class bingx(Exchange, ImplicitAPI):
635
635
  markets = self.safe_list(response, 'data', [])
636
636
  return self.parse_markets(markets)
637
637
 
638
- def parse_market(self, market) -> Market:
638
+ def parse_market(self, market: dict) -> Market:
639
639
  id = self.safe_string(market, 'symbol')
640
640
  symbolParts = id.split('-')
641
641
  baseId = symbolParts[0]
@@ -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', {})
@@ -4263,7 +4264,7 @@ class bingx(Exchange, ImplicitAPI):
4263
4264
  super(bingx, self).set_sandbox_mode(enable)
4264
4265
  self.options['sandboxMode'] = enable
4265
4266
 
4266
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
4267
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
4267
4268
  if response is None:
4268
4269
  return None # fallback to default error handler
4269
4270
  #
ccxt/bit2c.py CHANGED
@@ -846,7 +846,7 @@ class bit2c(Exchange, ImplicitAPI):
846
846
  }
847
847
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
848
848
 
849
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
849
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
850
850
  if response is None:
851
851
  return None # fallback to default error handler
852
852
  #
ccxt/bitbank.py CHANGED
@@ -881,7 +881,7 @@ class bitbank(Exchange, ImplicitAPI):
881
881
  }
882
882
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
883
883
 
884
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
884
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
885
885
  if response is None:
886
886
  return None
887
887
  success = self.safe_integer(response, 'success')
ccxt/bitbns.py CHANGED
@@ -1135,7 +1135,7 @@ class bitbns(Exchange, ImplicitAPI):
1135
1135
  headers['Content-Type'] = 'application/x-www-form-urlencoded'
1136
1136
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1137
1137
 
1138
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
1138
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1139
1139
  if response is None:
1140
1140
  return None # fallback to default error handler
1141
1141
  #
ccxt/bitfinex.py CHANGED
@@ -1477,7 +1477,7 @@ class bitfinex(Exchange, ImplicitAPI):
1477
1477
  },
1478
1478
  }
1479
1479
 
1480
- def parse_transaction_status(self, status):
1480
+ def parse_transaction_status(self, status: Str):
1481
1481
  statuses: dict = {
1482
1482
  'SENDING': 'pending',
1483
1483
  'CANCELED': 'canceled',
@@ -1594,7 +1594,7 @@ class bitfinex(Exchange, ImplicitAPI):
1594
1594
  }
1595
1595
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1596
1596
 
1597
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1597
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1598
1598
  if response is None:
1599
1599
  return None
1600
1600
  throwError = False
ccxt/bitfinex2.py CHANGED
@@ -2146,7 +2146,7 @@ class bitfinex2(Exchange, ImplicitAPI):
2146
2146
  'info': response,
2147
2147
  }
2148
2148
 
2149
- def parse_transaction_status(self, status):
2149
+ def parse_transaction_status(self, status: Str):
2150
2150
  statuses: dict = {
2151
2151
  'SUCCESS': 'ok',
2152
2152
  'COMPLETED': 'ok',
ccxt/bitflyer.py CHANGED
@@ -982,7 +982,7 @@ class bitflyer(Exchange, ImplicitAPI):
982
982
  }
983
983
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
984
984
 
985
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
985
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
986
986
  if response is None:
987
987
  return None # fallback to the default error handler
988
988
  feedback = self.id + ' ' + body
ccxt/bitget.py CHANGED
@@ -1558,7 +1558,7 @@ class bitget(Exchange, ImplicitAPI):
1558
1558
  result = self.array_concat(result, promises[i])
1559
1559
  return result
1560
1560
 
1561
- def parse_market(self, market) -> Market:
1561
+ def parse_market(self, market: dict) -> Market:
1562
1562
  #
1563
1563
  # spot
1564
1564
  #
@@ -2377,7 +2377,7 @@ class bitget(Exchange, ImplicitAPI):
2377
2377
  'fee': fee,
2378
2378
  }
2379
2379
 
2380
- def parse_transaction_status(self, status):
2380
+ def parse_transaction_status(self, status: Str):
2381
2381
  statuses: dict = {
2382
2382
  'success': 'ok',
2383
2383
  'Pending': 'pending',
@@ -2723,7 +2723,7 @@ class bitget(Exchange, ImplicitAPI):
2723
2723
  request: dict = {}
2724
2724
  type = None
2725
2725
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
2726
- # Calls like `.fetch_tickers(None, {subType:'inverse'})` should be supported for self exchange, so
2726
+ # Calls like `.fetchTickers(None, {subType:'inverse'})` should be supported for self exchange, so
2727
2727
  # as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
2728
2728
  # with higher priority and only default to spot, if `subType` is not set in params
2729
2729
  passedSubType = self.safe_string(params, 'subType')
@@ -8181,7 +8181,7 @@ class bitget(Exchange, ImplicitAPI):
8181
8181
  }
8182
8182
  return result
8183
8183
 
8184
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
8184
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
8185
8185
  if not response:
8186
8186
  return None # fallback to default error handler
8187
8187
  #
ccxt/bithumb.py CHANGED
@@ -1031,7 +1031,7 @@ class bithumb(Exchange, ImplicitAPI):
1031
1031
  }
1032
1032
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1033
1033
 
1034
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
1034
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1035
1035
  if response is None:
1036
1036
  return None # fallback to default error handler
1037
1037
  if 'status' in response:
ccxt/bitmart.py CHANGED
@@ -1180,14 +1180,9 @@ class bitmart(Exchange, ImplicitAPI):
1180
1180
  market = self.safe_market(marketId, market)
1181
1181
  symbol = market['symbol']
1182
1182
  last = self.safe_string_2(ticker, 'close_24h', 'last_price')
1183
- percentage = self.safe_string(ticker, 'price_change_percent_24h')
1183
+ percentage = Precise.string_abs(self.safe_string(ticker, 'price_change_percent_24h'))
1184
1184
  if percentage is None:
1185
- percentageRaw = self.safe_string(ticker, 'fluctuation')
1186
- if (percentageRaw is not None) and (percentageRaw != '0'): # a few tickers show strictly '0' in fluctuation field
1187
- direction = percentageRaw[0]
1188
- percentage = direction + Precise.string_mul(percentageRaw.replace(direction, ''), '100')
1189
- elif percentageRaw == '0':
1190
- percentage = '0'
1185
+ percentage = Precise.string_abs(Precise.string_mul(self.safe_string(ticker, 'fluctuation'), '100'))
1191
1186
  baseVolume = self.safe_string(ticker, 'base_volume_24h')
1192
1187
  quoteVolume = self.safe_string(ticker, 'quote_volume_24h')
1193
1188
  if quoteVolume is None:
@@ -3282,7 +3277,7 @@ class bitmart(Exchange, ImplicitAPI):
3282
3277
  """
3283
3278
  return self.fetch_transactions_by_type('withdraw', code, since, limit, params)
3284
3279
 
3285
- def parse_transaction_status(self, status):
3280
+ def parse_transaction_status(self, status: Str):
3286
3281
  statuses: dict = {
3287
3282
  '0': 'pending', # Create
3288
3283
  '1': 'pending', # Submitted, waiting for withdrawal
@@ -4297,7 +4292,7 @@ class bitmart(Exchange, ImplicitAPI):
4297
4292
  headers['X-BM-SIGN'] = signature
4298
4293
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
4299
4294
 
4300
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
4295
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
4301
4296
  if response is None:
4302
4297
  return None
4303
4298
  #
ccxt/bitmex.py CHANGED
@@ -580,7 +580,7 @@ class bitmex(Exchange, ImplicitAPI):
580
580
  #
581
581
  return self.parse_markets(response)
582
582
 
583
- def parse_market(self, market) -> Market:
583
+ def parse_market(self, market: dict) -> Market:
584
584
  id = self.safe_string(market, 'symbol')
585
585
  baseId = self.safe_string(market, 'underlying')
586
586
  quoteId = self.safe_string(market, 'quoteCurrency')
@@ -1220,7 +1220,7 @@ class bitmex(Exchange, ImplicitAPI):
1220
1220
  transactions = self.filter_by_array(response, 'transactType', ['Withdrawal', 'Deposit'], False)
1221
1221
  return self.parse_transactions(transactions, currency, since, limit)
1222
1222
 
1223
- def parse_transaction_status(self, status):
1223
+ def parse_transaction_status(self, status: Str):
1224
1224
  statuses: dict = {
1225
1225
  'Confirmed': 'pending',
1226
1226
  'Canceled': 'canceled',
@@ -2705,7 +2705,7 @@ class bitmex(Exchange, ImplicitAPI):
2705
2705
  'datetime': None,
2706
2706
  })
2707
2707
 
2708
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
2708
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2709
2709
  if response is None:
2710
2710
  return None
2711
2711
  if code == 429:
ccxt/bitopro.py CHANGED
@@ -316,7 +316,7 @@ class bitopro(Exchange, ImplicitAPI):
316
316
  #
317
317
  return self.parse_markets(markets)
318
318
 
319
- def parse_market(self, market) -> Market:
319
+ def parse_market(self, market: dict) -> Market:
320
320
  active = not self.safe_value(market, 'maintain')
321
321
  id = self.safe_string(market, 'pair')
322
322
  uppercaseId = id.upper()
@@ -1259,7 +1259,7 @@ class bitopro(Exchange, ImplicitAPI):
1259
1259
  #
1260
1260
  return self.parse_trades(trades, market, since, limit)
1261
1261
 
1262
- def parse_transaction_status(self, status):
1262
+ def parse_transaction_status(self, status: Str):
1263
1263
  states: dict = {
1264
1264
  'COMPLETE': 'ok',
1265
1265
  'INVALID': 'failed',
@@ -1618,7 +1618,7 @@ class bitopro(Exchange, ImplicitAPI):
1618
1618
  url = self.urls['api']['rest'] + url
1619
1619
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1620
1620
 
1621
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1621
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1622
1622
  if response is None:
1623
1623
  return None # fallback to the default error handler
1624
1624
  if code >= 200 and code < 300:
ccxt/bitrue.py CHANGED
@@ -809,7 +809,7 @@ class bitrue(Exchange, ImplicitAPI):
809
809
  self.load_time_difference()
810
810
  return self.parse_markets(markets)
811
811
 
812
- def parse_market(self, market) -> Market:
812
+ def parse_market(self, market: dict) -> Market:
813
813
  id = self.safe_string(market, 'symbol')
814
814
  lowercaseId = self.safe_string_lower(market, 'symbol')
815
815
  side = self.safe_integer(market, 'side') # 1 linear, 0 inverse, None spot
@@ -2961,7 +2961,7 @@ class bitrue(Exchange, ImplicitAPI):
2961
2961
  url += '?' + self.urlencode(params)
2962
2962
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
2963
2963
 
2964
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
2964
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2965
2965
  if (code == 418) or (code == 429):
2966
2966
  raise DDoSProtection(self.id + ' ' + str(code) + ' ' + reason + ' ' + body)
2967
2967
  # error response in a form: {"code": -1013, "msg": "Invalid quantity."}
ccxt/bitso.py CHANGED
@@ -1611,7 +1611,7 @@ class bitso(Exchange, ImplicitAPI):
1611
1611
  'info': transaction,
1612
1612
  }
1613
1613
 
1614
- def parse_transaction_status(self, status):
1614
+ def parse_transaction_status(self, status: Str):
1615
1615
  statuses: dict = {
1616
1616
  'pending': 'pending',
1617
1617
  'in_progress': 'pending',
@@ -1646,7 +1646,7 @@ class bitso(Exchange, ImplicitAPI):
1646
1646
  }
1647
1647
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1648
1648
 
1649
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
1649
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1650
1650
  if response is None:
1651
1651
  return None # fallback to default error handler
1652
1652
  if 'success' in response:
ccxt/bitstamp.py CHANGED
@@ -1689,7 +1689,7 @@ class bitstamp(Exchange, ImplicitAPI):
1689
1689
  'fee': fee,
1690
1690
  }
1691
1691
 
1692
- def parse_transaction_status(self, status):
1692
+ def parse_transaction_status(self, status: Str):
1693
1693
  #
1694
1694
  # withdrawals:
1695
1695
  # 0(open), 1(in process), 2(finished), 3(canceled) or 4(failed).
@@ -2109,7 +2109,7 @@ class bitstamp(Exchange, ImplicitAPI):
2109
2109
  headers['X-Auth-Signature'] = signature
2110
2110
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
2111
2111
 
2112
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
2112
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2113
2113
  if response is None:
2114
2114
  return None
2115
2115
  #
ccxt/bitteam.py CHANGED
@@ -349,7 +349,7 @@ class bitteam(Exchange, ImplicitAPI):
349
349
  markets = self.safe_value(result, 'pairs', [])
350
350
  return self.parse_markets(markets)
351
351
 
352
- def parse_market(self, market) -> Market:
352
+ def parse_market(self, market: dict) -> Market:
353
353
  id = self.safe_string(market, 'name')
354
354
  numericId = self.safe_integer(market, 'id')
355
355
  parts = id.split('_')
@@ -2190,7 +2190,7 @@ class bitteam(Exchange, ImplicitAPI):
2190
2190
  }
2191
2191
  return self.safe_string(types, type, type)
2192
2192
 
2193
- def parse_transaction_status(self, status):
2193
+ def parse_transaction_status(self, status: Str):
2194
2194
  statuses: dict = {
2195
2195
  'approving': 'pending',
2196
2196
  'success': 'ok',
@@ -2219,7 +2219,7 @@ class bitteam(Exchange, ImplicitAPI):
2219
2219
  url += '?' + query
2220
2220
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
2221
2221
 
2222
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
2222
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2223
2223
  if response is None:
2224
2224
  return None
2225
2225
  if code != 200:
ccxt/bitvavo.py CHANGED
@@ -1751,7 +1751,7 @@ class bitvavo(Exchange, ImplicitAPI):
1751
1751
  #
1752
1752
  return self.parse_transactions(response, currency, since, limit, {'type': 'deposit'})
1753
1753
 
1754
- def parse_transaction_status(self, status):
1754
+ def parse_transaction_status(self, status: Str):
1755
1755
  statuses: dict = {
1756
1756
  'awaiting_processing': 'pending',
1757
1757
  'awaiting_email_confirmation': 'pending',
@@ -1945,7 +1945,7 @@ class bitvavo(Exchange, ImplicitAPI):
1945
1945
  url = self.urls['api'][api] + url
1946
1946
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1947
1947
 
1948
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
1948
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1949
1949
  if response is None:
1950
1950
  return None # fallback to default error handler
1951
1951
  #
ccxt/blockchaincom.py CHANGED
@@ -1083,7 +1083,7 @@ class blockchaincom(Exchange, ImplicitAPI):
1083
1083
  headers['Content-Type'] = 'application/json'
1084
1084
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1085
1085
 
1086
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1086
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1087
1087
  # {"timestamp":"2021-10-21T15:13:58.837+00:00","status":404,"error":"Not Found","message":"","path":"/orders/505050"
1088
1088
  if response is None:
1089
1089
  return None
ccxt/blofin.py CHANGED
@@ -368,7 +368,7 @@ class blofin(Exchange, ImplicitAPI):
368
368
  data = self.safe_list(response, 'data', [])
369
369
  return self.parse_markets(data)
370
370
 
371
- def parse_market(self, market) -> Market:
371
+ def parse_market(self, market: dict) -> Market:
372
372
  id = self.safe_string(market, 'instId')
373
373
  type = self.safe_string_lower(market, 'instType')
374
374
  spot = (type == 'spot')
@@ -1499,7 +1499,7 @@ class blofin(Exchange, ImplicitAPI):
1499
1499
  },
1500
1500
  }
1501
1501
 
1502
- def parse_transaction_status(self, status):
1502
+ def parse_transaction_status(self, status: Str):
1503
1503
  statuses: dict = {
1504
1504
  '0': 'pending',
1505
1505
  '1': 'ok',
@@ -2000,7 +2000,7 @@ class blofin(Exchange, ImplicitAPI):
2000
2000
  'marginMode': self.safe_string(marginMode, 'marginMode'),
2001
2001
  }
2002
2002
 
2003
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
2003
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2004
2004
  if response is None:
2005
2005
  return None # fallback to default error handler
2006
2006
  #
ccxt/btcalpha.py CHANGED
@@ -186,7 +186,7 @@ class btcalpha(Exchange, ImplicitAPI):
186
186
  #
187
187
  return self.parse_markets(response)
188
188
 
189
- def parse_market(self, market) -> Market:
189
+ def parse_market(self, market: dict) -> Market:
190
190
  id = self.safe_string(market, 'name')
191
191
  baseId = self.safe_string(market, 'currency1')
192
192
  quoteId = self.safe_string(market, 'currency2')
@@ -544,7 +544,7 @@ class btcalpha(Exchange, ImplicitAPI):
544
544
  'updated': None,
545
545
  }
546
546
 
547
- def parse_transaction_status(self, status):
547
+ def parse_transaction_status(self, status: Str):
548
548
  statuses: dict = {
549
549
  '10': 'pending', # New
550
550
  '20': 'pending', # Verified, waiting for approving
@@ -866,7 +866,7 @@ class btcalpha(Exchange, ImplicitAPI):
866
866
  headers['X-NONCE'] = str(self.nonce())
867
867
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
868
868
 
869
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
869
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
870
870
  if response is None:
871
871
  return None # fallback to default error handler
872
872
  #
ccxt/btcbox.py CHANGED
@@ -519,7 +519,7 @@ class btcbox(Exchange, ImplicitAPI):
519
519
  }
520
520
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
521
521
 
522
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
522
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
523
523
  if response is None:
524
524
  return None # resort to defaultErrorHandler
525
525
  # typical error response: {"result":false,"code":"401"}
ccxt/btcmarkets.py CHANGED
@@ -237,7 +237,7 @@ class btcmarkets(Exchange, ImplicitAPI):
237
237
  """
238
238
  return self.fetch_transactions_with_method('privateGetWithdrawals', code, since, limit, params)
239
239
 
240
- def parse_transaction_status(self, status):
240
+ def parse_transaction_status(self, status: Str):
241
241
  statuses: dict = {
242
242
  'Accepted': 'pending',
243
243
  'Pending Authorization': 'pending',
@@ -376,7 +376,7 @@ class btcmarkets(Exchange, ImplicitAPI):
376
376
  #
377
377
  return self.parse_markets(response)
378
378
 
379
- def parse_market(self, market) -> Market:
379
+ def parse_market(self, market: dict) -> Market:
380
380
  baseId = self.safe_string(market, 'baseAssetName')
381
381
  quoteId = self.safe_string(market, 'quoteAssetName')
382
382
  id = self.safe_string(market, 'marketId')
@@ -876,7 +876,9 @@ class btcmarkets(Exchange, ImplicitAPI):
876
876
  """
877
877
  calculates the presumptive fee that would be charged for an order
878
878
  :param str symbol: unified market symbol
879
- :param str type: not used by btcmarkets.calculate_fee :param string side: not used by btcmarkets.calculate_fee :param float amount: how much you want to trade, in units of the base currency on most exchanges, or number of contracts
879
+ :param str type: not used by btcmarkets.calculateFee
880
+ :param str side: not used by btcmarkets.calculateFee
881
+ :param float amount: how much you want to trade, in units of the base currency on most exchanges, or number of contracts
880
882
  :param float price: the price for the order to be filled at, in units of the quote currency
881
883
  :param str takerOrMaker: 'taker' or 'maker'
882
884
  :param dict params:
@@ -1170,7 +1172,7 @@ class btcmarkets(Exchange, ImplicitAPI):
1170
1172
  url = self.urls['api'][api] + request
1171
1173
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1172
1174
 
1173
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1175
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1174
1176
  if response is None:
1175
1177
  return None # fallback to default error handler
1176
1178
  if 'success' in response:
ccxt/btcturk.py CHANGED
@@ -891,7 +891,7 @@ class btcturk(Exchange, ImplicitAPI):
891
891
  }
892
892
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
893
893
 
894
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
894
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
895
895
  errorCode = self.safe_string(response, 'code', '0')
896
896
  message = self.safe_string(response, 'message')
897
897
  output = body if (message is None) else message
ccxt/bybit.py CHANGED
@@ -2079,7 +2079,7 @@ class bybit(Exchange, ImplicitAPI):
2079
2079
  }
2080
2080
  type = None
2081
2081
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
2082
- # Calls like `.fetch_tickers(None, {subType:'inverse'})` should be supported for self exchange, so
2082
+ # Calls like `.fetchTickers(None, {subType:'inverse'})` should be supported for self exchange, so
2083
2083
  # as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
2084
2084
  # with higher priority and only default to spot, if `subType` is not set in params
2085
2085
  passedSubType = self.safe_string(params, 'subType')
@@ -5283,7 +5283,7 @@ class bybit(Exchange, ImplicitAPI):
5283
5283
  data = self.add_pagination_cursor_to_result(response)
5284
5284
  return self.parse_transactions(data, currency, since, limit)
5285
5285
 
5286
- def parse_transaction_status(self, status):
5286
+ def parse_transaction_status(self, status: Str):
5287
5287
  statuses: dict = {
5288
5288
  # v3 deposit status
5289
5289
  '0': 'unknown',
@@ -8117,7 +8117,7 @@ class bybit(Exchange, ImplicitAPI):
8117
8117
  headers['Referer'] = brokerId
8118
8118
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
8119
8119
 
8120
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
8120
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
8121
8121
  if not response:
8122
8122
  return None # fallback to default error handler
8123
8123
  #
ccxt/cex.py CHANGED
@@ -1585,7 +1585,7 @@ class cex(Exchange, ImplicitAPI):
1585
1585
  }
1586
1586
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1587
1587
 
1588
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1588
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1589
1589
  if isinstance(response, list):
1590
1590
  return response # public endpoints may return []-arrays
1591
1591
  if body == 'true':