compute_event_share_prices

Documentation for eth_defi.hyperliquid.trade_history.compute_event_share_prices function.

compute_event_share_prices(fills, funding_payments, ledger_events, initial_total_assets=0.0)

Compute an event-driven indicative share-price series from available events.

Unlike the portfolio-history-derived share prices (which suffer from resolution artefacts — see README-hyperliquid-vault-limitations.md), this function uses actual event data:

  • Deposits: Exact amounts from userNonFundingLedgerUpdates

  • Withdrawals: Exact amounts from userNonFundingLedgerUpdates

  • Trading PnL: Realised PnL from individual fills (closed_pnl)

  • Funding payments: USD amounts from userFunding

This avoids the resolution-dependent netflow derivation that causes share price spikes in the portfolio-history pipeline. It is still indicative: API retention limits and incomplete historical event coverage can omit older fills or ledger events, so the result is not an authoritative vault share price.

The share price model follows ERC-4626 mechanics:

  • share_price = total_assets / total_supply

  • Deposits mint shares: shares_minted = deposit_amount / share_price

  • Withdrawals burn shares: shares_burned = withdrawal_amount / share_price

  • PnL and funding change total_assets but not total_supply

  • Share price starts at 1.00 at first deposit

Parameters
Returns

List of SharePriceEvent objects in chronological order.

Return type

list[eth_defi.hyperliquid.trade_history.SharePriceEvent]