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

Method fetch_ledger

python/ccxt/pacifica.py:2605–2650  ·  view source on GitHub ↗

fetch the history of changes, actions done by the user or operations that altered the balance of the user https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-account-balance-history :param str [code]: unified currency code :param int [since]: timest

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

Source from the content-addressed store, hash-verified

2603 }, market)
2604
2605 def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
2606 """
2607 fetch the history of changes, actions done by the user or operations that altered the balance of the user
2608
2609 https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-account-balance-history
2610
2611 :param str [code]: unified currency code
2612 :param int [since]: timestamp in ms of the earliest ledger entry
2613 :param int [limit]: max number of ledger entries to return
2614 :param dict [params]: extra parameters specific to the exchange API endpoint
2615 :param str [params.account]: will default to walletAddress if not provided
2616 :param str [params.cursor]: pagination cursor from prev request(manual use)
2617 :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)
2618 :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>`
2619 """
2620 self.load_markets()
2621 paginate = False
2622 paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate', False)
2623 userAddress = None
2624 userAddress, params = self.handle_origin_and_single_address('fetchLedger', params)
2625 defaultLimit = 100 # Default max limit
2626 if paginate:
2627 return self.fetch_paginated_call_cursor('fetchLedger', code, since, limit, params, 'next_cursor', 'cursor', None, defaultLimit)
2628 request = {
2629 'account': userAddress,
2630 }
2631 if limit is not None:
2632 request['limit'] = limit
2633 response = self.publicGetAccountBalanceHistory(self.extend(request, params))
2634 # {
2635 # "success": True,
2636 # "data": [
2637 # {
2638 # "amount": "100.000000",
2639 # "balance": "1200.000000",
2640 # "pending_balance": "0.000000",
2641 # "event_type": "deposit",
2642 # "created_at": 1716200000000
2643 # }
2644 # ...
2645 # ],
2646 # "next_cursor": "11114Lz77",
2647 # "has_more": True
2648 # }
2649 data = self.add_pagination_cursor_to_result(response)
2650 return self.parse_ledger(data, None, since, limit)
2651
2652 def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
2653 #

Callers

nothing calls this directly

Calls 8

parse_ledgerMethod · 0.80
load_marketsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected