MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_ledger

Method fetch_ledger

python/ccxt/extended.py:1540–1575  ·  view source on GitHub ↗

fetch the history of changes, actions done by the user or operations that altered the balance of the user https://api.docs.extended.exchange/#get-deposits-withdrawals-transfers-history :param str [code]: unified currency code :param int [since]: timestamp in ms of

(self, code: Str = None, since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

1538 }
1539
1540 def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
1541 """
1542 fetch the history of changes, actions done by the user or operations that altered the balance of the user
1543
1544 https://api.docs.extended.exchange/#get-deposits-withdrawals-transfers-history
1545
1546 :param str [code]: unified currency code
1547 :param int [since]: timestamp in ms of the earliest ledger entry
1548 :param int [limit]: max number of ledger entries to return
1549 :param dict [params]: extra parameters specific to the exchange API endpoint
1550 :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)
1551 :returns dict[]: a list of `ledger structures <https://docs.ccxt.com/?id=ledger>`
1552 """
1553 self.load_markets()
1554 paginate = False
1555 paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate')
1556 if paginate:
1557 return self.fetch_paginated_call_cursor('fetchLedger', code, since, limit, params, 'cursor', 'cursor', None, 50)
1558 currency = None
1559 if code is not None:
1560 currency = self.currency(code)
1561 request = {}
1562 if limit is not None:
1563 request['limit'] = limit
1564 response = self.v1PrivateGetUserAssetOperations(self.extend(request, params))
1565 data = self.safe_list(response, 'data', [])
1566 pagination = self.safe_dict(response, 'pagination', {})
1567 cursor = self.safe_string(pagination, 'cursor')
1568 result = []
1569 dataLength = len(data)
1570 for i in range(0, dataLength):
1571 entry = data[i]
1572 if (cursor is not None) and (i == dataLength - 1):
1573 entry = self.extend(entry, {'cursor': cursor})
1574 result.append(entry)
1575 return self.parse_ledger(result, currency, since, limit)
1576
1577 def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
1578 #

Callers

nothing calls this directly

Calls 12

load_marketsMethod · 0.95
safe_listMethod · 0.80
safe_dictMethod · 0.80
safe_stringMethod · 0.80
parse_ledgerMethod · 0.80
rangeFunction · 0.50
currencyMethod · 0.45
extendMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected