portfolio_to_combined_dataframe
Documentation for eth_defi.hyperliquid.daily_metrics.portfolio_to_combined_dataframe function.
- portfolio_to_combined_dataframe(portfolio_all_time=None, *, portfolio=None)
Convert vaultDetails portfolio history into a combined DataFrame with share prices.
Derives
pnl_updateandnetflow_updatefrom the portfolio history, then feeds them through_calculate_share_price()to compute ERC-4626-style share prices.When
portfolio(the full period dict) is provided, all available periods (day,week,month,allTime) are merged to produce a higher-resolution time series. This yields more data points for recent history compared to usingallTimealone.The derivation:
pnl_update[i] = pnl_history[i] - pnl_history[i-1]netflow_update[i] = (account_value[i] - account_value[i-1]) - pnl_update[i]cumulative_account_value[i] = account_value[i]
- Parameters
portfolio_all_time (eth_defi.hyperliquid.vault.PortfolioHistory | None) – The
allTimePortfolioHistoryfromvaultDetailsendpoint. Kept for backward compatibility.portfolio (dict[str, eth_defi.hyperliquid.vault.PortfolioHistory] | None) – Full portfolio period dict from
VaultInfo.portfolio. When provided, all periods are merged for higher resolution. Takes precedence overportfolio_all_time.
- Returns
DataFrame with timestamp index and columns:
pnl_update,netflow_update,cumulative_pnl,cumulative_netflow,cumulative_account_value,total_assets,total_supply,share_price,epoch_reset- Return type