fetch_vault_fills
Documentation for eth_defi.hyperliquid.position.fetch_vault_fills function.
- fetch_vault_fills(session, vault_address, start_time=None, end_time=None, server_url='https://api.hyperliquid.xyz', timeout=30.0, aggregate_by_time=False)
Fetch all fills for a vault with automatic pagination.
Fetches trade fills from the Hyperliquid API using the
userFillsByTimeendpoint with automatic pagination to handle API limits.The fills are yielded in chronological order (oldest first) for position reconstruction.
Note: This function collects all fills before yielding to ensure chronological ordering. For memory-constrained scenarios with very large fill histories, consider using
fetch_vault_fills_iterator()which yields fills in API order (not chronological).Example:
from datetime import datetime, timedelta from eth_defi.hyperliquid.session import create_hyperliquid_session from eth_defi.hyperliquid.position import fetch_vault_fills session = create_hyperliquid_session() vault = "0x3df9769bbbb335340872f01d8157c779d73c6ed0" # Fetch last 7 days of fills fills = list( fetch_vault_fills( session, vault, start_time=datetime.now() - timedelta(days=7), ) ) print(f"Fetched {len(fills)} fills")- Parameters
session (requests.sessions.Session) – HTTP session with retry logic from
create_hyperliquid_session()vault_address (eth_typing.evm.HexAddress) – Vault address to fetch fills for
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.
server_url (str) – Hyperliquid API URL
timeout (float) – HTTP request timeout in seconds
aggregate_by_time (bool) – When True, partial fills from the same crossing order are combined
- Returns
Iterator of fills sorted by timestamp ascending (oldest first)
- Raises
requests.HTTPError – If the HTTP request fails after retries
- Return type