calculate_net_returns_from_gross
Documentation for eth_defi.research.vault_metrics.calculate_net_returns_from_gross function.
- calculate_net_returns_from_gross(name, cumulative_returns, management_fee_annual, performance_fee, deposit_fee, withdrawal_fee, seconds_in_year=31557600.0)
Convert a cumulative gross return series to a cumulative net return series after fees.
This function correctly models a High-Water Mark (HWM) for performance fees, which requires an iterative calculation (a loop). This loop operates on Numpy arrays for maximum speed.
Management fees are accrued based on the time delta of each period.
Performance fees are charged only on profits above the highest net value.
Deposit fees are applied once at the start (t=0).
Withdrawal fees are applied once at the end (t=T).
- Parameters
name (str) – Name for the returned pandas Series.
cumulative_returns (pandas.Series) – A pandas Series with a DatetimeIndex representing the cumulative gross return index (e.g., 1.0, 1.02, 1.05) OR cumulative gross profit (e.g., 0.0, 0.02, 0.05).
management_fee_annual (Optional[float]) – Annual management fee as a decimal (e.g., 0.02 for 2%).
performance_fee (Optional[float]) – Performance fee as a decimal (e.g., 0.20 for 20% of profits above the High-Water Mark).
deposit_fee (Optional[float]) – Fee applied to the initial deposit as a decimal (e.g., 0.01 for 1%).
withdrawal_fee (Optional[float]) – Fee applied to the final withdrawal as a decimal (e.g., 0.01 for 1%).
seconds_in_year – The number of seconds in a year for precise management fee accrual.
- Returns
A pandas Series of the cumulative net profit (e.g., 0.10 for 10%).
- Return type