fetch_account_funding
Documentation for eth_defi.hyperliquid.trade_history.fetch_account_funding function.
- fetch_account_funding(session, address, start_time=None, end_time=None, timeout=30.0)
Fetch all funding payments for an account with automatic pagination.
Fetches funding payment history from the Hyperliquid API using the
userFundingendpoint with automatic forward pagination.Payments are yielded in chronological order (oldest first).
Example:
from datetime import datetime, timedelta from eth_defi.hyperliquid.session import create_hyperliquid_session from eth_defi.hyperliquid.trade_history import fetch_account_funding session = create_hyperliquid_session() address = "0x1e37a337ed460039d1b15bd3bc489de789768d5e" payments = list( fetch_account_funding( session, address, start_time=datetime.now() - timedelta(days=7), ) ) print(f"Fetched {len(payments)} funding payments")- Parameters
session (eth_defi.hyperliquid.session.HyperliquidSession) – Session from
create_hyperliquid_session().address (eth_typing.evm.HexAddress) – Account address (vault or user).
start_time (datetime.datetime | None) – Start of time range (inclusive). Defaults to 30 days ago.
end_time (datetime.datetime | None) – End of time range (inclusive). Defaults to current time.
timeout (float) – HTTP request timeout in seconds.
- Returns
Iterator of funding payments sorted by timestamp ascending (oldest first).
- Raises
requests.HTTPError – If the HTTP request fails after retries.
- Return type