ccxt 4.4.3__py2.py3-none-any.whl → 4.4.5__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 (90) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binanceus.py +36 -36
  3. ccxt/async_support/__init__.py +1 -1
  4. ccxt/async_support/base/exchange.py +24 -13
  5. ccxt/async_support/base/ws/cache.py +1 -0
  6. ccxt/async_support/binance.py +43 -18
  7. ccxt/async_support/binanceus.py +1 -0
  8. ccxt/async_support/bingx.py +1 -0
  9. ccxt/async_support/bitfinex2.py +10 -9
  10. ccxt/async_support/bitget.py +55 -99
  11. ccxt/async_support/bitmex.py +14 -13
  12. ccxt/async_support/bitso.py +8 -7
  13. ccxt/async_support/bitstamp.py +12 -12
  14. ccxt/async_support/blofin.py +24 -26
  15. ccxt/async_support/bybit.py +101 -29
  16. ccxt/async_support/coinbase.py +31 -10
  17. ccxt/async_support/coinbaseexchange.py +14 -14
  18. ccxt/async_support/coinlist.py +9 -8
  19. ccxt/async_support/coinmetro.py +6 -6
  20. ccxt/async_support/cryptocom.py +10 -8
  21. ccxt/async_support/currencycom.py +9 -9
  22. ccxt/async_support/delta.py +8 -8
  23. ccxt/async_support/digifinex.py +11 -9
  24. ccxt/async_support/gate.py +9 -8
  25. ccxt/async_support/hashkey.py +12 -10
  26. ccxt/async_support/htx.py +16 -19
  27. ccxt/async_support/hyperliquid.py +70 -117
  28. ccxt/async_support/kraken.py +12 -10
  29. ccxt/async_support/kucoin.py +12 -11
  30. ccxt/async_support/luno.py +13 -12
  31. ccxt/async_support/lykke.py +2 -2
  32. ccxt/async_support/mexc.py +41 -3
  33. ccxt/async_support/ndax.py +9 -8
  34. ccxt/async_support/okcoin.py +21 -30
  35. ccxt/async_support/okx.py +21 -29
  36. ccxt/async_support/paradex.py +1 -1
  37. ccxt/async_support/woo.py +10 -9
  38. ccxt/async_support/woofipro.py +11 -9
  39. ccxt/async_support/xt.py +7 -6
  40. ccxt/async_support/zonda.py +9 -8
  41. ccxt/base/exchange.py +3 -1
  42. ccxt/binance.py +43 -18
  43. ccxt/binanceus.py +1 -0
  44. ccxt/bingx.py +1 -0
  45. ccxt/bitfinex2.py +10 -9
  46. ccxt/bitget.py +55 -99
  47. ccxt/bitmex.py +14 -13
  48. ccxt/bitso.py +8 -7
  49. ccxt/bitstamp.py +12 -12
  50. ccxt/blofin.py +24 -26
  51. ccxt/bybit.py +101 -29
  52. ccxt/coinbase.py +31 -10
  53. ccxt/coinbaseexchange.py +14 -14
  54. ccxt/coinlist.py +9 -8
  55. ccxt/coinmetro.py +6 -6
  56. ccxt/cryptocom.py +10 -8
  57. ccxt/currencycom.py +9 -9
  58. ccxt/delta.py +8 -8
  59. ccxt/digifinex.py +11 -9
  60. ccxt/gate.py +9 -8
  61. ccxt/hashkey.py +12 -10
  62. ccxt/htx.py +16 -19
  63. ccxt/hyperliquid.py +70 -117
  64. ccxt/kraken.py +12 -10
  65. ccxt/kucoin.py +12 -11
  66. ccxt/luno.py +13 -12
  67. ccxt/lykke.py +2 -2
  68. ccxt/mexc.py +40 -3
  69. ccxt/ndax.py +9 -8
  70. ccxt/okcoin.py +21 -30
  71. ccxt/okx.py +21 -29
  72. ccxt/paradex.py +1 -1
  73. ccxt/pro/__init__.py +1 -1
  74. ccxt/pro/binance.py +6 -2
  75. ccxt/pro/binanceus.py +2 -1
  76. ccxt/pro/bybit.py +51 -0
  77. ccxt/pro/hyperliquid.py +14 -1
  78. ccxt/pro/mexc.py +78 -0
  79. ccxt/pro/paradex.py +1 -0
  80. ccxt/test/tests_async.py +1 -1
  81. ccxt/test/tests_sync.py +1 -1
  82. ccxt/woo.py +10 -9
  83. ccxt/woofipro.py +11 -9
  84. ccxt/xt.py +7 -6
  85. ccxt/zonda.py +9 -8
  86. {ccxt-4.4.3.dist-info → ccxt-4.4.5.dist-info}/METADATA +5 -5
  87. {ccxt-4.4.3.dist-info → ccxt-4.4.5.dist-info}/RECORD +90 -90
  88. {ccxt-4.4.3.dist-info → ccxt-4.4.5.dist-info}/LICENSE.txt +0 -0
  89. {ccxt-4.4.3.dist-info → ccxt-4.4.5.dist-info}/WHEEL +0 -0
  90. {ccxt-4.4.3.dist-info → ccxt-4.4.5.dist-info}/top_level.txt +0 -0
ccxt/coinmetro.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinmetro import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
8
+ from ccxt.base.types import Balances, Currencies, Currency, IndexType, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -948,13 +948,13 @@ class coinmetro(Exchange, ImplicitAPI):
948
948
  result[code] = account
949
949
  return self.safe_balance(result)
950
950
 
951
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
951
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
952
952
  """
953
- fetch the history of changes, actions done by the user or operations that altered balance of the user
953
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
954
954
  :see: https://documenter.getpostman.com/view/3653795/SVfWN6KS#4e7831f7-a0e7-4c3e-9336-1d0e5dcb15cf
955
- :param str code: unified currency code, default is None
955
+ :param str [code]: unified currency code, default is None
956
956
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
957
- :param int [limit]: max number of ledger entrys to return(default 200, max 500)
957
+ :param int [limit]: max number of ledger entries to return(default 200, max 500)
958
958
  :param dict [params]: extra parameters specific to the exchange API endpoint
959
959
  :param int [params.until]: the latest time in ms to fetch entries for
960
960
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
@@ -1070,7 +1070,7 @@ class coinmetro(Exchange, ImplicitAPI):
1070
1070
  ledger.append(rawLedgerEntry)
1071
1071
  return self.parse_ledger(ledger, currency, since, limit)
1072
1072
 
1073
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
1073
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
1074
1074
  datetime = self.safe_string(item, 'timestamp')
1075
1075
  currencyId = self.safe_string(item, 'currencyId')
1076
1076
  item = self.omit(item, 'currencyId')
ccxt/cryptocom.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.cryptocom import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
9
+ from ccxt.base.types import Account, Balances, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2220,11 +2220,11 @@ class cryptocom(Exchange, ImplicitAPI):
2220
2220
  currencyMap = self.safe_list(data, 'currency_map')
2221
2221
  return self.parse_deposit_withdraw_fees(currencyMap, codes, 'full_name')
2222
2222
 
2223
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2223
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2224
2224
  """
2225
2225
  fetch the history of changes, actions done by the user or operations that altered the balance of the user
2226
2226
  :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-transactions
2227
- :param str code: unified currency code
2227
+ :param str [code]: unified currency code
2228
2228
  :param int [since]: timestamp in ms of the earliest ledger entry
2229
2229
  :param int [limit]: max number of ledger entries to return
2230
2230
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2278,7 +2278,7 @@ class cryptocom(Exchange, ImplicitAPI):
2278
2278
  ledger = self.safe_value(result, 'data', [])
2279
2279
  return self.parse_ledger(ledger, currency, since, limit)
2280
2280
 
2281
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2281
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2282
2282
  #
2283
2283
  # {
2284
2284
  # "account_id": "ce075cef-1234-4321-bd6e-gf9007351e64",
@@ -2301,6 +2301,8 @@ class cryptocom(Exchange, ImplicitAPI):
2301
2301
  #
2302
2302
  timestamp = self.safe_integer(item, 'event_timestamp_ms')
2303
2303
  currencyId = self.safe_string(item, 'instrument_name')
2304
+ code = self.safe_currency_code(currencyId, currency)
2305
+ currency = self.safe_currency(currencyId, currency)
2304
2306
  amount = self.safe_string(item, 'transaction_qty')
2305
2307
  direction = None
2306
2308
  if Precise.string_lt(amount, '0'):
@@ -2308,14 +2310,15 @@ class cryptocom(Exchange, ImplicitAPI):
2308
2310
  amount = Precise.string_abs(amount)
2309
2311
  else:
2310
2312
  direction = 'in'
2311
- return {
2313
+ return self.safe_ledger_entry({
2314
+ 'info': item,
2312
2315
  'id': self.safe_string(item, 'order_id'),
2313
2316
  'direction': direction,
2314
2317
  'account': self.safe_string(item, 'account_id'),
2315
2318
  'referenceId': self.safe_string(item, 'trade_id'),
2316
2319
  'referenceAccount': self.safe_string(item, 'trade_match_id'),
2317
2320
  'type': self.parse_ledger_entry_type(self.safe_string(item, 'journal_type')),
2318
- 'currency': self.safe_currency_code(currencyId, currency),
2321
+ 'currency': code,
2319
2322
  'amount': self.parse_number(amount),
2320
2323
  'timestamp': timestamp,
2321
2324
  'datetime': self.iso8601(timestamp),
@@ -2326,8 +2329,7 @@ class cryptocom(Exchange, ImplicitAPI):
2326
2329
  'currency': None,
2327
2330
  'cost': None,
2328
2331
  },
2329
- 'info': item,
2330
- }
2332
+ }, currency)
2331
2333
 
2332
2334
  def parse_ledger_entry_type(self, type):
2333
2335
  ledgerType: dict = {
ccxt/currencycom.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.currencycom import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Leverage, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, 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
@@ -1619,13 +1619,13 @@ class currencycom(Exchange, ImplicitAPI):
1619
1619
  }
1620
1620
  return self.safe_string(types, type, type)
1621
1621
 
1622
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1622
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
1623
1623
  """
1624
- fetch the history of changes, actions done by the user or operations that altered balance of the user
1624
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
1625
1625
  :see: https://apitradedoc.currency.com/swagger-ui.html#/rest-api/getLedgerUsingGET
1626
- :param str code: unified currency code, default is None
1626
+ :param str [code]: unified currency code, default is None
1627
1627
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
1628
- :param int [limit]: max number of ledger entrys to return, default is None
1628
+ :param int [limit]: max number of ledger entries to return, default is None
1629
1629
  :param dict [params]: extra parameters specific to the exchange API endpoint
1630
1630
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
1631
1631
  """
@@ -1668,19 +1668,20 @@ class currencycom(Exchange, ImplicitAPI):
1668
1668
  #
1669
1669
  return self.parse_ledger(response, currency, since, limit)
1670
1670
 
1671
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
1671
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
1672
1672
  id = self.safe_string(item, 'id')
1673
1673
  amountString = self.safe_string(item, 'amount')
1674
1674
  amount = Precise.string_abs(amountString)
1675
1675
  timestamp = self.safe_integer(item, 'timestamp')
1676
1676
  currencyId = self.safe_string(item, 'currency')
1677
1677
  code = self.safe_currency_code(currencyId, currency)
1678
+ currency = self.safe_currency(currencyId, currency)
1678
1679
  feeCost = self.safe_string(item, 'commission')
1679
1680
  fee = None
1680
1681
  if feeCost is not None:
1681
1682
  fee = {'currency': code, 'cost': feeCost}
1682
1683
  direction = 'out' if Precise.string_lt(amountString, '0') else 'in'
1683
- result: dict = {
1684
+ return self.safe_ledger_entry({
1684
1685
  'id': id,
1685
1686
  'timestamp': timestamp,
1686
1687
  'datetime': self.iso8601(timestamp),
@@ -1696,8 +1697,7 @@ class currencycom(Exchange, ImplicitAPI):
1696
1697
  'status': self.parse_ledger_entry_status(self.safe_string(item, 'status')),
1697
1698
  'fee': fee,
1698
1699
  'info': item,
1699
- }
1700
- return result
1700
+ }, currency)
1701
1701
 
1702
1702
  def parse_ledger_entry_status(self, status):
1703
1703
  statuses: dict = {
ccxt/delta.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.delta import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, Leverage, MarginMode, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
9
+ from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, LedgerEntry, Leverage, MarginMode, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2104,13 +2104,13 @@ class delta(Exchange, ImplicitAPI):
2104
2104
  result = self.safe_list(response, 'result', [])
2105
2105
  return self.parse_trades(result, market, since, limit)
2106
2106
 
2107
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2107
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2108
2108
  """
2109
- fetch the history of changes, actions done by the user or operations that altered balance of the user
2109
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2110
2110
  :see: https://docs.delta.exchange/#get-wallet-transactions
2111
- :param str code: unified currency code, default is None
2111
+ :param str [code]: unified currency code, default is None
2112
2112
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2113
- :param int [limit]: max number of ledger entrys to return, default is None
2113
+ :param int [limit]: max number of ledger entries to return, default is None
2114
2114
  :param dict [params]: extra parameters specific to the exchange API endpoint
2115
2115
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2116
2116
  """
@@ -2168,7 +2168,7 @@ class delta(Exchange, ImplicitAPI):
2168
2168
  }
2169
2169
  return self.safe_string(types, type, type)
2170
2170
 
2171
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2171
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2172
2172
  #
2173
2173
  # {
2174
2174
  # "amount":"29.889184",
@@ -2205,7 +2205,7 @@ class delta(Exchange, ImplicitAPI):
2205
2205
  after = self.safe_string(item, 'balance')
2206
2206
  before = Precise.string_max('0', Precise.string_sub(after, amount))
2207
2207
  status = 'ok'
2208
- return {
2208
+ return self.safe_ledger_entry({
2209
2209
  'info': item,
2210
2210
  'id': id,
2211
2211
  'direction': direction,
@@ -2221,7 +2221,7 @@ class delta(Exchange, ImplicitAPI):
2221
2221
  'timestamp': timestamp,
2222
2222
  'datetime': self.iso8601(timestamp),
2223
2223
  'fee': None,
2224
- }
2224
+ }, currency)
2225
2225
 
2226
2226
  def fetch_deposit_address(self, code: str, params={}):
2227
2227
  """
ccxt/digifinex.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.digifinex import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -2383,7 +2383,7 @@ class digifinex(Exchange, ImplicitAPI):
2383
2383
  types: dict = {}
2384
2384
  return self.safe_string(types, type, type)
2385
2385
 
2386
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2386
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2387
2387
  #
2388
2388
  # spot and margin
2389
2389
  #
@@ -2405,13 +2405,15 @@ class digifinex(Exchange, ImplicitAPI):
2405
2405
  # }
2406
2406
  #
2407
2407
  type = self.parse_ledger_entry_type(self.safe_string_2(item, 'type', 'finance_type'))
2408
- code = self.safe_currency_code(self.safe_string_2(item, 'currency_mark', 'currency'), currency)
2408
+ currencyId = self.safe_string_2(item, 'currency_mark', 'currency')
2409
+ code = self.safe_currency_code(currencyId, currency)
2410
+ currency = self.safe_currency(currencyId, currency)
2409
2411
  amount = self.safe_number_2(item, 'num', 'change')
2410
2412
  after = self.safe_number(item, 'balance')
2411
2413
  timestamp = self.safe_timestamp(item, 'time')
2412
2414
  if timestamp is None:
2413
2415
  timestamp = self.safe_integer(item, 'timestamp')
2414
- return {
2416
+ return self.safe_ledger_entry({
2415
2417
  'info': item,
2416
2418
  'id': None,
2417
2419
  'direction': None,
@@ -2427,16 +2429,16 @@ class digifinex(Exchange, ImplicitAPI):
2427
2429
  'timestamp': timestamp,
2428
2430
  'datetime': self.iso8601(timestamp),
2429
2431
  'fee': None,
2430
- }
2432
+ }, currency)
2431
2433
 
2432
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2434
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2433
2435
  """
2434
- fetch the history of changes, actions done by the user or operations that altered balance of the user
2436
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2435
2437
  :see: https://docs.digifinex.com/en-ww/spot/v3/rest.html#spot-margin-otc-financial-logs
2436
2438
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#bills
2437
- :param str code: unified currency code, default is None
2439
+ :param str [code]: unified currency code, default is None
2438
2440
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2439
- :param int [limit]: max number of ledger entrys to return, default is None
2441
+ :param int [limit]: max number of ledger entries to return, default is None
2440
2442
  :param dict [params]: extra parameters specific to the exchange API endpoint
2441
2443
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2442
2444
  """
ccxt/gate.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.gate import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currencies, Currency, FundingHistory, Greeks, Int, Leverage, Leverages, LeverageTier, LeverageTiers, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, FundingHistory, Greeks, Int, LedgerEntry, Leverage, Leverages, LeverageTier, LeverageTiers, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, 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
@@ -6138,7 +6138,7 @@ class gate(Exchange, ImplicitAPI):
6138
6138
  result.append(self.parse_settlement(settlements[i], market))
6139
6139
  return result
6140
6140
 
6141
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
6141
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
6142
6142
  """
6143
6143
  fetch the history of changes, actions done by the user or operations that altered the balance of the user
6144
6144
  :see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book
@@ -6146,12 +6146,12 @@ class gate(Exchange, ImplicitAPI):
6146
6146
  :see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
6147
6147
  :see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
6148
6148
  :see: https://www.gate.io/docs/developers/apiv4/en/#list-account-changing-history
6149
- :param str code: unified currency code
6149
+ :param str [code]: unified currency code
6150
6150
  :param int [since]: timestamp in ms of the earliest ledger entry
6151
6151
  :param int [limit]: max number of ledger entries to return
6152
6152
  :param dict [params]: extra parameters specific to the exchange API endpoint
6153
6153
  :param int [params.until]: end time in ms
6154
- :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6154
+ :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)
6155
6155
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
6156
6156
  """
6157
6157
  self.load_markets()
@@ -6242,7 +6242,7 @@ class gate(Exchange, ImplicitAPI):
6242
6242
  #
6243
6243
  return self.parse_ledger(response, currency, since, limit)
6244
6244
 
6245
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
6245
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
6246
6246
  #
6247
6247
  # spot
6248
6248
  #
@@ -6295,6 +6295,7 @@ class gate(Exchange, ImplicitAPI):
6295
6295
  else:
6296
6296
  direction = 'in'
6297
6297
  currencyId = self.safe_string(item, 'currency')
6298
+ currency = self.safe_currency(currencyId, currency)
6298
6299
  type = self.safe_string(item, 'type')
6299
6300
  rawTimestamp = self.safe_string(item, 'time')
6300
6301
  timestamp = None
@@ -6305,7 +6306,8 @@ class gate(Exchange, ImplicitAPI):
6305
6306
  balanceString = self.safe_string(item, 'balance')
6306
6307
  changeString = self.safe_string(item, 'change')
6307
6308
  before = self.parse_number(Precise.string_sub(balanceString, changeString))
6308
- return {
6309
+ return self.safe_ledger_entry({
6310
+ 'info': item,
6309
6311
  'id': self.safe_string(item, 'id'),
6310
6312
  'direction': direction,
6311
6313
  'account': None,
@@ -6320,8 +6322,7 @@ class gate(Exchange, ImplicitAPI):
6320
6322
  'after': self.safe_number(item, 'balance'),
6321
6323
  'status': None,
6322
6324
  'fee': None,
6323
- 'info': item,
6324
- }
6325
+ }, currency)
6325
6326
 
6326
6327
  def parse_ledger_entry_type(self, type):
6327
6328
  ledgerType: dict = {
ccxt/hashkey.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.hashkey import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Bool, Currencies, Currency, Int, LastPrice, LastPrices, Leverage, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Bool, Currencies, Currency, Int, LastPrice, LastPrices, LedgerEntry, Leverage, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, 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
@@ -2147,13 +2147,13 @@ class hashkey(Exchange, ImplicitAPI):
2147
2147
  }
2148
2148
  return self.safe_integer(types, type, type)
2149
2149
 
2150
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2150
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2151
2151
  """
2152
- fetch the history of changes, actions done by the user or operations that altered balance of the user
2152
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2153
2153
  :see: https://hashkeyglobal-apidoc.readme.io/reference/get-account-transaction-list
2154
- :param str code: unified currency code, default is None(not used)
2154
+ :param str [code]: unified currency code, default is None(not used)
2155
2155
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2156
- :param int [limit]: max number of ledger entrys to return, default is None
2156
+ :param int [limit]: max number of ledger entries to return, default is None
2157
2157
  :param dict [params]: extra parameters specific to the exchange API endpoint
2158
2158
  :param int [params.until]: the latest time in ms to fetch entries for
2159
2159
  :param int [params.flowType]: trade, fee, transfer, deposit, withdrawal
@@ -2213,7 +2213,7 @@ class hashkey(Exchange, ImplicitAPI):
2213
2213
  }
2214
2214
  return self.safe_string(types, type, type)
2215
2215
 
2216
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2216
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2217
2217
  #
2218
2218
  # {
2219
2219
  # "id": "1740844413612065537",
@@ -2233,7 +2233,9 @@ class hashkey(Exchange, ImplicitAPI):
2233
2233
  account = self.safe_string(item, 'accountId')
2234
2234
  timestamp = self.safe_integer(item, 'created')
