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

Method fetch_ledger

python/ccxt/hyperliquid.py:4062–4100  ·  view source on GitHub ↗

fetch the history of changes, actions done by the user or operations that altered the balance of the user :param str [code]: unified currency code :param int [since]: timestamp in ms of the earliest ledger entry :param int [limit]: max number of ledger entries to ret

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

Source from the content-addressed store, hash-verified

4060 }
4061
4062 def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
4063 """
4064 fetch the history of changes, actions done by the user or operations that altered the balance of the user
4065 :param str [code]: unified currency code
4066 :param int [since]: timestamp in ms of the earliest ledger entry
4067 :param int [limit]: max number of ledger entries to return
4068 :param dict [params]: extra parameters specific to the exchange API endpoint
4069 :param int [params.until]: timestamp in ms of the latest ledger entry
4070 :param str [params.subAccountAddress]: sub account user address
4071 :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>`
4072 """
4073 self.load_markets()
4074 userAddress = None
4075 userAddress, params = self.handle_public_address('fetchLedger', params)
4076 request = {
4077 'type': 'userNonFundingLedgerUpdates',
4078 'user': userAddress,
4079 }
4080 if since is not None:
4081 request['startTime'] = since
4082 until = self.safe_integer(params, 'until')
4083 if until is not None:
4084 request['endTime'] = until
4085 params = self.omit(params, ['until'])
4086 response = self.publicPostInfo(self.extend(request, params))
4087 #
4088 # [
4089 # {
4090 # "time":1724762307531,
4091 # "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
4092 # "delta":{
4093 # "type":"accountClassTransfer",
4094 # "usdc":"50.0",
4095 # "toPerp":false
4096 # }
4097 # }
4098 # ]
4099 #
4100 return self.parse_ledger(response, None, since, limit)
4101
4102 def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
4103 #

Callers

nothing calls this directly

Calls 7

handle_public_addressMethod · 0.95
safe_integerMethod · 0.80
parse_ledgerMethod · 0.80
publicPostInfoMethod · 0.65
load_marketsMethod · 0.45
omitMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected