ccxt 4.1.54__py2.py3-none-any.whl → 4.1.56__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 (251) hide show
  1. ccxt/__init__.py +2 -2
  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/abstract/bitbank.py +1 -0
  7. ccxt/abstract/coinbase.py +2 -0
  8. ccxt/abstract/htx.py +3 -0
  9. ccxt/abstract/huobi.py +3 -0
  10. ccxt/abstract/huobipro.py +3 -0
  11. ccxt/abstract/okex.py +3 -1
  12. ccxt/abstract/okex5.py +3 -1
  13. ccxt/abstract/okx.py +3 -1
  14. ccxt/ace.py +23 -23
  15. ccxt/alpaca.py +8 -8
  16. ccxt/ascendex.py +26 -26
  17. ccxt/async_support/__init__.py +2 -2
  18. ccxt/async_support/ace.py +23 -23
  19. ccxt/async_support/alpaca.py +8 -8
  20. ccxt/async_support/ascendex.py +26 -26
  21. ccxt/async_support/base/exchange.py +4 -2216
  22. ccxt/async_support/bigone.py +21 -24
  23. ccxt/async_support/binance.py +61 -54
  24. ccxt/async_support/bingx.py +28 -28
  25. ccxt/async_support/bit2c.py +9 -9
  26. ccxt/async_support/bitbank.py +11 -10
  27. ccxt/async_support/bitbns.py +11 -11
  28. ccxt/async_support/bitfinex.py +15 -15
  29. ccxt/async_support/bitfinex2.py +22 -22
  30. ccxt/async_support/bitflyer.py +13 -13
  31. ccxt/async_support/bitforex.py +10 -10
  32. ccxt/async_support/bitget.py +44 -44
  33. ccxt/async_support/bithumb.py +9 -9
  34. ccxt/async_support/bitmart.py +85 -104
  35. ccxt/async_support/bitmex.py +27 -27
  36. ccxt/async_support/bitopro.py +18 -18
  37. ccxt/async_support/bitpanda.py +18 -18
  38. ccxt/async_support/bitrue.py +14 -14
  39. ccxt/async_support/bitso.py +17 -17
  40. ccxt/async_support/bitstamp.py +17 -17
  41. ccxt/async_support/bittrex.py +22 -24
  42. ccxt/async_support/bitvavo.py +15 -15
  43. ccxt/async_support/bl3p.py +4 -4
  44. ccxt/async_support/blockchaincom.py +17 -17
  45. ccxt/async_support/btcalpha.py +14 -14
  46. ccxt/async_support/btcbox.py +9 -9
  47. ccxt/async_support/btcmarkets.py +17 -17
  48. ccxt/async_support/btcturk.py +9 -9
  49. ccxt/async_support/bybit.py +46 -46
  50. ccxt/async_support/cex.py +10 -10
  51. ccxt/async_support/coinbase.py +69 -25
  52. ccxt/async_support/coinbasepro.py +19 -19
  53. ccxt/async_support/coincheck.py +10 -10
  54. ccxt/async_support/coinex.py +57 -66
  55. ccxt/async_support/coinlist.py +22 -22
  56. ccxt/async_support/coinmate.py +10 -10
  57. ccxt/async_support/coinone.py +10 -10
  58. ccxt/async_support/coinsph.py +17 -17
  59. ccxt/async_support/coinspot.py +5 -5
  60. ccxt/async_support/cryptocom.py +27 -27
  61. ccxt/async_support/currencycom.py +18 -18
  62. ccxt/async_support/delta.py +21 -21
  63. ccxt/async_support/deribit.py +24 -24
  64. ccxt/async_support/digifinex.py +35 -35
  65. ccxt/async_support/exmo.py +19 -19
  66. ccxt/async_support/gate.py +38 -38
  67. ccxt/async_support/gemini.py +11 -11
  68. ccxt/async_support/hitbtc.py +27 -27
  69. ccxt/async_support/hollaex.py +19 -19
  70. ccxt/async_support/htx.py +47 -44
  71. ccxt/async_support/huobijp.py +22 -22
  72. ccxt/async_support/idex.py +20 -20
  73. ccxt/async_support/independentreserve.py +9 -9
  74. ccxt/async_support/indodax.py +10 -10
  75. ccxt/async_support/kraken.py +25 -25
  76. ccxt/async_support/krakenfutures.py +17 -17
  77. ccxt/async_support/kucoin.py +27 -27
  78. ccxt/async_support/kucoinfutures.py +20 -20
  79. ccxt/async_support/kuna.py +19 -19
  80. ccxt/async_support/latoken.py +14 -14
  81. ccxt/async_support/lbank.py +18 -18
  82. ccxt/async_support/luno.py +14 -14
  83. ccxt/async_support/lykke.py +12 -12
  84. ccxt/async_support/mercado.py +11 -11
  85. ccxt/async_support/mexc.py +36 -36
  86. ccxt/async_support/ndax.py +18 -18
  87. ccxt/async_support/novadax.py +17 -17
  88. ccxt/async_support/oceanex.py +12 -12
  89. ccxt/async_support/okcoin.py +19 -19
  90. ccxt/async_support/okx.py +48 -45
  91. ccxt/async_support/p2b.py +6 -6
  92. ccxt/async_support/paymium.py +6 -6
  93. ccxt/async_support/phemex.py +57 -57
  94. ccxt/async_support/poloniex.py +31 -30
  95. ccxt/async_support/poloniexfutures.py +16 -16
  96. ccxt/async_support/probit.py +22 -22
  97. ccxt/async_support/tidex.py +15 -15
  98. ccxt/async_support/timex.py +20 -20
  99. ccxt/async_support/tokocrypto.py +16 -16
  100. ccxt/async_support/upbit.py +15 -15
  101. ccxt/async_support/wavesexchange.py +12 -12
  102. ccxt/async_support/wazirx.py +13 -13
  103. ccxt/async_support/whitebit.py +26 -26
  104. ccxt/async_support/woo.py +47 -47
  105. ccxt/async_support/yobit.py +8 -8
  106. ccxt/async_support/zaif.py +10 -10
  107. ccxt/async_support/zonda.py +16 -16
  108. ccxt/base/errors.py +17 -16
  109. ccxt/base/exchange.py +57 -97
  110. ccxt/base/types.py +138 -139
  111. ccxt/bigone.py +21 -24
  112. ccxt/binance.py +61 -54
  113. ccxt/bingx.py +28 -28
  114. ccxt/bit2c.py +9 -9
  115. ccxt/bitbank.py +11 -10
  116. ccxt/bitbns.py +11 -11
  117. ccxt/bitfinex.py +15 -15
  118. ccxt/bitfinex2.py +22 -22
  119. ccxt/bitflyer.py +13 -13
  120. ccxt/bitforex.py +10 -10
  121. ccxt/bitget.py +44 -44
  122. ccxt/bithumb.py +9 -9
  123. ccxt/bitmart.py +85 -104
  124. ccxt/bitmex.py +27 -27
  125. ccxt/bitopro.py +18 -18
  126. ccxt/bitpanda.py +18 -18
  127. ccxt/bitrue.py +14 -14
  128. ccxt/bitso.py +17 -17
  129. ccxt/bitstamp.py +17 -17
  130. ccxt/bittrex.py +22 -24
  131. ccxt/bitvavo.py +15 -15
  132. ccxt/bl3p.py +4 -4
  133. ccxt/blockchaincom.py +17 -17
  134. ccxt/btcalpha.py +14 -14
  135. ccxt/btcbox.py +9 -9
  136. ccxt/btcmarkets.py +17 -17
  137. ccxt/btcturk.py +9 -9
  138. ccxt/bybit.py +46 -46
  139. ccxt/cex.py +10 -10
  140. ccxt/coinbase.py +69 -25
  141. ccxt/coinbasepro.py +19 -19
  142. ccxt/coincheck.py +10 -10
  143. ccxt/coinex.py +57 -66
  144. ccxt/coinlist.py +22 -22
  145. ccxt/coinmate.py +10 -10
  146. ccxt/coinone.py +10 -10
  147. ccxt/coinsph.py +17 -17
  148. ccxt/coinspot.py +5 -5
  149. ccxt/cryptocom.py +27 -27
  150. ccxt/currencycom.py +18 -18
  151. ccxt/delta.py +21 -21
  152. ccxt/deribit.py +24 -24
  153. ccxt/digifinex.py +35 -35
  154. ccxt/exmo.py +19 -19
  155. ccxt/gate.py +38 -38
  156. ccxt/gemini.py +11 -11
  157. ccxt/hitbtc.py +27 -27
  158. ccxt/hollaex.py +19 -19
  159. ccxt/htx.py +47 -44
  160. ccxt/huobijp.py +22 -22
  161. ccxt/idex.py +20 -20
  162. ccxt/independentreserve.py +9 -9
  163. ccxt/indodax.py +10 -10
  164. ccxt/kraken.py +25 -25
  165. ccxt/krakenfutures.py +17 -17
  166. ccxt/kucoin.py +27 -27
  167. ccxt/kucoinfutures.py +20 -20
  168. ccxt/kuna.py +19 -19
  169. ccxt/latoken.py +14 -14
  170. ccxt/lbank.py +18 -18
  171. ccxt/luno.py +14 -14
  172. ccxt/lykke.py +12 -12
  173. ccxt/mercado.py +11 -11
  174. ccxt/mexc.py +36 -36
  175. ccxt/ndax.py +18 -18
  176. ccxt/novadax.py +17 -17
  177. ccxt/oceanex.py +12 -12
  178. ccxt/okcoin.py +19 -19
  179. ccxt/okx.py +48 -45
  180. ccxt/p2b.py +6 -6
  181. ccxt/paymium.py +6 -6
  182. ccxt/phemex.py +57 -57
  183. ccxt/poloniex.py +31 -30
  184. ccxt/poloniexfutures.py +16 -16
  185. ccxt/pro/__init__.py +1 -1
  186. ccxt/pro/alpaca.py +3 -3
  187. ccxt/pro/ascendex.py +2 -2
  188. ccxt/pro/binance.py +9 -9
  189. ccxt/pro/bingx.py +3 -3
  190. ccxt/pro/bitfinex.py +3 -3
  191. ccxt/pro/bitfinex2.py +3 -3
  192. ccxt/pro/bitget.py +3 -3
  193. ccxt/pro/bitmart.py +2 -2
  194. ccxt/pro/bitmex.py +3 -3
  195. ccxt/pro/bitpanda.py +3 -3
  196. ccxt/pro/bitrue.py +2 -2
  197. ccxt/pro/bitstamp.py +2 -2
  198. ccxt/pro/bittrex.py +3 -3
  199. ccxt/pro/bitvavo.py +3 -3
  200. ccxt/pro/blockchaincom.py +2 -2
  201. ccxt/pro/bybit.py +4 -4
  202. ccxt/pro/cex.py +3 -3
  203. ccxt/pro/coinbasepro.py +3 -3
  204. ccxt/pro/coinex.py +2 -2
  205. ccxt/pro/cryptocom.py +5 -5
  206. ccxt/pro/deribit.py +3 -3
  207. ccxt/pro/exmo.py +2 -2
  208. ccxt/pro/gate.py +3 -3
  209. ccxt/pro/gemini.py +2 -2
  210. ccxt/pro/hitbtc.py +4 -4
  211. ccxt/pro/hollaex.py +3 -3
  212. ccxt/pro/htx.py +3 -3
  213. ccxt/pro/idex.py +3 -3
  214. ccxt/pro/kraken.py +7 -7
  215. ccxt/pro/krakenfutures.py +4 -4
  216. ccxt/pro/kucoin.py +3 -3
  217. ccxt/pro/kucoinfutures.py +3 -3
  218. ccxt/pro/mexc.py +3 -3
  219. ccxt/pro/okcoin.py +2 -2
  220. ccxt/pro/okx.py +6 -6
  221. ccxt/pro/phemex.py +3 -3
  222. ccxt/pro/poloniex.py +3 -3
  223. ccxt/pro/poloniexfutures.py +3 -3
  224. ccxt/pro/probit.py +3 -3
  225. ccxt/pro/wazirx.py +3 -3
  226. ccxt/pro/whitebit.py +3 -3
  227. ccxt/pro/woo.py +2 -2
  228. ccxt/probit.py +22 -22
  229. ccxt/test/base/test_shared_methods.py +3 -3
  230. ccxt/test/test_async.py +543 -535
  231. ccxt/test/test_sync.py +542 -534
  232. ccxt/tidex.py +15 -15
  233. ccxt/timex.py +20 -20
  234. ccxt/tokocrypto.py +16 -16
  235. ccxt/upbit.py +15 -15
  236. ccxt/wavesexchange.py +12 -12
  237. ccxt/wazirx.py +13 -13
  238. ccxt/whitebit.py +26 -26
  239. ccxt/woo.py +47 -47
  240. ccxt/yobit.py +8 -8
  241. ccxt/zaif.py +10 -10
  242. ccxt/zonda.py +16 -16
  243. {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/METADATA +10 -8
  244. ccxt-4.1.56.dist-info/RECORD +449 -0
  245. ccxt/async_support/bitstamp1.py +0 -402
  246. ccxt/async_support/lbank2.py +0 -2620
  247. ccxt/bitstamp1.py +0 -402
  248. ccxt/lbank2.py +0 -2619
  249. ccxt-4.1.54.dist-info/RECORD +0 -453
  250. {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/WHEEL +0 -0
  251. {ccxt-4.1.54.dist-info → ccxt-4.1.56.dist-info}/top_level.txt +0 -0
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.bigone import ImplicitAPI
8
- from ccxt.base.types import Balances, Int, Market, Order, OrderBook, OrderSide, OrderType, String, Strings, Ticker, Tickers, Trade, Transaction
8
+ from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Bool, Strings, Ticker, Tickers, Trade, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -414,8 +414,8 @@ class bigone(Exchange, ImplicitAPI):
414
414
  networks = {}
415
415
  chains = self.safe_value(currency, 'binding_gateways', [])
416
416
  currencyMaxPrecision = self.parse_precision(self.safe_string_2(currency, 'withdrawal_scale', 'scale'))
417
- currencyDepositEnabled = None
418
- currencyWithdrawEnabled = None
417
+ currencyDepositEnabled: Bool = None
418
+ currencyWithdrawEnabled: Bool = None
419
419
  for j in range(0, len(chains)):
420
420
  chain = chains[j]
421
421
  networkId = self.safe_string(chain, 'gateway_name')
@@ -570,7 +570,7 @@ class bigone(Exchange, ImplicitAPI):
570
570
  'info': market,
571
571
  }
572
572
 
573
- def parse_ticker(self, ticker, market=None) -> Ticker:
573
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
574
574
  #
575
575
  # {
576
576
  # "asset_pair_name":"ETH-BTC",
@@ -747,7 +747,7 @@ class bigone(Exchange, ImplicitAPI):
747
747
  orderbook = self.safe_value(response, 'data', {})
748
748
  return self.parse_order_book(orderbook, market['symbol'], None, 'bids', 'asks', 'price', 'quantity')
749
749
 
750
- def parse_trade(self, trade, market=None) -> Trade:
750
+ def parse_trade(self, trade, market: Market = None) -> Trade:
751
751
  #
752
752
  # fetchTrades(public)
753
753
  #
@@ -796,7 +796,7 @@ class bigone(Exchange, ImplicitAPI):
796
796
  market = self.safe_market(marketId, market, '-')
797
797
  side = self.safe_string(trade, 'side')
798
798
  takerSide = self.safe_string(trade, 'taker_side')
799
- takerOrMaker = None
799
+ takerOrMaker: Str = None
800
800
  if (takerSide is not None) and (side is not None) and (side != 'SELF_TRADING'):
801
801
  takerOrMaker = 'taker' if (takerSide == side) else 'maker'
802
802
  if side is None:
@@ -810,12 +810,9 @@ class bigone(Exchange, ImplicitAPI):
810
810
  side = 'sell'
811
811
  makerOrderId = self.safe_string(trade, 'maker_order_id')
812
812
  takerOrderId = self.safe_string(trade, 'taker_order_id')
813
- orderId = None
813
+ orderId: Str = None
814
814
  if makerOrderId is not None:
815
- if takerOrderId is not None:
816
- orderId = [makerOrderId, takerOrderId]
817
- else:
818
- orderId = makerOrderId
815
+ orderId = makerOrderId
819
816
  elif takerOrderId is not None:
820
817
  orderId = takerOrderId
821
818
  id = self.safe_string(trade, 'id')
@@ -912,7 +909,7 @@ class bigone(Exchange, ImplicitAPI):
912
909
  trades = self.safe_value(response, 'data', [])
913
910
  return self.parse_trades(trades, market, since, limit)
914
911
 
915
- def parse_ohlcv(self, ohlcv, market=None) -> list:
912
+ def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
916
913
  #
917
914
  # {
918
915
  # "close": "0.021562",
@@ -1035,7 +1032,7 @@ class bigone(Exchange, ImplicitAPI):
1035
1032
  }
