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
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.bybit import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, LeverageTier, LeverageTiers, 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, CrossBorrowRate, Currencies, Currency, Greeks, Int, LedgerEntry, Leverage, LeverageTier, LeverageTiers, 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
@@ -115,7 +115,7 @@ class bybit(Exchange, ImplicitAPI):
115
115
  'fetchOpenOrders': True,
116
116
  'fetchOption': True,
117
117
  'fetchOptionChain': True,
118
- 'fetchOrder': False,
118
+ 'fetchOrder': True,
119
119
  'fetchOrderBook': True,
120
120
  'fetchOrders': False,
121
121
  'fetchOrderTrades': True,
@@ -4527,13 +4527,84 @@ class bybit(Exchange, ImplicitAPI):
4527
4527
  :param str id: the order id
4528
4528
  :param str symbol: unified symbol of the market the order was made in
4529
4529
  :param dict [params]: extra parameters specific to the exchange API endpoint
4530
+ :param dict [params.acknowledged]: to suppress the warning, set to True
4530
4531
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
4531
4532
  """
4532
- res = await self.is_unified_enabled()
4533
- enableUnifiedAccount = self.safe_bool(res, 1)
4534
- if enableUnifiedAccount:
4535
- raise NotSupported(self.id + ' fetchOrder() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrder or fetchClosedOrder')
4536
- return await self.fetch_order_classic(id, symbol, params)
4533
+ await self.load_markets()
4534
+ enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
4535
+ isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
4536
+ if not isUnifiedAccount:
4537
+ return await self.fetch_order_classic(id, symbol, params)
4538
+ acknowledge = False
4539
+ acknowledge, params = self.handle_option_and_params(params, 'fetchOrder', 'acknowledged')
4540
+ if not acknowledge:
4541
+ raise ArgumentsRequired(self.id + ' fetchOrder() can only access an order if it is in last 500 orders(of any status) for your account. Set params["acknowledged"] = True to hide self warning. Alternatively, we suggest to use fetchOpenOrder or fetchClosedOrder')
4542
+ market = self.market(symbol)
4543
+ marketType = None
4544
+ marketType, params = self.get_bybit_type('fetchOrder', market, params)
4545
+ request: dict = {
4546
+ 'symbol': market['id'],
4547
+ 'orderId': id,
4548
+ 'category': marketType,
4549
+ }
4550
+ isTrigger = None
4551
+ isTrigger, params = self.handle_param_bool_2(params, 'trigger', 'stop', False)
4552
+ if isTrigger:
4553
+ request['orderFilter'] = 'StopOrder'
4554
+ response = await self.privateGetV5OrderRealtime(self.extend(request, params))
4555
+ #
4556
+ # {
4557
+ # "retCode": 0,
4558
+ # "retMsg": "OK",
4559
+ # "result": {
4560
+ # "nextPageCursor": "1321052653536515584%3A1672217748287%2C1321052653536515584%3A1672217748287",
4561
+ # "category": "spot",
4562
+ # "list": [
4563
+ # {
4564
+ # "symbol": "ETHUSDT",
4565
+ # "orderType": "Limit",
4566
+ # "orderLinkId": "1672217748277652",
4567
+ # "orderId": "1321052653536515584",
4568
+ # "cancelType": "UNKNOWN",
4569
+ # "avgPrice": "",
4570
+ # "stopOrderType": "tpslOrder",
4571
+ # "lastPriceOnCreated": "",
4572
+ # "orderStatus": "Cancelled",
4573
+ # "takeProfit": "",
4574
+ # "cumExecValue": "0",
4575
+ # "triggerDirection": 0,
4576
+ # "isLeverage": "0",
4577
+ # "rejectReason": "",
4578
+ # "price": "1000",
4579
+ # "orderIv": "",
4580
+ # "createdTime": "1672217748287",
4581
+ # "tpTriggerBy": "",
4582
+ # "positionIdx": 0,
4583
+ # "timeInForce": "GTC",
4584
+ # "leavesValue": "500",
4585
+ # "updatedTime": "1672217748287",
4586
+ # "side": "Buy",
4587
+ # "triggerPrice": "1500",
4588
+ # "cumExecFee": "0",
4589
+ # "leavesQty": "0",
4590
+ # "slTriggerBy": "",
4591
+ # "closeOnTrigger": False,
4592
+ # "cumExecQty": "0",
4593
+ # "reduceOnly": False,
4594
+ # "qty": "0.5",
4595
+ # "stopLoss": "",
4596
+ # "triggerBy": "1192.5"
4597
+ # }
4598
+ # ]
4599
+ # },
4600
+ # "retExtInfo": {},
4601
+ # "time": 1672219526294
4602
+ # }
4603
+ #
4604
+ result = self.safe_dict(response, 'result', {})
4605
+ innerList = self.safe_list(result, 'list', [])
4606
+ order = self.safe_dict(innerList, 0, {})
4607
+ return self.parse_order(order, market)
4537
4608
 
4538
4609
  async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
4539
4610
  res = await self.is_unified_enabled()
@@ -5497,15 +5568,15 @@ class bybit(Exchange, ImplicitAPI):
5497
5568
  'comment': None,
5498
5569
  }
5499
5570
 
5500
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
5571
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
5501
5572
  """
5502
- fetch the history of changes, actions done by the user or operations that altered balance of the user
5573
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
5503
5574
  :see: https://bybit-exchange.github.io/docs/v5/account/transaction-log
5504
5575
  :see: https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log
5505
- :param str code: unified currency code, default is None
5576
+ :param str [code]: unified currency code, default is None
5506
5577
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
5507
- :param int [limit]: max number of ledger entrys to return, default is None
5508
- :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)
5578
+ :param int [limit]: max number of ledger entries to return, default is None
5579
+ :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)
5509
5580
  :param str [params.subType]: if inverse will use v5/account/contract-transaction-log
5510
5581
  :param dict [params]: extra parameters specific to the exchange API endpoint
5511
5582
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
@@ -5665,7 +5736,7 @@ class bybit(Exchange, ImplicitAPI):
5665
5736
  data = self.add_pagination_cursor_to_result(response)
5666
5737
  return self.parse_ledger(data, currency, since, limit)
5667
5738
 
5668
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
5739
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
5669
5740
  #
5670
5741
  # {
5671
5742
  # "id": 234467,
@@ -5704,6 +5775,7 @@ class bybit(Exchange, ImplicitAPI):
5704
5775
  #
5705
5776
  currencyId = self.safe_string_2(item, 'coin', 'currency')
5706
5777
  code = self.safe_currency_code(currencyId, currency)
5778
+ currency = self.safe_currency(currencyId, currency)
5707
5779
  amount = self.safe_string_2(item, 'amount', 'change')
5708
5780
  after = self.safe_string_2(item, 'wallet_balance', 'cashBalance')
5709
5781
  direction = 'out' if Precise.string_lt(amount, '0') else 'in'
@@ -5714,26 +5786,26 @@ class bybit(Exchange, ImplicitAPI):
5714
5786
  timestamp = self.parse8601(self.safe_string(item, 'exec_time'))
5715
5787
  if timestamp is None:
5716
5788
  timestamp = self.safe_integer(item, 'transactionTime')
5717
- type = self.parse_ledger_entry_type(self.safe_string(item, 'type'))
5718
- id = self.safe_string(item, 'id')
5719
- referenceId = self.safe_string(item, 'tx_id')
5720
- return {
5721
- 'id': id,
5722
- 'currency': code,
5789
+ return self.safe_ledger_entry({
5790
+ 'info': item,
5791
+ 'id': self.safe_string(item, 'id'),
5792
+ 'direction': direction,
5723
5793
  'account': self.safe_string(item, 'wallet_id'),
5794
+ 'referenceId': self.safe_string(item, 'tx_id'),
5724
5795
  'referenceAccount': None,
5725
- 'referenceId': referenceId,
5726
- 'status': None,
5727
- 'amount': self.parse_number(Precise.string_abs(amount)),
5728
- 'before': self.parse_number(before),
5729
- 'after': self.parse_number(after),
5730
- 'fee': self.parse_number(self.safe_string(item, 'fee')),
5731
- 'direction': direction,
5796
+ 'type': self.parse_ledger_entry_type(self.safe_string(item, 'type')),
5797
+ 'currency': code,
5798
+ 'amount': self.parse_to_numeric(Precise.string_abs(amount)),
5732
5799
  'timestamp': timestamp,
5733
5800
  'datetime': self.iso8601(timestamp),
5734
- 'type': type,
5735
- 'info': item,
5736
- }
5801
+ 'before': self.parse_to_numeric(before),
5802
+ 'after': self.parse_to_numeric(after),
5803
+ 'status': 'ok',
5804
+ 'fee': {
5805
+ 'currency': code,
5806
+ 'cost': self.parse_to_numeric(self.safe_string(item, 'fee')),
5807
+ },
5808
+ }, currency)
5737
5809
 
5738
5810
  def parse_ledger_entry_type(self, type):
5739
5811
  types: dict = {
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbase import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
10
+ from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, LedgerEntry, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -2171,15 +2171,15 @@ class coinbase(Exchange, ImplicitAPI):
2171
2171
  params['type'] = marketType
2172
2172
  return self.parse_custom_balance(response, params)
2173
2173
 
2174
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2174
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2175
2175
  """
2176
- fetch the history of changes, actions done by the user or operations that altered balance of the user
2176
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2177
2177
  :see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#list-transactions
2178
- :param str code: unified currency code, default is None
2178
+ :param str [code]: unified currency code, default is None
2179
2179
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
2180
- :param int [limit]: max number of ledger entrys to return, default is None
2180
+ :param int [limit]: max number of ledger entries to return, default is None
2181
2181
  :param dict [params]: extra parameters specific to the exchange API endpoint
2182
- :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)
2182
+ :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)
2183
2183
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2184
2184
  """
2185
2185
  await self.load_markets()
@@ -2205,8 +2205,28 @@ class coinbase(Exchange, ImplicitAPI):
2205
2205
  pagination = self.safe_dict(response, 'pagination', {})
2206
2206
  cursor = self.safe_string(pagination, 'next_starting_after')
2207
2207
  if (cursor is not None) and (cursor != ''):
2208
+ lastFee = self.safe_dict(last, 'fee')
2208
2209
  last['next_starting_after'] = cursor
2209
- ledger[lastIndex] = last
2210
+ ledger[lastIndex] = {
2211
+ 'info': self.safe_dict(last, 'info'),
2212
+ 'id': self.safe_string(last, 'id'),
2213
+ 'timestamp': self.safe_integer(last, 'timestamp'),
2214
+ 'datetime': self.safe_string(last, 'datetime'),
2215
+ 'direction': self.safe_string(last, 'direction'),
2216
+ 'account': self.safe_string(last, 'account'),
2217
+ 'referenceId': None,
2218
+ 'referenceAccount': None,
2219
+ 'type': self.safe_string(last, 'type'),
2220
+ 'currency': self.safe_string(last, 'currency'),
2221
+ 'amount': self.safe_number(last, 'amount'),
2222
+ 'before': None,
2223
+ 'after': None,
2224
+ 'status': self.safe_string(last, 'status'),
2225
+ 'fee': {
2226
+ 'cost': self.safe_number(lastFee, 'cost'),
2227
+ 'currency': self.safe_string(lastFee, 'currency'),
2228
+ },
2229
+ }
2210
2230
  return ledger
2211
2231
 
2212
2232
  def parse_ledger_entry_status(self, status):
@@ -2229,7 +2249,7 @@ class coinbase(Exchange, ImplicitAPI):
2229
2249
  }
2230
2250
  return self.safe_string(types, type, type)
2231
2251
 
2232
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2252
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2233
2253
  #
2234
2254
  # crypto deposit transaction
2235
2255
  #
@@ -2483,6 +2503,7 @@ class coinbase(Exchange, ImplicitAPI):
2483
2503
  direction = 'in'
2484
2504
  currencyId = self.safe_string(amountInfo, 'currency')
2485
2505
  code = self.safe_currency_code(currencyId, currency)
2506
+ currency = self.safe_currency(currencyId, currency)
2486
2507
  #
2487
2508
  # the address and txid do not belong to the unified ledger structure
2488
2509
  #
@@ -2515,7 +2536,7 @@ class coinbase(Exchange, ImplicitAPI):
2515
2536
  numParts = len(parts)
2516
2537
  if numParts > 3:
2517
2538
  accountId = parts[3]
2518
- return {
2539
+ return self.safe_ledger_entry({
2519
2540
  'info': item,
2520
2541
  'id': id,
2521
2542
  'timestamp': timestamp,
@@ -2531,7 +2552,7 @@ class coinbase(Exchange, ImplicitAPI):
2531
2552
  'after': None,
2532
2553
  'status': status,
2533
2554
  'fee': fee,
2534
- }
2555
+ }, currency)
2535
2556
 
2536
2557
  async def find_account_id(self, code, params={}):
2537
2558
  await self.load_markets()
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbaseexchange import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currencies, Currency, Int, 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, 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
@@ -1326,7 +1326,7 @@ class coinbaseexchange(Exchange, ImplicitAPI):
1326
1326
  }
1327
1327
  return self.safe_string(types, type, type)
1328
1328
 
1329
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
1329
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
1330
1330
  # {
1331
1331
  # "id": "12087495079",
1332
1332
  # "amount": "-0.0100000000000000",
@@ -1378,31 +1378,31 @@ class coinbaseexchange(Exchange, ImplicitAPI):
1378
1378
  else:
1379
1379
  referenceId = self.safe_string(details, 'order_id')
1380
1380
  status = 'ok'
1381
- return {
1381
+ return self.safe_ledger_entry({
1382
+ 'info': item,
1382
1383
  'id': id,
1383
- 'currency': code,
1384
+ 'timestamp': timestamp,
1385
+ 'datetime': self.iso8601(timestamp),
1386
+ 'direction': direction,
1384
1387
  'account': account,
1385
1388
  'referenceAccount': referenceAccount,
1386
1389
  'referenceId': referenceId,
1387
- 'status': status,
1390
+ 'type': type,
1391
+ 'currency': code,
1388
1392
  'amount': amount,
1389
1393
  'before': before,
1390
1394
  'after': after,
1395
+ 'status': status,
1391
1396
  'fee': None,
1392
- 'direction': direction,
1393
- 'timestamp': timestamp,
1394
- 'datetime': self.iso8601(timestamp),
1395
- 'type': type,
1396
- 'info': item,
1397
- }
1397
+ }, currency)
1398
1398
 
1399
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1399
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
1400
1400
  """
1401
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
1401
1402
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
1402
- fetch the history of changes, actions done by the user or operations that altered balance of the user
1403
1403
  :param str code: unified currency code, default is None
1404
1404
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
1405
- :param int [limit]: max number of ledger entrys to return, default is None
1405
+ :param int [limit]: max number of ledger entries to return, default is None
1406
1406
  :param dict [params]: extra parameters specific to the exchange API endpoint
1407
1407
  :param int [params.until]: the latest time in ms to fetch trades for
1408
1408
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.coinlist import ImplicitAPI
8
8
  import hashlib
9
9
  import math
10
- from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, 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
@@ -1980,13 +1980,13 @@ class coinlist(Exchange, ImplicitAPI):
1980
1980
  }
1981
1981
  return self.safe_string(types, type, type)
1982
1982
 
1983
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1983
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
1984
1984
  """
1985
- fetch the history of changes, actions done by the user or operations that altered balance of the user
1985
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
1986
1986
  :see: https://trade-docs.coinlist.co/?javascript--nodejs#get-account-history
1987
- :param str code: unified currency code, default is None
1987
+ :param str [code]: unified currency code, default is None
1988
1988
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
1989
- :param int [limit]: max number of ledger entrys to return(default 200, max 500)
1989
+ :param int [limit]: max number of ledger entries to return(default 200, max 500)
1990
1990
  :param dict [params]: extra parameters specific to the exchange API endpoint
1991
1991
  :param int [params.until]: the latest time in ms to fetch entries for
1992
1992
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
@@ -2079,7 +2079,7 @@ class coinlist(Exchange, ImplicitAPI):
2079
2079
  ledger = self.safe_value(response, 'transactions', [])
2080
2080
  return self.parse_ledger(ledger, currency, since, limit)
2081
2081
 
2082
- def parse_ledger_entry(self, item: dict, currency: Currency = None):
2082
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2083
2083
  #
2084
2084
  # deposit transaction from wallet(funding) to pro(trading)
2085
2085
  # {
@@ -2163,8 +2163,9 @@ class coinlist(Exchange, ImplicitAPI):
2163
2163
  direction = 'in'
2164
2164
  currencyId = self.safe_string(item, 'asset')
2165
2165
  code = self.safe_currency_code(currencyId, currency)
2166
+ currency = self.safe_currency(currencyId, currency)
2166
2167
  type = self.parse_ledger_entry_type(self.safe_string(item, 'type'))
2167
- return {
2168
+ return self.safe_ledger_entry({
2168
2169
  'info': item,
2169
2170
  'id': id,
2170
2171
  'timestamp': timestamp,
@@ -2180,7 +2181,7 @@ class coinlist(Exchange, ImplicitAPI):
2180
2181
  'after': None,
2181
2182
  'status': 'ok',
2182
2183
  'fee': None,
2183
- }
2184
+ }, currency)
2184
2185
 
2185
2186
  def parse_ledger_entry_type(self, type):
2186
2187
  types: dict = {
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.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
- async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
951
+ async 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')
@@ -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
@@ -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
- 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]:
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 = {
@@ -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
  """