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_update and netflow_update from 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 using allTime alone.

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
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

pandas.DataFrame