1036
1033
  return self.safe_string(types, type, type)
1037
1034
 
1038
- def parse_order(self, order, market=None) -> Order:
1035
+ def parse_order(self, order, market: Market = None) -> Order:
1039
1036
  #
1040
1037
  # {
1041
1038
  # "id": "42154072251",
@@ -1189,7 +1186,7 @@ class bigone(Exchange, ImplicitAPI):
1189
1186
  order = self.safe_value(response, 'data')
1190
1187
  return self.parse_order(order, market)
1191
1188
 
1192
- async def cancel_order(self, id: str, symbol: String = None, params={}):
1189
+ async def cancel_order(self, id: str, symbol: Str = None, params={}):
1193
1190
  """
1194
1191
  cancels an open order
1195
1192
  :param str id: order id
@@ -1215,7 +1212,7 @@ class bigone(Exchange, ImplicitAPI):
1215
1212
  order = self.safe_value(response, 'data')
1216
1213
  return self.parse_order(order)
1217
1214
 
1218
- async def cancel_all_orders(self, symbol: String = None, params={}):
1215
+ async def cancel_all_orders(self, symbol: Str = None, params={}):
1219
1216
  """
1220
1217
  cancel all open orders
1221
1218
  :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
@@ -1242,7 +1239,7 @@ class bigone(Exchange, ImplicitAPI):
1242
1239
  #
1243
1240
  return response
1244
1241
 
1245
- async def fetch_order(self, id: str, symbol: String = None, params={}):
1242
+ async def fetch_order(self, id: str, symbol: Str = None, params={}):
1246
1243
  """
1247
1244
  fetches information on an order made by the user
1248
1245
  :param str symbol: not used by bigone fetchOrder
@@ -1255,7 +1252,7 @@ class bigone(Exchange, ImplicitAPI):
1255
1252
  order = self.safe_value(response, 'data', {})
1256
1253
  return self.parse_order(order)
1257
1254
 
1258
- async def fetch_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1255
+ async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1259
1256
  """
1260
1257
  fetches information on multiple orders made by the user
1261
1258
  :param str symbol: unified market symbol of the market orders were made in
@@ -1300,7 +1297,7 @@ class bigone(Exchange, ImplicitAPI):
1300
1297
  orders = self.safe_value(response, 'data', [])
1301
1298
  return self.parse_orders(orders, market, since, limit)
1302
1299
 
1303
- async def fetch_my_trades(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
1300
+ async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1304
1301
  """
1305
1302
  fetch all trades made by the user
1306
1303
  :param str symbol: unified market symbol
@@ -1364,7 +1361,7 @@ class bigone(Exchange, ImplicitAPI):
1364
1361
  }
1365
1362
  return self.safe_string(statuses, status)
1366
1363
 
1367
- async def fetch_open_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1364
+ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1368
1365
  """
1369
1366
  fetch all unfilled currently open orders
1370
1367
  :param str symbol: unified market symbol
@@ -1378,7 +1375,7 @@ class bigone(Exchange, ImplicitAPI):
1378
1375
  }
1379
1376
  return await self.fetch_orders(symbol, since, limit, self.extend(request, params))
1380
1377
 
1381
- async def fetch_closed_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1378
+ async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1382
1379
  """
1383
1380
  fetches information on multiple closed orders made by the user
1384
1381
  :param str symbol: unified market symbol of the market orders were made in
@@ -1484,7 +1481,7 @@ class bigone(Exchange, ImplicitAPI):
1484
1481
  }
1485
1482
  return self.safe_string(statuses, status, status)
1486
1483
 
1487
- def parse_transaction(self, transaction, currency=None) -> Transaction:
1484
+ def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
1488
1485
  #
1489
1486
  # fetchDeposits
1490
1487
  #
@@ -1571,7 +1568,7 @@ class bigone(Exchange, ImplicitAPI):
1571
1568
  'internal': internal,
1572
1569
  }
1573
1570
 
1574
- async def fetch_deposits(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1571
+ async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1575
1572
  """
1576
1573
  fetch all deposits made to an account
1577
1574
  :param str code: unified currency code
@@ -1618,7 +1615,7 @@ class bigone(Exchange, ImplicitAPI):
1618
1615
  deposits = self.safe_value(response, 'data', [])
1619
1616
  return self.parse_transactions(deposits, currency, since, limit)
1620
1617
 
1621
- async def fetch_withdrawals(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1618
+ async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1622
1619
  """
1623
1620
  fetch all withdrawals made from an account
1624
1621
  :param str code: unified currency code
@@ -1708,7 +1705,7 @@ class bigone(Exchange, ImplicitAPI):
1708
1705
  transfer['id'] = guid
1709
1706
  return transfer
1710
1707
 
1711
- def parse_transfer(self, transfer, currency=None):
1708
+ def parse_transfer(self, transfer, currency: Currency = None):
1712
1709
  #
1713
1710
  # {
1714
1711
  # "code": 0,
@@ -8,7 +8,7 @@ from ccxt.abstract.binance import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- from ccxt.base.types import Balances, Greeks, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, String, Strings, Ticker, Tickers, Trade, Transaction
11
+ from ccxt.base.types import Balances, Currency, Greeks, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import PermissionDenied
@@ -175,6 +175,7 @@ class binance(Exchange, ImplicitAPI):
175
175
  'dapiPrivate': 'https://testnet.binancefuture.com/dapi/v1',
176
176
  'dapiPrivateV2': 'https://testnet.binancefuture.com/dapi/v2',
177
177
  'fapiPublic': 'https://testnet.binancefuture.com/fapi/v1',
178
+ 'fapiPublicV2': 'https://testnet.binancefuture.com/fapi/v2',
178
179
  'fapiPrivate': 'https://testnet.binancefuture.com/fapi/v1',
179
180
  'fapiPrivateV2': 'https://testnet.binancefuture.com/fapi/v2',
180
181
  'public': 'https://testnet.binance.vision/api/v3',
@@ -193,6 +194,7 @@ class binance(Exchange, ImplicitAPI):
193
194
  'dapiPrivateV2': 'https://dapi.binance.com/dapi/v2',
194
195
  'dapiData': 'https://dapi.binance.com/futures/data',
195
196
  'fapiPublic': 'https://fapi.binance.com/fapi/v1',
197
+ 'fapiPublicV2': 'https://fapi.binance.com/fapi/v2',
196
198
  'fapiPrivate': 'https://fapi.binance.com/fapi/v1',
197
199
  'fapiData': 'https://fapi.binance.com/futures/data',
198
200
  'fapiPrivateV2': 'https://fapi.binance.com/fapi/v2',
@@ -810,6 +812,11 @@ class binance(Exchange, ImplicitAPI):
810
812
  'listenKey': 1,
811
813
  },
812
814
  },
815
+ 'fapiPublicV2': {
816
+ 'get': {
817
+ 'ticker/price': 0,
818
+ },
819
+ },
813
820
  'fapiPrivateV2': {
814
821
  'get': {
815
822
  'account': 1,
@@ -2776,7 +2783,7 @@ class binance(Exchange, ImplicitAPI):
2776
2783
  orderbook['nonce'] = self.safe_integer_2(response, 'lastUpdateId', 'u')
2777
2784
  return orderbook
2778
2785
 
2779
- def parse_ticker(self, ticker, market=None) -> Ticker:
2786
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
2780
2787
  #
2781
2788
  # {
2782
2789
  # "symbol": "ETHBTC",
@@ -3029,7 +3036,7 @@ class binance(Exchange, ImplicitAPI):
3029
3036
  type, params = self.handle_market_type_and_params('fetchLastPrices', market, params)
3030
3037
  response = None
3031
3038
  if self.is_linear(type, subType):
3032
- response = await self.fapiPublicGetTickerPrice(params)
3039
+ response = await self.fapiPublicV2GetTickerPrice(params)
3033
3040
  #
3034
3041
  # [
3035
3042
  # {
@@ -3067,7 +3074,7 @@ class binance(Exchange, ImplicitAPI):
3067
3074
  raise NotSupported(self.id + ' fetchLastPrices() does not support ' + type + ' markets yet')
3068
3075
  return self.parse_last_prices(response, symbols)
3069
3076
 
3070
- def parse_last_price(self, info, market=None):
3077
+ def parse_last_price(self, info, market: Market = None):
3071
3078
  #
3072
3079
  # spot
3073
3080
  #
@@ -3143,7 +3150,7 @@ class binance(Exchange, ImplicitAPI):
3143
3150
  response = await getattr(self, method)(query)
3144
3151
  return self.parse_tickers(response, symbols)
3145
3152
 
3146
- def parse_ohlcv(self, ohlcv, market=None) -> list:
3153
+ def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
3147
3154
  # when api method = publicGetKlines or fapiPublicGetKlines or dapiPublicGetKlines
3148
3155
  # [
3149
3156
  # 1591478520000, # open time
@@ -3309,7 +3316,7 @@ class binance(Exchange, ImplicitAPI):
3309
3316
  #
3310
3317
  return self.parse_ohlcvs(response, market, timeframe, since, limit)
3311
3318
 
3312
- def parse_trade(self, trade, market=None) -> Trade:
3319
+ def parse_trade(self, trade, market: Market = None) -> Trade:
3313
3320
  if 'isDustTrade' in trade:
3314
3321
  return self.parse_dust_trade(trade, market)
3315
3322
  #
@@ -3917,7 +3924,7 @@ class binance(Exchange, ImplicitAPI):
3917
3924
  }
3918
3925
  return self.safe_string(statuses, status, status)
3919
3926
 
3920
- def parse_order(self, order, market=None) -> Order:
3927
+ def parse_order(self, order, market: Market = None) -> Order:
3921
3928
  #
3922
3929
  # spot
3923
3930
  #
@@ -4463,7 +4470,7 @@ class binance(Exchange, ImplicitAPI):
4463
4470
  requestParams = self.omit(params, ['quoteOrderQty', 'cost', 'stopPrice', 'test', 'type', 'newClientOrderId', 'clientOrderId', 'postOnly'])
4464
4471
  return self.extend(request, requestParams)
4465
4472
 
4466
- async def fetch_order(self, id: str, symbol: String = None, params={}):
4473
+ async def fetch_order(self, id: str, symbol: Str = None, params={}):
4467
4474
  """
4468
4475
  fetches information on an order made by the user
4469
4476
  :see: https://binance-docs.github.io/apidocs/spot/en/#query-order-user_data
@@ -4508,7 +4515,7 @@ class binance(Exchange, ImplicitAPI):
4508
4515
  response = await getattr(self, method)(self.extend(request, requestParams))
4509
4516
  return self.parse_order(response, market)
4510
4517
 
4511
- async def fetch_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
4518
+ async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
4512
4519
  """
4513
4520
  fetches information on multiple orders made by the user
4514
4521
  :see: https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
@@ -4634,7 +4641,7 @@ class binance(Exchange, ImplicitAPI):
4634
4641
  #
4635
4642
  return self.parse_orders(response, market, since, limit)
4636
4643
 
4637
- async def fetch_open_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
4644
+ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
4638
4645
  """
4639
4646
  :see: https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade
4640
4647
  :see: https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
@@ -4697,7 +4704,7 @@ class binance(Exchange, ImplicitAPI):
4697
4704
  response = await getattr(self, method)(self.extend(request, requestParams))
4698
4705
  return self.parse_orders(response, market, since, limit)
4699
4706
 
4700
- async def fetch_closed_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
4707
+ async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
4701
4708
  """
4702
4709
  fetches information on multiple closed orders made by the user
4703
4710
  :see: https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
@@ -4715,7 +4722,7 @@ class binance(Exchange, ImplicitAPI):
4715
4722
  orders = await self.fetch_orders(symbol, since, limit, params)
4716
4723
  return self.filter_by(orders, 'status', 'closed')
4717
4724
 
4718
- async def fetch_canceled_orders(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
4725
+ async def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4719
4726
  """
4720
4727
  fetches information on multiple canceled orders made by the user
4721
4728
  :see: https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
@@ -4738,7 +4745,7 @@ class binance(Exchange, ImplicitAPI):
4738
4745
  filteredOrders = self.filter_by(orders, 'status', 'canceled')
4739
4746
  return self.filter_by_limit(filteredOrders, limit)
4740
4747
 
4741
- async def cancel_order(self, id: str, symbol: String = None, params={}):
4748
+ async def cancel_order(self, id: str, symbol: Str = None, params={}):
4742
4749
  """
4743
4750
  cancels an open order
4744
4751
  :see: https://binance-docs.github.io/apidocs/spot/en/#cancel-order-trade
@@ -4785,7 +4792,7 @@ class binance(Exchange, ImplicitAPI):
4785
4792
  response = await getattr(self, method)(self.extend(request, requestParams))
4786
4793
  return self.parse_order(response, market)
4787
4794
 
4788
- async def cancel_all_orders(self, symbol: String = None, params={}):
4795
+ async def cancel_all_orders(self, symbol: Str = None, params={}):
4789
4796
  """
4790
4797
  :see: https://binance-docs.github.io/apidocs/spot/en/#cancel-all-open-orders-on-a-symbol-trade
4791
4798
  :see: https://binance-docs.github.io/apidocs/futures/en/#cancel-all-open-orders-trade
@@ -4824,7 +4831,7 @@ class binance(Exchange, ImplicitAPI):
4824
4831
  else:
4825
4832
  return response
4826
4833
 
4827
- async def cancel_orders(self, ids: List[Int], symbol: String = None, params={}):
4834
+ async def cancel_orders(self, ids: List[Int], symbol: Str = None, params={}):
4828
4835
  """
4829
4836
  cancel multiple orders
4830
4837
  :see: https://binance-docs.github.io/apidocs/futures/en/#cancel-multiple-orders-trade
@@ -4889,7 +4896,7 @@ class binance(Exchange, ImplicitAPI):
4889
4896
  #
4890
4897
  return self.parse_orders(response, market)
4891
4898
 
4892
- async def fetch_order_trades(self, id: str, symbol: String = None, since: Int = None, limit: Int = None, params={}):
4899
+ async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4893
4900
  """
4894
4901
  fetch all the trades made from a single order
4895
4902
  :see: https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data
@@ -4915,7 +4922,7 @@ class binance(Exchange, ImplicitAPI):
4915
4922
  }
4916
4923
  return await self.fetch_my_trades(symbol, since, limit, self.extend(request, params))
4917
4924
 
4918
- async def fetch_my_trades(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
4925
+ async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4919
4926
  """
4920
4927
  fetch all trades made by the user
4921
4928
  :see: https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data
@@ -5048,7 +5055,7 @@ class binance(Exchange, ImplicitAPI):
5048
5055
  #
5049
5056
  return self.parse_trades(response, market, since, limit)
5050
5057
 
5051
- async def fetch_my_dust_trades(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
5058
+ async def fetch_my_dust_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5052
5059
  """
5053
5060
  fetch all dust trades made by the user
5054
5061
  :see: https://binance-docs.github.io/apidocs/spot/en/#dustlog-user_data
@@ -5110,7 +5117,7 @@ class binance(Exchange, ImplicitAPI):
5110
5117
  trades = self.parse_trades(data, None, since, limit)
5111
5118
  return self.filter_by_since_limit(trades, since, limit)
5112
5119
 
5113
- def parse_dust_trade(self, trade, market=None):
5120
+ def parse_dust_trade(self, trade, market: Market = None):
5114
5121
  #
5115
5122
  # {
5116
5123
  # "fromAsset": "USDT",
@@ -5177,7 +5184,7 @@ class binance(Exchange, ImplicitAPI):
5177
5184
  'info': trade,
5178
5185
  }
5179
5186
 
5180
- async def fetch_deposits(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
5187
+ async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
5181
5188
  """
5182
5189
  :see: https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
5183
5190
  fetch all deposits made to an account
@@ -5278,7 +5285,7 @@ class binance(Exchange, ImplicitAPI):
5278
5285
  response[i]['type'] = 'deposit'
5279
5286
  return self.parse_transactions(response, currency, since, limit)
5280
5287
 
5281
- async def fetch_withdrawals(self, code: String = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
5288
+ async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
5282
5289
  """
5283
5290
  :see: https://binance-docs.github.io/apidocs/spot/en/#get-fiat-deposit-withdraw-history-user_data
5284
5291
  :see: https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
@@ -5437,7 +5444,7 @@ class binance(Exchange, ImplicitAPI):
5437
5444
  statuses = self.safe_value(statusesByType, type, {})
5438
5445
  return self.safe_string(statuses, status, status)
5439
5446
 
5440
- def parse_transaction(self, transaction, currency=None) -> Transaction:
5447
+ def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
5441
5448
  #
5442
5449
  # fetchDeposits
5443
5450
  #
@@ -5565,7 +5572,7 @@ class binance(Exchange, ImplicitAPI):
5565
5572
  }
5566
5573
  return self.safe_string(statuses, status, status)
5567
5574
 
5568
- def parse_transfer(self, transfer, currency=None):
5575
+ def parse_transfer(self, transfer, currency: Currency = None):
5569
5576
  #
5570
5577
  # transfer
5571
5578
  #
@@ -5612,7 +5619,7 @@ class binance(Exchange, ImplicitAPI):
5612
5619
  'status': status,
5613
5620
  }
5614
5621
 
5615
- def parse_income(self, income, market=None):
5622
+ def parse_income(self, income, market: Market = None):
5616
5623
  #
5617
5624
  # {
5618
5625
  # "symbol": "ETHUSDT",
@@ -5721,7 +5728,7 @@ class binance(Exchange, ImplicitAPI):
5721
5728
  #
5722
5729
  return self.parse_transfer(response, currency)
5723
5730
 
5724
- async def fetch_transfers(self, code: String = None, since: Int = None, limit: Int = None, params={}):
5731
+ async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
5725
5732
  """
5726
5733
  :see: https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
5727
5734
  fetch a history of internal transfers made on an account
@@ -6020,7 +6027,7 @@ class binance(Exchange, ImplicitAPI):
6020
6027
  #
6021
6028
  return self.parse_deposit_withdraw_fees(response, codes, 'coin')
6022
6029
 
6023
- def parse_deposit_withdraw_fee(self, fee, currency=None):
6030
+ def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
6024
6031
  #
6025
6032
  # {
6026
6033
  # "coin": "BAT",
@@ -6121,7 +6128,7 @@ class binance(Exchange, ImplicitAPI):
6121
6128
  # {id: '9a67628b16ba4988ae20d329333f16bc'}
6122
6129
  return self.parse_transaction(response, currency)
6123
6130
 
6124
- def parse_trading_fee(self, fee, market=None):
6131
+ def parse_trading_fee(self, fee, market: Market = None):
6125
6132
  #
6126
6133
  # spot
6127
6134
  # [
@@ -6432,7 +6439,7 @@ class binance(Exchange, ImplicitAPI):
6432
6439
  #
6433
6440
  return self.parse_funding_rate(response, market)
6434
6441
 
6435
- async def fetch_funding_rate_history(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
6442
+ async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
6436
6443
  """
6437
6444
  fetches historical funding rate prices
6438
6445
  :see: https://binance-docs.github.io/apidocs/futures/en/#get-funding-rate-history
@@ -6530,7 +6537,7 @@ class binance(Exchange, ImplicitAPI):
6530
6537
  result.append(parsed)