2235
2235
  type = self.parse_ledger_entry_type(self.safe_string(item, 'flowTypeValue'))
2236
- code = self.safe_currency_code(self.safe_string(item, 'coin'), currency)
2236
+ currencyId = self.safe_string(item, 'coin')
2237
+ code = self.safe_currency_code(currencyId, currency)
2238
+ currency = self.safe_currency(currencyId, currency)
2237
2239
  amountString = self.safe_string(item, 'change')
2238
2240
  amount = self.parse_number(amountString)
2239
2241
  direction = 'in'
@@ -2242,9 +2244,9 @@ class hashkey(Exchange, ImplicitAPI):
2242
2244
  afterString = self.safe_string(item, 'total')
2243
2245
  after = self.parse_number(afterString)
2244
2246
  status = 'ok'
2245
- return {
2246
- 'id': id,
2247
+ return self.safe_ledger_entry({
2247
2248
  'info': item,
2249
+ 'id': id,
2248
2250
  'timestamp': timestamp,
2249
2251
  'datetime': self.iso8601(timestamp),
2250
2252
  'account': account,
@@ -2259,7 +2261,7 @@ class hashkey(Exchange, ImplicitAPI):
2259
2261
  'after': after,
2260
2262
  'status': status,
2261
2263
  'fee': None,
2262
- }
2264
+ }, currency)
2263
2265
 
2264
2266
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}) -> Order:
2265
2267
  """
ccxt/htx.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.htx import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -7392,7 +7392,7 @@ class htx(Exchange, ImplicitAPI):
7392
7392
  }
7393
7393
  return self.safe_string(types, type, type)
7394
7394
 
7395
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
7395
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
7396
7396
  #
7397
7397
  # {
7398
7398
  # "accountId": 10000001,
@@ -7406,44 +7406,41 @@ class htx(Exchange, ImplicitAPI):
7406
7406
  # "transferee": 13496526
7407
7407
  # }
7408
7408
  #
7409
- id = self.safe_string(item, 'transactId')
7410
7409
  currencyId = self.safe_string(item, 'currency')
7411
7410
  code = self.safe_currency_code(currencyId, currency)
7412
- amount = self.safe_number(item, 'transactAmt')
7411
+ currency = self.safe_currency(currencyId, currency)
7412
+ id = self.safe_string(item, 'transactId')
7413
7413
  transferType = self.safe_string(item, 'transferType')
7414
- type = self.parse_ledger_entry_type(transferType)
7415
- direction = self.safe_string(item, 'direction')
7416
7414
  timestamp = self.safe_integer(item, 'transactTime')
7417
- datetime = self.iso8601(timestamp)
7418
7415
  account = self.safe_string(item, 'accountId')
7419
- return {
7416
+ return self.safe_ledger_entry({
7417
+ 'info': item,
7420
7418
  'id': id,
7421
- 'direction': direction,
7419
+ 'direction': self.safe_string(item, 'direction'),
7422
7420
  'account': account,
7423
7421
  'referenceId': id,
7424
7422
  'referenceAccount': account,
7425
- 'type': type,
7423
+ 'type': self.parse_ledger_entry_type(transferType),
7426
7424
  'currency': code,
7427
- 'amount': amount,
7425
+ 'amount': self.safe_number(item, 'transactAmt'),
7428
7426
  'timestamp': timestamp,
7429
- 'datetime': datetime,
7427
+ 'datetime': self.iso8601(timestamp),
7430
7428
  'before': None,
7431
7429
  'after': None,
7432
7430
  'status': None,
7433
7431
  'fee': None,
7434
- 'info': item,
7435
- }
7432
+ }, currency)
7436
7433
 
7437
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
7434
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
7438
7435
  """
7436
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
7439
7437
  :see: https://huobiapi.github.io/docs/spot/v1/en/#get-account-history
7440
- fetch the history of changes, actions done by the user or operations that altered balance of the user
7441
- :param str code: unified currency code, default is None
7438
+ :param str [code]: unified currency code, default is None
7442
7439
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
7443
- :param int [limit]: max number of ledger entrys to return, default is None
7440
+ :param int [limit]: max number of ledger entries to return, default is None
7444
7441
  :param dict [params]: extra parameters specific to the exchange API endpoint
7445
7442
  :param int [params.until]: the latest time in ms to fetch entries for
7446
- :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
7443
+ :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)
7447
7444
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
7448
7445
  """
7449
7446
  self.load_markets()