ccxt 4.4.2__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 (87) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bitmart.py +1 -0
  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 +50 -25
  7. ccxt/async_support/bingx.py +1 -0
  8. ccxt/async_support/bitfinex2.py +10 -9
  9. ccxt/async_support/bitget.py +13 -9
  10. ccxt/async_support/bitmart.py +3 -1
  11. ccxt/async_support/bitmex.py +14 -13
  12. ccxt/async_support/bitso.py +8 -7
  13. ccxt/async_support/bitstamp.py +36 -48
  14. ccxt/async_support/blofin.py +24 -26
  15. ccxt/async_support/bybit.py +26 -23
  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 +12 -9
  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/mexc.py +49 -2
  32. ccxt/async_support/ndax.py +9 -8
  33. ccxt/async_support/okcoin.py +21 -30
  34. ccxt/async_support/okx.py +21 -29
  35. ccxt/async_support/woo.py +10 -9
  36. ccxt/async_support/woofipro.py +11 -9
  37. ccxt/async_support/xt.py +12 -7
  38. ccxt/async_support/zonda.py +9 -8
  39. ccxt/base/exchange.py +3 -1
  40. ccxt/binance.py +50 -25
  41. ccxt/bingx.py +1 -0
  42. ccxt/bitfinex2.py +10 -9
  43. ccxt/bitget.py +13 -9
  44. ccxt/bitmart.py +3 -1
  45. ccxt/bitmex.py +14 -13
  46. ccxt/bitso.py +8 -7
  47. ccxt/bitstamp.py +36 -48
  48. ccxt/blofin.py +24 -26
  49. ccxt/bybit.py +26 -23
  50. ccxt/coinbase.py +31 -10
  51. ccxt/coinbaseexchange.py +14 -14
  52. ccxt/coinlist.py +9 -8
  53. ccxt/coinmetro.py +6 -6
  54. ccxt/cryptocom.py +12 -9
  55. ccxt/currencycom.py +9 -9
  56. ccxt/delta.py +8 -8
  57. ccxt/digifinex.py +11 -9
  58. ccxt/gate.py +9 -8
  59. ccxt/hashkey.py +12 -10
  60. ccxt/htx.py +16 -19
  61. ccxt/hyperliquid.py +70 -117
  62. ccxt/kraken.py +12 -10
  63. ccxt/kucoin.py +12 -11
  64. ccxt/luno.py +13 -12
  65. ccxt/mexc.py +48 -2
  66. ccxt/ndax.py +9 -8
  67. ccxt/okcoin.py +21 -30
  68. ccxt/okx.py +21 -29
  69. ccxt/pro/__init__.py +1 -1
  70. ccxt/pro/bybit.py +51 -0
  71. ccxt/pro/cryptocom.py +181 -22
  72. ccxt/pro/mexc.py +154 -4
  73. ccxt/pro/okx.py +5 -3
  74. ccxt/pro/oxfun.py +70 -0
  75. ccxt/pro/phemex.py +41 -2
  76. ccxt/pro/woofipro.py +64 -0
  77. ccxt/test/tests_async.py +1 -1
  78. ccxt/test/tests_sync.py +1 -1
  79. ccxt/woo.py +10 -9
  80. ccxt/woofipro.py +11 -9
  81. ccxt/xt.py +12 -7
  82. ccxt/zonda.py +9 -8
  83. {ccxt-4.4.2.dist-info → ccxt-4.4.4.dist-info}/METADATA +5 -5
  84. {ccxt-4.4.2.dist-info → ccxt-4.4.4.dist-info}/RECORD +87 -87
  85. {ccxt-4.4.2.dist-info → ccxt-4.4.4.dist-info}/LICENSE.txt +0 -0
  86. {ccxt-4.4.2.dist-info → ccxt-4.4.4.dist-info}/WHEEL +0 -0
  87. {ccxt-4.4.2.dist-info → ccxt-4.4.4.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.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
@@ -611,7 +611,7 @@ class cryptocom(Exchange, ImplicitAPI):
611
611
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
612
612
  """
613
613
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
614
- :see: https://exchange-docs.crypto.com/spot/index.html#public-get-ticker
614
+ :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers
615
615
  :see: https://exchange-docs.crypto.com/derivatives/index.html#public-get-tickers
616
616
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
617
617
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1660,6 +1660,7 @@ class cryptocom(Exchange, ImplicitAPI):
1660
1660
  async def fetch_deposit_address(self, code: str, params={}):
1661
1661
  """
1662
1662
  fetch the deposit address for a currency associated with self account
1663
+ :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address
1663
1664
  :param str code: unified currency code
1664
1665
  :param dict [params]: extra parameters specific to the exchange API endpoint
1665
1666
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
@@ -2219,11 +2220,11 @@ class cryptocom(Exchange, ImplicitAPI):
2219
2220
  currencyMap = self.safe_list(data, 'currency_map')
2220
2221
  return self.parse_deposit_withdraw_fees(currencyMap, codes, 'full_name')
2221
2222
 
2222
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2223
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2223
2224
  """
2224
2225
  fetch the history of changes, actions done by the user or operations that altered the balance of the user
2225
2226
  :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-transactions
2226
- :param str code: unified currency code
2227
+ :param str [code]: unified currency code
2227
2228
  :param int [since]: timestamp in ms of the earliest ledger entry
2228
2229
  :param int [limit]: max number of ledger entries to return
2229
2230
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2277,7 +2278,7 @@ class cryptocom(Exchange, ImplicitAPI):
2277
2278
  ledger = self.safe_value(result, 'data', [])
2278
2279
  return self.parse_ledger(ledger, currency, since, limit)
2279
2280
 
2280
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2281
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2281
2282
  #
2282
2283
  # {
2283
2284
  # "account_id": "ce075cef-1234-4321-bd6e-gf9007351e64",
@@ -2300,6 +2301,8 @@ class cryptocom(Exchange, ImplicitAPI):
2300
2301
  #
2301
2302
  timestamp = self.safe_integer(item, 'event_timestamp_ms')
2302
2303
  currencyId = self.safe_string(item, 'instrument_name')
2304
+ code = self.safe_currency_code(currencyId, currency)
2305
+ currency = self.safe_currency(currencyId, currency)
2303
2306
  amount = self.safe_string(item, 'transaction_qty')
2304
2307
  direction = None
2305
2308
  if Precise.string_lt(amount, '0'):
@@ -2307,14 +2310,15 @@ class cryptocom(Exchange, ImplicitAPI):
2307
2310
  amount = Precise.string_abs(amount)
2308
2311
  else:
2309
2312
  direction = 'in'
2310
- return {
2313
+ return self.safe_ledger_entry({
2314
+ 'info': item,
2311
2315
  'id': self.safe_string(item, 'order_id'),
2312
2316
  'direction': direction,
2313
2317
  'account': self.safe_string(item, 'account_id'),
2314
2318
  'referenceId': self.safe_string(item, 'trade_id'),
2315
2319
  'referenceAccount': self.safe_string(item, 'trade_match_id'),
2316
2320
  'type': self.parse_ledger_entry_type(self.safe_string(item, 'journal_type')),
2317
- 'currency': self.safe_currency_code(currencyId, currency),
2321
+ 'currency': code,
2318
2322
  'amount': self.parse_number(amount),
2319
2323
  'timestamp': timestamp,
2320
2324
  'datetime': self.iso8601(timestamp),
@@ -2325,8 +2329,7 @@ class cryptocom(Exchange, ImplicitAPI):
2325
2329
  'currency': None,
2326
2330
  'cost': None,
2327
2331
  },
2328
- 'info': item,
2329
- }
2332
+ }, currency)
2330
2333
 
2331
2334
  def parse_ledger_entry_type(self, type):
2332
2335
  ledgerType: dict = {
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.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
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1622
+ async 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 = {
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.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
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2107
+ async 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
  async def fetch_deposit_address(self, code: str, params={}):
2227
2227
  """
@@ -8,7 +8,7 @@ from ccxt.abstract.digifinex import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- 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
11
+ 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
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import AuthenticationError
@@ -2384,7 +2384,7 @@ class digifinex(Exchange, ImplicitAPI):
2384
2384
  types: dict = {}
2385
2385
  return self.safe_string(types, type, type)
2386
2386
 
2387
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2387
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2388
2388
  #
2389
2389
  # spot and margin
2390
2390
  #
@@ -2406,13 +2406,15 @@ class digifinex(Exchange, ImplicitAPI):
2406
2406
  # }
2407
2407
  #
2408
2408
  type = self.parse_ledger_entry_type(self.safe_string_2(item, 'type', 'finance_type'))
2409
- code = self.safe_currency_code(self.safe_string_2(item, 'currency_mark', 'currency'), currency)
2409
+ currencyId = self.safe_string_2(item, 'currency_mark', 'currency')
2410
+ code = self.safe_currency_code(currencyId, currency)
2411
+ currency = self.safe_currency(currencyId, currency)
2410
2412
  amount = self.safe_number_2(item, 'num', 'change')
2411
2413
  after = self.safe_number(item, 'balance')
2412
2414
  timestamp = self.safe_timestamp(item, 'time')
2413
2415
  if timestamp is None:
2414
2416
  timestamp = self.safe_integer(item, 'timestamp')
2415
- return {
2417
+ return self.safe_ledger_entry({
2416
2418
  'info': item,
2417
2419
  'id': None,
2418
2420
  'direction': None,
@@ -2428,16 +2430,16 @@ class digifinex(Exchange, ImplicitAPI):
2428
2430
  'timestamp': timestamp,
2429
2431
  'datetime': self.iso8601(timestamp),
2430
2432
  'fee': None,
2431
- }
2433
+ }, currency)
2432
2434
 
2433
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2435
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2434
2436
  """
2435
- fetch the history of changes, actions done by the user or operations that altered balance of the user
2437
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2436
2438
  :see: https://docs.digifinex.com/en-ww/spot/v3/rest.html#spot-margin-otc-financial-logs
2437
2439
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#bills
2438
- :param str code: unified currency code, default is None
2440
+ :param str [code]: unified currency code, default is None
2439
2441
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2440
- :param int [limit]: max number of ledger entrys to return, default is None
2442
+ :param int [limit]: max number of ledger entries to return, default is None
2441
2443
  :param dict [params]: extra parameters specific to the exchange API endpoint
2442
2444
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2443
2445
  """
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.gate import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- 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
10
+ 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
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -6139,7 +6139,7 @@ class gate(Exchange, ImplicitAPI):
6139
6139
  result.append(self.parse_settlement(settlements[i], market))
6140
6140
  return result
6141
6141
 
6142
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
6142
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
6143
6143
  """
6144
6144
  fetch the history of changes, actions done by the user or operations that altered the balance of the user
6145
6145
  :see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book
@@ -6147,12 +6147,12 @@ class gate(Exchange, ImplicitAPI):
6147
6147
  :see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
6148
6148
  :see: https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
6149
6149
  :see: https://www.gate.io/docs/developers/apiv4/en/#list-account-changing-history
6150
- :param str code: unified currency code
6150
+ :param str [code]: unified currency code
6151
6151
  :param int [since]: timestamp in ms of the earliest ledger entry
6152
6152
  :param int [limit]: max number of ledger entries to return
6153
6153
  :param dict [params]: extra parameters specific to the exchange API endpoint
6154
6154
  :param int [params.until]: end time in ms
6155
- :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)
6155
+ :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)
6156
6156
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
6157
6157
  """
6158
6158
  await self.load_markets()
@@ -6243,7 +6243,7 @@ class gate(Exchange, ImplicitAPI):
6243
6243
  #
6244
6244
  return self.parse_ledger(response, currency, since, limit)
6245
6245
 
6246
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
6246
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
6247
6247
  #
6248
6248
  # spot
6249
6249
  #
@@ -6296,6 +6296,7 @@ class gate(Exchange, ImplicitAPI):
6296
6296
  else:
6297
6297
  direction = 'in'
6298
6298
  currencyId = self.safe_string(item, 'currency')
6299
+ currency = self.safe_currency(currencyId, currency)
6299
6300
  type = self.safe_string(item, 'type')
6300
6301
  rawTimestamp = self.safe_string(item, 'time')
6301
6302
  timestamp = None
@@ -6306,7 +6307,8 @@ class gate(Exchange, ImplicitAPI):
6306
6307
  balanceString = self.safe_string(item, 'balance')
6307
6308
  changeString = self.safe_string(item, 'change')
6308
6309
  before = self.parse_number(Precise.string_sub(balanceString, changeString))
6309
- return {
6310
+ return self.safe_ledger_entry({
6311
+ 'info': item,
6310
6312
  'id': self.safe_string(item, 'id'),
6311
6313
  'direction': direction,
6312
6314
  'account': None,
@@ -6321,8 +6323,7 @@ class gate(Exchange, ImplicitAPI):
6321
6323
  'after': self.safe_number(item, 'balance'),
6322
6324
  'status': None,
6323
6325
  'fee': None,
6324
- 'info': item,
6325
- }
6326
+ }, currency)
6326
6327
 
6327
6328
  def parse_ledger_entry_type(self, type):
6328
6329
  ledgerType: dict = {
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.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
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2150
+ async 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
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}) -> Order:
2265
2267
  """
ccxt/async_support/htx.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.htx import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- 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
10
+ 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
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -7393,7 +7393,7 @@ class htx(Exchange, ImplicitAPI):
7393
7393
  }
7394
7394
  return self.safe_string(types, type, type)
7395
7395
 
7396
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
7396
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
7397
7397
  #
7398
7398
  # {
7399
7399
  # "accountId": 10000001,
@@ -7407,44 +7407,41 @@ class htx(Exchange, ImplicitAPI):
7407
7407
  # "transferee": 13496526
7408
7408
  # }
7409
7409
  #
7410
- id = self.safe_string(item, 'transactId')
7411
7410
  currencyId = self.safe_string(item, 'currency')
7412
7411
  code = self.safe_currency_code(currencyId, currency)
7413
- amount = self.safe_number(item, 'transactAmt')
7412
+ currency = self.safe_currency(currencyId, currency)
7413
+ id = self.safe_string(item, 'transactId')
7414
7414
  transferType = self.safe_string(item, 'transferType')
7415
- type = self.parse_ledger_entry_type(transferType)
7416
- direction = self.safe_string(item, 'direction')
7417
7415
  timestamp = self.safe_integer(item, 'transactTime')
7418
- datetime = self.iso8601(timestamp)
7419
7416
  account = self.safe_string(item, 'accountId')
7420
- return {
7417
+ return self.safe_ledger_entry({
7418
+ 'info': item,
7421
7419
  'id': id,
7422
- 'direction': direction,
7420
+ 'direction': self.safe_string(item, 'direction'),
7423
7421
  'account': account,
7424
7422
  'referenceId': id,
7425
7423
  'referenceAccount': account,
7426
- 'type': type,
7424
+ 'type': self.parse_ledger_entry_type(transferType),
7427
7425
  'currency': code,
7428
- 'amount': amount,
7426
+ 'amount': self.safe_number(item, 'transactAmt'),
7429
7427
  'timestamp': timestamp,
7430
- 'datetime': datetime,
7428
+ 'datetime': self.iso8601(timestamp),
7431
7429
  'before': None,
7432
7430
  'after': None,
7433
7431
  'status': None,
7434
7432
  'fee': None,
7435
- 'info': item,
7436
- }
7433
+ }, currency)
7437
7434
 
7438
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
7435
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
7439
7436
  """
7437
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
7440
7438
  :see: https://huobiapi.github.io/docs/spot/v1/en/#get-account-history
7441
- fetch the history of changes, actions done by the user or operations that altered balance of the user
7442
- :param str code: unified currency code, default is None
7439
+ :param str [code]: unified currency code, default is None
7443
7440
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
7444
- :param int [limit]: max number of ledger entrys to return, default is None
7441
+ :param int [limit]: max number of ledger entries to return, default is None
7445
7442
  :param dict [params]: extra parameters specific to the exchange API endpoint
7446
7443
  :param int [params.until]: the latest time in ms to fetch entries for
7447
- :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)
7444
+ :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)
7448
7445
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
7449
7446
  """
7450
7447
  await self.load_markets()