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={})
| 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 | # |
nothing calls this directly
no test coverage detected