6531
6538
  return self.filter_by_array(result, 'symbol', symbols)
6532
6539
 
6533
- def parse_funding_rate(self, contract, market=None):
6540
+ def parse_funding_rate(self, contract, market: Market = None):
6534
6541
  # ensure it matches with https://www.binance.com/en/futures/funding-history/0
6535
6542
  #
6536
6543
  # {
@@ -6602,7 +6609,7 @@ class binance(Exchange, ImplicitAPI):
6602
6609
  result.append(parsed)
6603
6610
  return result
6604
6611
 
6605
- def parse_account_position(self, position, market=None):
6612
+ def parse_account_position(self, position, market: Market = None):
6606
6613
  #
6607
6614
  # usdm
6608
6615
  # {
@@ -6786,7 +6793,7 @@ class binance(Exchange, ImplicitAPI):
6786
6793
  'percentage': percentage,
6787
6794
  }
6788
6795
 
6789
- def parse_position_risk(self, position, market=None):
6796
+ def parse_position_risk(self, position, market: Market = None):
6790
6797
  #
6791
6798
  # usdm
6792
6799
  #
@@ -7042,7 +7049,7 @@ class binance(Exchange, ImplicitAPI):
7042
7049
  #
7043
7050
  return self.parse_leverage_tiers(response, symbols, 'symbol')
7044
7051
 
7045
- def parse_market_leverage_tiers(self, info, market=None):
7052
+ def parse_market_leverage_tiers(self, info, market: Market = None):
7046
7053
  """
7047
7054
  * @ignore
7048
7055
  :param dict info: Exchange response for 1 market
@@ -7174,7 +7181,7 @@ class binance(Exchange, ImplicitAPI):
7174
7181
  result.append(self.parse_position(response[i], market))
7175
7182
  return self.filter_by_array_positions(result, 'symbol', symbols, False)
7176
7183
 
7177
- def parse_position(self, position, market=None):
7184
+ def parse_position(self, position, market: Market = None):
7178
7185
  #
7179
7186
  # {
7180
7187
  # "entryPrice": "27.70000000",
@@ -7368,7 +7375,7 @@ class binance(Exchange, ImplicitAPI):
7368
7375
  symbols = self.market_symbols(symbols)
7369
7376
  return self.filter_by_array_positions(result, 'symbol', symbols, False)
7370
7377
 
7371
- async def fetch_funding_history(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
7378
+ async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
7372
7379
  """
7373
7380
  fetch the history of funding payments paid and received on self account
7374
7381
  :see: https://binance-docs.github.io/apidocs/futures/en/#get-income-history-user_data
@@ -7408,7 +7415,7 @@ class binance(Exchange, ImplicitAPI):
7408
7415
  response = await getattr(self, method)(self.extend(request, params))
7409
7416
  return self.parse_incomes(response, market, since, limit)
7410
7417
 
7411
- async def set_leverage(self, leverage, symbol: String = None, params={}):
7418
+ async def set_leverage(self, leverage, symbol: Str = None, params={}):
7412
7419
  """
7413
7420
  set the level of leverage for a market
7414
7421
  :see: https://binance-docs.github.io/apidocs/futures/en/#change-initial-leverage-trade
@@ -7438,7 +7445,7 @@ class binance(Exchange, ImplicitAPI):
7438
7445
  }
7439
7446
  return await getattr(self, method)(self.extend(request, params))
7440
7447
 
7441
- async def set_margin_mode(self, marginMode: str, symbol: String = None, params={}):
7448
+ async def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
7442
7449
  """
7443
7450
  set margin mode to 'cross' or 'isolated'
7444
7451
  :see: https://binance-docs.github.io/apidocs/futures/en/#change-margin-type-trade
@@ -7493,7 +7500,7 @@ class binance(Exchange, ImplicitAPI):
7493
7500
  raise e
7494
7501
  return response
7495
7502
 
7496
- async def set_position_mode(self, hedged, symbol: String = None, params={}):
7503
+ async def set_position_mode(self, hedged, symbol: Str = None, params={}):
7497
7504
  """
7498
7505
  set hedged to True or False for a market
7499
7506
  :see: https://binance-docs.github.io/apidocs/futures/en/#change-position-mode-trade
@@ -7528,7 +7535,7 @@ class binance(Exchange, ImplicitAPI):
7528
7535
  #
7529
7536
  return await getattr(self, method)(self.extend(request, params))
7530
7537
 
7531
- async def fetch_settlement_history(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
7538
+ async def fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
7532
7539
  """
7533
7540
  fetches historical settlement records
7534
7541
  :see: https://binance-docs.github.io/apidocs/voptions/en/#historical-exercise-records
@@ -7568,7 +7575,7 @@ class binance(Exchange, ImplicitAPI):
7568
7575
  sorted = self.sort_by(settlements, 'timestamp')
7569
7576
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
7570
7577
 
7571
- async def fetch_my_settlement_history(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
7578
+ async def fetch_my_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
7572
7579
  """
7573
7580
  fetches historical settlement records of the user
7574
7581
  :see: https://binance-docs.github.io/apidocs/voptions/en/#user-exercise-record-user_data
@@ -7697,7 +7704,7 @@ class binance(Exchange, ImplicitAPI):
7697
7704
  result.append(self.parse_settlement(settlements[i], market))
7698
7705
  return result
7699
7706
 
7700
- async def fetch_ledger(self, code: String = None, since: Int = None, limit: Int = None, params={}):
7707
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
7701
7708
  """
7702
7709
  fetch the history of changes, actions done by the user or operations that altered the balance of the user
7703
7710
  :see: https://binance-docs.github.io/apidocs/voptions/en/#account-funding-flow-user_data
@@ -7774,7 +7781,7 @@ class binance(Exchange, ImplicitAPI):
7774
7781
  #
7775
7782
  return self.parse_ledger(response, currency, since, limit)
7776
7783
 
7777
- def parse_ledger_entry(self, item, currency=None):
7784
+ def parse_ledger_entry(self, item, currency: Currency = None):
7778
7785
  #
7779
7786
  # options(eapi)
7780
7787
  #
@@ -8069,7 +8076,7 @@ class binance(Exchange, ImplicitAPI):
8069
8076
  'code': code,
8070
8077
  })
8071
8078
 
8072
- def parse_margin_modification(self, data, market=None):
8079
+ def parse_margin_modification(self, data, market: Market = None):
8073
8080
  rawType = self.safe_integer(data, 'type')
8074
8081
  resultType = 'add' if (rawType == 1) else 'reduce'
8075
8082
  resultAmount = self.safe_number(data, 'amount')
@@ -8184,7 +8191,7 @@ class binance(Exchange, ImplicitAPI):
8184
8191
  sorted = self.sort_by(result, 'timestamp')
8185
8192
  return self.filter_by_currency_since_limit(sorted, code, since, limit)
8186
8193
 
8187
- def parse_borrow_rate(self, info, currency=None):
8194
+ def parse_borrow_rate(self, info, currency: Currency = None):
8188
8195
  #
8189
8196
  # {
8190
8197
  # "asset": "USDT",
@@ -8194,9 +8201,9 @@ class binance(Exchange, ImplicitAPI):
8194
8201
  # }
8195
8202
  #
8196
8203
  timestamp = self.safe_number(info, 'timestamp')
8197
- currency = self.safe_string(info, 'asset')
8204
+ currencyId = self.safe_string(info, 'asset')
8198
8205
  return {
8199
- 'currency': self.safe_currency_code(currency),
8206
+ 'currency': self.safe_currency_code(currencyId, currency),
8200
8207
  'rate': self.safe_number(info, 'dailyInterestRate'),
8201
8208
  'period': 86400000,
8202
8209
  'timestamp': timestamp,
@@ -8287,7 +8294,7 @@ class binance(Exchange, ImplicitAPI):
8287
8294
  #
8288
8295
  return response
8289
8296
 
8290
- async def fetch_borrow_interest(self, code: String = None, symbol: String = None, since: Int = None, limit: Int = None, params={}):
8297
+ async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
8291
8298
  """
8292
8299
  fetch the interest owed by the user for borrowing currency for margin trading
8293
8300
  :see: https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data
@@ -8332,7 +8339,7 @@ class binance(Exchange, ImplicitAPI):
8332
8339
  interest = self.parse_borrow_interests(rows, market)
8333
8340
  return self.filter_by_currency_since_limit(interest, code, since, limit)
8334
8341
 
8335
- def parse_borrow_interest(self, info, market=None):
8342
+ def parse_borrow_interest(self, info, market: Market = None):
8336
8343
  symbol = self.safe_string(info, 'isolatedSymbol')
8337
8344
  timestamp = self.safe_number(info, 'interestAccuredTime')
8338
8345
  marginMode = 'cross' if (symbol is None) else 'isolated'
@@ -8349,7 +8356,7 @@ class binance(Exchange, ImplicitAPI):
8349
8356
  'info': info,
8350
8357
  }
8351
8358
 
8352
- async def repay_margin(self, code: str, amount, symbol: String = None, params={}):
8359
+ async def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
8353
8360
  """
8354
8361
  repay borrowed margin and interest
8355
8362
  :see: https://binance-docs.github.io/apidocs/spot/en/#margin-account-repay-margin
@@ -8380,7 +8387,7 @@ class binance(Exchange, ImplicitAPI):
8380
8387
  #
8381
8388
  return self.parse_margin_loan(response, currency)
8382
8389
 
8383
- async def borrow_margin(self, code: str, amount, symbol: String = None, params={}):
8390
+ async def borrow_margin(self, code: str, amount, symbol: Str = None, params={}):
8384
8391
  """
8385
8392
  create a loan to borrow margin
8386
8393
  :see: https://binance-docs.github.io/apidocs/spot/en/#margin-account-borrow-margin
@@ -8411,7 +8418,7 @@ class binance(Exchange, ImplicitAPI):
8411
8418
  #
8412
8419
  return self.parse_margin_loan(response, currency)
8413
8420
 
8414
- def parse_margin_loan(self, info, currency=None):
8421
+ def parse_margin_loan(self, info, currency: Currency = None):
8415
8422
  #
8416
8423
  # {
8417
8424
  # "tranId": 108988250265,
@@ -8550,7 +8557,7 @@ class binance(Exchange, ImplicitAPI):
8550
8557
  else:
8551
8558
  return self.parse_open_interest(response, market)
8552
8559
 
8553
- def parse_open_interest(self, interest, market=None):
8560
+ def parse_open_interest(self, interest, market: Market = None):
8554
8561
  timestamp = self.safe_integer_2(interest, 'timestamp', 'time')
8555
8562
  id = self.safe_string(interest, 'symbol')
8556
8563
  amount = self.safe_number_2(interest, 'sumOpenInterest', 'openInterest')
@@ -8568,7 +8575,7 @@ class binance(Exchange, ImplicitAPI):
8568
8575
  'info': interest,
8569
8576
  }, market)
8570
8577
 
8571
- async def fetch_my_liquidations(self, symbol: String = None, since: Int = None, limit: Int = None, params={}):
8578
+ async def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
8572
8579
  """
8573
8580
  retrieves the users liquidated positions
8574
8581
  :see: https://binance-docs.github.io/apidocs/spot/en/#get-force-liquidation-record-user_data
@@ -8697,7 +8704,7 @@ class binance(Exchange, ImplicitAPI):
8697
8704
  liquidations = self.safe_value(response, 'rows', response)
8698
8705
  return self.parse_liquidations(liquidations, market, since, limit)
8699
8706
 
8700
- def parse_liquidation(self, liquidation, market=None):
8707
+ def parse_liquidation(self, liquidation, market: Market = None):
8701
8708
  #
8702
8709
  # margin
8703
8710
  #
@@ -8813,7 +8820,7 @@ class binance(Exchange, ImplicitAPI):
8813
8820
  #
8814
8821
  return self.parse_greeks(response[0], market)
8815
8822
 
8816
- def parse_greeks(self, greeks, market=None):
8823
+ def parse_greeks(self, greeks, market: Market = None):
8817
8824
  #
8818
8825
  # {
8819
8826
  # "symbol": "BTC-231229-40000-C",