ccxt 4.4.3__py2.py3-none-any.whl → 4.4.4__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.
Files changed (79) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/async_support/__init__.py +1 -1
  3. ccxt/async_support/base/exchange.py +24 -13
  4. ccxt/async_support/base/ws/cache.py +1 -0
  5. ccxt/async_support/binance.py +40 -15
  6. ccxt/async_support/bingx.py +1 -0
  7. ccxt/async_support/bitfinex2.py +10 -9
  8. ccxt/async_support/bitget.py +13 -9
  9. ccxt/async_support/bitmex.py +14 -13
  10. ccxt/async_support/bitso.py +8 -7
  11. ccxt/async_support/bitstamp.py +12 -12
  12. ccxt/async_support/blofin.py +24 -26
  13. ccxt/async_support/bybit.py +24 -23
  14. ccxt/async_support/coinbase.py +31 -10
  15. ccxt/async_support/coinbaseexchange.py +14 -14
  16. ccxt/async_support/coinlist.py +9 -8
  17. ccxt/async_support/coinmetro.py +6 -6
  18. ccxt/async_support/cryptocom.py +10 -8
  19. ccxt/async_support/currencycom.py +9 -9
  20. ccxt/async_support/delta.py +8 -8
  21. ccxt/async_support/digifinex.py +11 -9
  22. ccxt/async_support/gate.py +9 -8
  23. ccxt/async_support/hashkey.py +12 -10
  24. ccxt/async_support/htx.py +16 -19
  25. ccxt/async_support/hyperliquid.py +70 -117
  26. ccxt/async_support/kraken.py +12 -10
  27. ccxt/async_support/kucoin.py +12 -11
  28. ccxt/async_support/luno.py +13 -12
  29. ccxt/async_support/mexc.py +34 -2
  30. ccxt/async_support/ndax.py +9 -8
  31. ccxt/async_support/okcoin.py +21 -30
  32. ccxt/async_support/okx.py +21 -29
  33. ccxt/async_support/woo.py +10 -9
  34. ccxt/async_support/woofipro.py +11 -9
  35. ccxt/async_support/xt.py +7 -6
  36. ccxt/async_support/zonda.py +9 -8
  37. ccxt/base/exchange.py +3 -1
  38. ccxt/binance.py +40 -15
  39. ccxt/bingx.py +1 -0
  40. ccxt/bitfinex2.py +10 -9
  41. ccxt/bitget.py +13 -9
  42. ccxt/bitmex.py +14 -13
  43. ccxt/bitso.py +8 -7
  44. ccxt/bitstamp.py +12 -12
  45. ccxt/blofin.py +24 -26
  46. ccxt/bybit.py +24 -23
  47. ccxt/coinbase.py +31 -10
  48. ccxt/coinbaseexchange.py +14 -14
  49. ccxt/coinlist.py +9 -8
  50. ccxt/coinmetro.py +6 -6
  51. ccxt/cryptocom.py +10 -8
  52. ccxt/currencycom.py +9 -9
  53. ccxt/delta.py +8 -8
  54. ccxt/digifinex.py +11 -9
  55. ccxt/gate.py +9 -8
  56. ccxt/hashkey.py +12 -10
  57. ccxt/htx.py +16 -19
  58. ccxt/hyperliquid.py +70 -117
  59. ccxt/kraken.py +12 -10
  60. ccxt/kucoin.py +12 -11
  61. ccxt/luno.py +13 -12
  62. ccxt/mexc.py +33 -2
  63. ccxt/ndax.py +9 -8
  64. ccxt/okcoin.py +21 -30
  65. ccxt/okx.py +21 -29
  66. ccxt/pro/__init__.py +1 -1
  67. ccxt/pro/bybit.py +51 -0
  68. ccxt/pro/mexc.py +78 -0
  69. ccxt/test/tests_async.py +1 -1
  70. ccxt/test/tests_sync.py +1 -1
  71. ccxt/woo.py +10 -9
  72. ccxt/woofipro.py +11 -9
  73. ccxt/xt.py +7 -6
  74. ccxt/zonda.py +9 -8
  75. {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/METADATA +5 -5
  76. {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/RECORD +79 -79
  77. {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/LICENSE.txt +0 -0
  78. {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/WHEEL +0 -0
  79. {ccxt-4.4.3.dist-info → ccxt-4.4.4.dist-info}/top_level.txt +0 -0
ccxt/async_support/woo.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.woo import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Bool, Conversion, Currencies, Currency, Int, Leverage, MarginModification, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Bool, Conversion, Currencies, Currency, Int, LedgerEntry, Leverage, MarginModification, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from typing import Any
12
12
  from ccxt.base.errors import ExchangeError
@@ -1991,29 +1991,31 @@ class woo(Exchange, ImplicitAPI):
1991
1991
  # }
1992
1992
  return [currency, self.safe_list(response, 'rows', [])]
1993
1993
 
1994
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1994
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
1995
1995
  """
1996
1996
  fetch the history of changes, actions done by the user or operations that altered balance of the user
1997
1997
  :see: https://docs.woo.org/#get-asset-history
1998
- :param str code: unified currency code, default is None
1998
+ :param str [code]: unified currency code, default is None
1999
1999
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2000
- :param int [limit]: max number of ledger entrys to return, default is None
2000
+ :param int [limit]: max number of ledger entries to return, default is None
2001
2001
  :param dict [params]: extra parameters specific to the exchange API endpoint
2002
2002
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2003
2003
  """
2004
2004
  currency, rows = await self.get_asset_history_rows(code, since, limit, params)
2005
2005
  return self.parse_ledger(rows, currency, since, limit, params)
2006
2006
 
2007
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2007
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2008
2008
  networkizedCode = self.safe_string(item, 'token')
2009
2009
  currencyDefined = self.get_currency_from_chaincode(networkizedCode, currency)
2010
2010
  code = currencyDefined['code']
2011
+ currency = self.safe_currency(code, currency)
2011
2012
  amount = self.safe_number(item, 'amount')
2012
2013
  side = self.safe_string(item, 'token_side')
2013
2014
  direction = 'in' if (side == 'DEPOSIT') else 'out'
2014
2015
  timestamp = self.safe_timestamp(item, 'created_time')
2015
2016
  fee = self.parse_token_and_fee_temp(item, 'fee_token', 'fee_amount')
2016
- return {
2017
+ return self.safe_ledger_entry({
2018
+ 'info': item,
2017
2019
  'id': self.safe_string(item, 'id'),
2018
2020
  'currency': code,
2019
2021
  'account': self.safe_string(item, 'account'),
@@ -2023,13 +2025,12 @@ class woo(Exchange, ImplicitAPI):
2023
2025
  'amount': amount,
2024
2026
  'before': None,
2025
2027
  'after': None,
2026
- 'fee': fee,
2027
2028
  'direction': direction,
2028
2029
  'timestamp': timestamp,
2029
2030
  'datetime': self.iso8601(timestamp),
2030
2031
  'type': self.parse_ledger_entry_type(self.safe_string(item, 'type')),
2031
- 'info': item,
2032
- }
2032
+ 'fee': fee,
2033
+ }, currency)
2033
2034
 
2034
2035
  def parse_ledger_entry_type(self, type):
2035
2036
  types: dict = {
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.woofipro import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction
8
+ from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction
9
9
  from typing import List
10
10
  from typing import Any
11
11
  from ccxt.base.errors import ExchangeError
@@ -1987,14 +1987,16 @@ class woofipro(Exchange, ImplicitAPI):
1987
1987
  data = self.safe_dict(response, 'data', {})
1988
1988
  return [currency, self.safe_list(data, 'rows', [])]
1989
1989
 
1990
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
1991
- code = self.safe_string(item, 'token')
1990
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
1991
+ currencyId = self.safe_string(item, 'token')
1992
+ code = self.safe_currency_code(currencyId, currency)
1993
+ currency = self.safe_currency(currencyId, currency)
1992
1994
  amount = self.safe_number(item, 'amount')
1993
1995
  side = self.safe_string(item, 'token_side')
1994
1996
  direction = 'in' if (side == 'DEPOSIT') else 'out'
1995
1997
  timestamp = self.safe_integer(item, 'created_time')
1996
1998
  fee = self.parse_token_and_fee_temp(item, 'fee_token', 'fee_amount')
1997
- return {
1999
+ return self.safe_ledger_entry({
1998
2000
  'id': self.safe_string(item, 'id'),
1999
2001
  'currency': code,
2000
2002
  'account': self.safe_string(item, 'account'),
@@ -2010,7 +2012,7 @@ class woofipro(Exchange, ImplicitAPI):
2010
2012
  'datetime': self.iso8601(timestamp),
2011
2013
  'type': self.parse_ledger_entry_type(self.safe_string(item, 'type')),
2012
2014
  'info': item,
2013
- }
2015
+ }, currency)
2014
2016
 
2015
2017
  def parse_ledger_entry_type(self, type):
2016
2018
  types: dict = {
@@ -2019,13 +2021,13 @@ class woofipro(Exchange, ImplicitAPI):
2019
2021
  }
2020
2022
  return self.safe_string(types, type, type)
2021
2023
 
2022
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2024
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2023
2025
  """
2024
- fetch the history of changes, actions done by the user or operations that altered balance of the user
2026
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2025
2027
  :see: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
2026
- :param str code: unified currency code, default is None
2028
+ :param str [code]: unified currency code, default is None
2027
2029
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2028
- :param int [limit]: max number of ledger entrys to return, default is None
2030
+ :param int [limit]: max number of ledger entries to return, default is None
2029
2031
  :param dict [params]: extra parameters specific to the exchange API endpoint
2030
2032
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2031
2033
  """
ccxt/async_support/xt.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.xt import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Currencies, Currency, Int, LeverageTier, MarginModification, Market, Num, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry
10
+ from ccxt.base.types import Currencies, Currency, Int, LedgerEntry, LeverageTier, MarginModification, Market, Num, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -3311,7 +3311,7 @@ class xt(Exchange, ImplicitAPI):
3311
3311
  }
3312
3312
  return self.safe_string(statuses, status, status)
3313
3313
 
3314
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
3314
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
3315
3315
  """
3316
3316
  fetch the history of changes, actions done by the user or operations that altered the balance of the user
3317
3317
  :see: https://doc.xt.com/#futures_usergetBalanceBill
@@ -3368,7 +3368,7 @@ class xt(Exchange, ImplicitAPI):
3368
3368
  ledger = self.safe_value(data, 'items', [])
3369
3369
  return self.parse_ledger(ledger, currency, since, limit)
3370
3370
 
3371
- def parse_ledger_entry(self, item, currency=None):
3371
+ def parse_ledger_entry(self, item, currency=None) -> LedgerEntry:
3372
3372
  #
3373
3373
  # {
3374
3374
  # "id": "207260567109387524",
@@ -3384,8 +3384,10 @@ class xt(Exchange, ImplicitAPI):
3384
3384
  side = self.safe_string(item, 'side')
3385
3385
  direction = 'in' if (side == 'ADD') else 'out'
3386
3386
  currencyId = self.safe_string(item, 'coin')
3387
+ currency = self.safe_currency(currencyId, currency)
3387
3388
  timestamp = self.safe_integer(item, 'createdTime')
3388
- return {
3389
+ return self.safe_ledger_entry({
3390
+ 'info': item,
3389
3391
  'id': self.safe_string(item, 'id'),
3390
3392
  'direction': direction,
3391
3393
  'account': None,
@@ -3403,8 +3405,7 @@ class xt(Exchange, ImplicitAPI):
3403
3405
  'currency': None,
3404
3406
  'cost': None,
3405
3407
  },
3406
- 'info': item,
3407
- }
3408
+ }, currency)
3408
3409
 
3409
3410
  def parse_ledger_entry_type(self, type):
3410
3411
  ledgerType = {
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.zonda import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -804,13 +804,13 @@ class zonda(Exchange, ImplicitAPI):
804
804
  items = self.safe_dict(response, 'items')
805
805
  return self.parse_tickers(items, symbols)
806
806
 
807
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
807
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
808
808
  """
809
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
809
810
  :see: https://docs.zondacrypto.exchange/reference/operations-history
810
- fetch the history of changes, actions done by the user or operations that altered balance of the user
811
- :param str code: unified currency code, default is None
811
+ :param str [code]: unified currency code, default is None
812
812
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
813
- :param int [limit]: max number of ledger entrys to return, default is None
813
+ :param int [limit]: max number of ledger entries to return, default is None
814
814
  :param dict [params]: extra parameters specific to the exchange API endpoint
815
815
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
816
816
  """
@@ -830,7 +830,7 @@ class zonda(Exchange, ImplicitAPI):
830
830
  items = response['items']
831
831
  return self.parse_ledger(items, None, since, limit)
832
832
 
833
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
833
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
834
834
  #
835
835
  # FUNDS_MIGRATION
836
836
  # {
@@ -1101,6 +1101,7 @@ class zonda(Exchange, ImplicitAPI):
1101
1101
  timestamp = self.safe_integer(item, 'time')
1102
1102
  balance = self.safe_value(item, 'balance', {})
1103
1103
  currencyId = self.safe_string(balance, 'currency')
1104
+ currency = self.safe_currency(currencyId, currency)
1104
1105
  change = self.safe_value(item, 'change', {})
1105
1106
  amount = self.safe_string(change, 'total')
1106
1107
  direction = 'in'
@@ -1111,7 +1112,7 @@ class zonda(Exchange, ImplicitAPI):
1111
1112
  # that can be used to enrich the transfers with txid, address etc(you need to use info.detailId parameter)
1112
1113
  fundsBefore = self.safe_value(item, 'fundsBefore', {})
1113
1114
  fundsAfter = self.safe_value(item, 'fundsAfter', {})
1114
- return {
1115
+ return self.safe_ledger_entry({
1115
1116
  'info': item,
1116
1117
  'id': self.safe_string(item, 'historyId'),
1117
1118
  'direction': direction,
@@ -1127,7 +1128,7 @@ class zonda(Exchange, ImplicitAPI):
1127
1128
  'timestamp': timestamp,
1128
1129
  'datetime': self.iso8601(timestamp),
1129
1130
  'fee': None,
1130
- }
1131
+ }, currency)
1131
1132
 
1132
1133
  def parse_ledger_entry_type(self, type):
1133
1134
  types: dict = {
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.3'
7
+ __version__ = '4.4.4'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -140,6 +140,8 @@ class Exchange(object):
140
140
  aiohttp_trust_env = False
141
141
  requests_trust_env = False
142
142
  session = None # Session () by default
143
+ tcp_connector = None # aiohttp.TCPConnector
144
+ aiohttp_socks_connector = None
143
145
  socks_proxy_sessions = None
144
146
  verify = True # SSL verification
145
147
  validateServerSsl = True
ccxt/binance.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.binance import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, IsolatedBorrowRate, IsolatedBorrowRates, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, Greeks, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -10361,19 +10361,42 @@ class binance(Exchange, ImplicitAPI):
10361
10361
  result.append(self.parse_settlement(settlements[i], market))
10362
10362
  return result
10363
10363
 
10364
- def fetch_ledger_entry(self, id: str, code: Str = None, params={}):
10364
+ def fetch_ledger_entry(self, id: str, code: Str = None, params={}) -> LedgerEntry:
10365
+ """
10366
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
10367
+ :see: https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow
10368
+ :param str id: the identification number of the ledger entry
10369
+ :param str code: unified currency code
10370
+ :param dict [params]: extra parameters specific to the exchange API endpoint
10371
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
10372
+ """
10365
10373
  self.load_markets()
10366
10374
  type = None
10367
10375
  type, params = self.handle_market_type_and_params('fetchLedgerEntry', None, params)
10368
- query: dict = {
10369
- 'recordId': id,
10370
- 'type': type,
10371
- }
10372
10376
  if type != 'option':
10373
10377
  raise BadRequest(self.id + ' fetchLedgerEntry() can only be used for type option')
10374
- return self.fetch_ledger(code, None, None, self.extend(query, params))
10378
+ self.check_required_argument('fetchLedgerEntry', code, 'code')
10379
+ currency = self.currency(code)
10380
+ request: dict = {
10381
+ 'recordId': id,
10382
+ 'currency': currency['id'],
10383
+ }
10384
+ response = self.eapiPrivateGetBill(self.extend(request, params))
10385
+ #
10386
+ # [
10387
+ # {
10388
+ # "id": "1125899906845701870",
10389
+ # "asset": "USDT",
10390
+ # "amount": "-0.16518203",
10391
+ # "type": "FEE",
10392
+ # "createDate": 1676621042489
10393
+ # }
10394
+ # ]
10395
+ #
10396
+ first = self.safe_dict(response, 0, response)
10397
+ return self.parse_ledger_entry(first, currency)
10375
10398
 
10376
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
10399
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
10377
10400
  """
10378
10401
  fetch the history of changes, actions done by the user or operations that altered the balance of the user
10379
10402
  :see: https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow
@@ -10381,9 +10404,9 @@ class binance(Exchange, ImplicitAPI):
10381
10404
  :see: https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Get-Income-History
10382
10405
  :see: https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Income-History
10383
10406
  :see: https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Income-History
10384
- :param str code: unified currency code
10407
+ :param str [code]: unified currency code
10385
10408
  :param int [since]: timestamp in ms of the earliest ledger entry
10386
- :param int [limit]: max number of ledger entrys to return
10409
+ :param int [limit]: max number of ledger entries to return
10387
10410
  :param dict [params]: extra parameters specific to the exchange API endpoint
10388
10411
  :param int [params.until]: timestamp in ms of the latest ledger entry
10389
10412
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
@@ -10461,7 +10484,7 @@ class binance(Exchange, ImplicitAPI):
10461
10484
  #
10462
10485
  return self.parse_ledger(response, currency, since, limit)
10463
10486
 
10464
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
10487
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
10465
10488
  #
10466
10489
  # options(eapi)
10467
10490
  #
@@ -10494,16 +10517,19 @@ class binance(Exchange, ImplicitAPI):
10494
10517
  else:
10495
10518
  direction = 'in'
10496
10519
  currencyId = self.safe_string(item, 'asset')
10520
+ code = self.safe_currency_code(currencyId, currency)
10521
+ currency = self.safe_currency(currencyId, currency)
10497
10522
  timestamp = self.safe_integer_2(item, 'createDate', 'time')
10498
10523
  type = self.safe_string_2(item, 'type', 'incomeType')
10499
- return {
10524
+ return self.safe_ledger_entry({
10525
+ 'info': item,
10500
10526
  'id': self.safe_string_2(item, 'id', 'tranId'),
10501
10527
  'direction': direction,
10502
10528
  'account': None,
10503
10529
  'referenceAccount': None,
10504
10530
  'referenceId': self.safe_string(item, 'tradeId'),
10505
10531
  'type': self.parse_ledger_entry_type(type),
10506
- 'currency': self.safe_currency_code(currencyId, currency),
10532
+ 'currency': code,
10507
10533
  'amount': self.parse_number(amount),
10508
10534
  'timestamp': timestamp,
10509
10535
  'datetime': self.iso8601(timestamp),
@@ -10511,8 +10537,7 @@ class binance(Exchange, ImplicitAPI):
10511
10537
  'after': None,
10512
10538
  'status': None,
10513
10539
  'fee': None,
10514
- 'info': item,
10515
- }
10540
+ }, currency)
10516
10541
 
10517
10542
  def parse_ledger_entry_type(self, type):
10518
10543
  ledgerType: dict = {
ccxt/bingx.py CHANGED
@@ -480,6 +480,7 @@ class bingx(Exchange, ImplicitAPI):
480
480
  'commonCurrencies': {
481
481
  'SNOW': 'Snowman', # Snowman vs SnowSwap conflict
482
482
  'OMNI': 'OmniCat',
483
+ 'NAP': '$NAP', # NAP on SOL = SNAP
483
484
  },
484
485
  'options': {
485
486
  'defaultType': 'spot',
ccxt/bitfinex2.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitfinex2 import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2729,7 +2729,7 @@ class bitfinex2(Exchange, ImplicitAPI):
2729
2729
  else:
2730
2730
  return type
2731
2731
 
2732
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2732
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2733
2733
  #
2734
2734
  # [
2735
2735
  # [
@@ -2750,6 +2750,7 @@ class bitfinex2(Exchange, ImplicitAPI):
2750
2750
  id = self.safe_string(itemList, 0)
2751
2751
  currencyId = self.safe_string(itemList, 1)
2752
2752
  code = self.safe_currency_code(currencyId, currency)
2753
+ currency = self.safe_currency(currencyId, currency)
2753
2754
  timestamp = self.safe_integer(itemList, 3)
2754
2755
  amount = self.safe_number(itemList, 5)
2755
2756
  after = self.safe_number(itemList, 6)
@@ -2758,7 +2759,8 @@ class bitfinex2(Exchange, ImplicitAPI):
2758
2759
  parts = description.split(' @ ')
2759
2760
  first = self.safe_string_lower(parts, 0)
2760
2761
  type = self.parse_ledger_entry_type(first)
2761
- return {
2762
+ return self.safe_ledger_entry({
2763
+ 'info': item,
2762
2764
  'id': id,
2763
2765
  'direction': None,
2764
2766
  'account': None,
@@ -2773,16 +2775,15 @@ class bitfinex2(Exchange, ImplicitAPI):
2773
2775
  'after': after,
2774
2776
  'status': None,
2775
2777
  'fee': None,
2776
- 'info': item,
2777
- }
2778
+ }, currency)
2778
2779
 
2779
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2780
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2780
2781
  """
2781
- fetch the history of changes, actions done by the user or operations that altered balance of the user
2782
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2782
2783
  :see: https://docs.bitfinex.com/reference/rest-auth-ledgers
2783
- :param str code: unified currency code, default is None
2784
+ :param str [code]: unified currency code, default is None
2784
2785
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2785
- :param int [limit]: max number of ledger entrys to return, default is None max is 2500
2786
+ :param int [limit]: max number of ledger entries to return, default is None, max is 2500
2786
2787
  :param dict [params]: extra parameters specific to the exchange API endpoint
2787
2788
  :param int [params.until]: timestamp in ms of the latest ledger entry
2788
2789
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
ccxt/bitget.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitget import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, FundingHistory, Int, IsolatedBorrowRate, Leverage, LeverageTier, Liquidation, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Conversion, CrossBorrowRate, Currencies, Currency, FundingHistory, Int, IsolatedBorrowRate, LedgerEntry, Leverage, LeverageTier, Liquidation, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -5492,14 +5492,14 @@ class bitget(Exchange, ImplicitAPI):
5492
5492
  orders = self.safe_list(response, 'data', [])
5493
5493
  return self.parse_orders(orders, market, since, limit)
5494
5494
 
5495
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
5495
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
5496
5496
  """
5497
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
5497
5498
  :see: https://www.bitget.com/api-doc/spot/account/Get-Account-Bills
5498
5499
  :see: https://www.bitget.com/api-doc/contract/account/Get-Account-Bill
5499
- fetch the history of changes, actions done by the user or operations that altered balance of the user
5500
- :param str code: unified currency code, default is None
5500
+ :param str [code]: unified currency code, default is None
5501
5501
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
5502
- :param int [limit]: max number of ledger entrys to return, default is None
5502
+ :param int [limit]: max number of ledger entries to return, default is None
5503
5503
  :param dict [params]: extra parameters specific to the exchange API endpoint
5504
5504
  :param int [params.until]: end time in ms
5505
5505
  :param str [params.symbol]: *contract only* unified market symbol
@@ -5597,7 +5597,7 @@ class bitget(Exchange, ImplicitAPI):
5597
5597
  return self.parse_ledger(bills, currency, since, limit)
5598
5598
  return self.parse_ledger(data, currency, since, limit)
5599
5599
 
5600
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
5600
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
5601
5601
  #
5602
5602
  # spot
5603
5603
  #
@@ -5627,6 +5627,7 @@ class bitget(Exchange, ImplicitAPI):
5627
5627
  #
5628
5628
  currencyId = self.safe_string(item, 'coin')
5629
5629
  code = self.safe_currency_code(currencyId, currency)
5630
+ currency = self.safe_currency(currencyId, currency)
5630
5631
  timestamp = self.safe_integer(item, 'cTime')
5631
5632
  after = self.safe_number(item, 'balance')
5632
5633
  fee = self.safe_number_2(item, 'fees', 'fee')
@@ -5635,7 +5636,7 @@ class bitget(Exchange, ImplicitAPI):
5635
5636
  direction = 'in'
5636
5637
  if amountRaw.find('-') >= 0:
5637
5638
  direction = 'out'
5638
- return {
5639
+ return self.safe_ledger_entry({
5639
5640
  'info': item,
5640
5641
  'id': self.safe_string(item, 'billId'),
5641
5642
  'timestamp': timestamp,
@@ -5650,8 +5651,11 @@ class bitget(Exchange, ImplicitAPI):
5650
5651
  'before': None,
5651
5652
  'after': after,
5652
5653
  'status': None,
5653
- 'fee': fee,
5654
- }
5654
+ 'fee': {
5655
+ 'currency': code,
5656
+ 'cost': fee,
5657
+ },
5658
+ }, currency)
5655
5659
 
5656
5660
  def parse_ledger_type(self, type):
5657
5661
  types: dict = {
ccxt/bitmex.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitmex import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, Leverages, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Leverages, Market, MarketType, Num, Order, 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 AuthenticationError
@@ -1050,7 +1050,7 @@ class bitmex(Exchange, ImplicitAPI):
1050
1050
  }
1051
1051
  return self.safe_string(types, type, type)
1052
1052
 
1053
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
1053
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
1054
1054
  #
1055
1055
  # {
1056
1056
  # "transactID": "69573da3-7744-5467-3207-89fd6efe7a47",
@@ -1099,6 +1099,7 @@ class bitmex(Exchange, ImplicitAPI):
1099
1099
  type = self.parse_ledger_entry_type(self.safe_string(item, 'transactType'))
1100
1100
  currencyId = self.safe_string(item, 'currency')
1101
1101
  code = self.safe_currency_code(currencyId, currency)
1102
+ currency = self.safe_currency(currencyId, currency)
1102
1103
  amountString = self.safe_string(item, 'amount')
1103
1104
  amount = self.convert_to_real_amount(code, amountString)
1104
1105
  timestamp = self.parse8601(self.safe_string(item, 'transactTime'))
@@ -1111,13 +1112,13 @@ class bitmex(Exchange, ImplicitAPI):
1111
1112
  if feeCost is not None:
1112
1113
  feeCost = self.convert_to_real_amount(code, feeCost)
1113
1114
  fee = {
1114
- 'cost': self.parse_number(feeCost),
1115
+ 'cost': self.parse_to_numeric(feeCost),
1115
1116
  'currency': code,
1116
1117
  }
1117
1118
  after = self.safe_string(item, 'walletBalance')
1118
1119
  if after is not None:
1119
1120
  after = self.convert_to_real_amount(code, after)
1120
- before = self.parse_number(Precise.string_sub(self.number_to_string(after), self.number_to_string(amount)))
1121
+ before = self.parse_to_numeric(Precise.string_sub(self.number_to_string(after), self.number_to_string(amount)))
1121
1122
  direction = None
1122
1123
  if Precise.string_lt(amountString, '0'):
1123
1124
  direction = 'out'
@@ -1125,9 +1126,9 @@ class bitmex(Exchange, ImplicitAPI):
1125
1126
  else:
1126
1127
  direction = 'in'
1127
1128
  status = self.parse_transaction_status(self.safe_string(item, 'transactStatus'))
1128
- return {
1129
- 'id': id,
1129
+ return self.safe_ledger_entry({
1130
1130
  'info': item,
1131
+ 'id': id,
1131
1132
  'timestamp': timestamp,
1132
1133
  'datetime': self.iso8601(timestamp),
1133
1134
  'direction': direction,
@@ -1136,20 +1137,20 @@ class bitmex(Exchange, ImplicitAPI):
1136
1137
  'referenceAccount': referenceAccount,
1137
1138
  'type': type,
1138
1139
  'currency': code,
1139
- 'amount': amount,
1140
+ 'amount': self.parse_to_numeric(amount),
1140
1141
  'before': before,
1141
- 'after': self.parse_number(after),
1142
+ 'after': self.parse_to_numeric(after),
1142
1143
  'status': status,
1143
1144
  'fee': fee,
1144
- }
1145
+ }, currency)
1145
1146
 
1146
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1147
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
1147
1148
  """
1148
- fetch the history of changes, actions done by the user or operations that altered balance of the user
1149
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
1149
1150
  :see: https://www.bitmex.com/api/explorer/#not /User/User_getWalletHistory
1150
- :param str code: unified currency code, default is None
1151
+ :param str [code]: unified currency code, default is None
1151
1152
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
1152
- :param int [limit]: max number of ledger entrys to return, default is None
1153
+ :param int [limit]: max number of ledger entries to return, default is None
1153
1154
  :param dict [params]: extra parameters specific to the exchange API endpoint
1154
1155
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
1155
1156
  """
ccxt/bitso.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitso import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, TradingFees, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -195,12 +195,12 @@ class bitso(Exchange, ImplicitAPI):
195
195
  },
196
196
  })
197
197
 
198
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
198
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
199
199
  """
200
- fetch the history of changes, actions done by the user or operations that altered balance of the user
201
- :param str code: unified currency code, default is None
200
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
201
+ :param str [code]: unified currency code, default is None
202
202
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
203
- :param int [limit]: max number of ledger entrys to return, default is None
203
+ :param int [limit]: max number of ledger entries to return, default is None
204
204
  :param dict [params]: extra parameters specific to the exchange API endpoint
205
205
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
206
206
  """
@@ -244,7 +244,7 @@ class bitso(Exchange, ImplicitAPI):
244
244
  }
245
245
  return self.safe_string(types, type, type)
246
246
 
247
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
247
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
248
248
  #
249
249
  # {
250
250
  # "eid": "2510b3e2bc1c87f584500a18084f35ed",
@@ -308,6 +308,7 @@ class bitso(Exchange, ImplicitAPI):
308
308
  amount = self.safe_string(firstBalance, 'amount')
309
309
  currencyId = self.safe_string(firstBalance, 'currency')
310
310
  code = self.safe_currency_code(currencyId, currency)
311
+ currency = self.safe_currency(currencyId, currency)
311
312
  details = self.safe_value(item, 'details', {})
312
313
  referenceId = self.safe_string_2(details, 'fid', 'wid')
313
314
  if referenceId is None:
@@ -327,6 +328,7 @@ class bitso(Exchange, ImplicitAPI):
327
328
  }
328
329
  timestamp = self.parse8601(self.safe_string(item, 'created_at'))
329
330
  return self.safe_ledger_entry({
331
+ 'info': item,
330
332
  'id': self.safe_string(item, 'eid'),
331
333
  'direction': direction,
332
334
  'account': None,
@@ -341,7 +343,6 @@ class bitso(Exchange, ImplicitAPI):
341
343
  'after': None,
342
344
  'status': 'ok',
343
345
  'fee': fee,
344
- 'info': item,
345
346
  }, currency)
346
347
 
347
348
  def fetch_markets(self, params={}) -> List[Market]: