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, 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 userFillsByTime endpoint 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
Returns

Iterator of fills sorted by timestamp ascending (oldest first)

Raises

requests.HTTPError – If the HTTP request fails after retries

Return type

Iterator[eth_defi.hyperliquid.position.Fill]