Skip to content

Commit b4cc092

Browse files
committed
docs: update docstring for Portfolio.dcf.wealth_index
1 parent b7f0539 commit b4cc092

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

okama/portfolios/dcf.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,30 @@ def set_mc_parameters(
156156

157157
def wealth_index(self, discounting: Literal["fv", "pv"], include_negative_values: bool = False) -> pd.DataFrame:
158158
"""
159-
Wealth index Future Values (FV) time series for the portfolio with cash flow (contributions and
160-
withdrawals).
159+
Calculate wealth index time series for the portfolio with cash flow (contributions and withdrawals).
161160
162161
Wealth index (Cumulative Wealth Index) is a time series that presents the value of portfolio over
163162
historical time period considering cash flows.
164163
165164
Accumulated inflation time series is added if `inflation=True` in the Portfolio.
166165
167-
If there is no cash flow, Wealth index is obtained from the accumulated return multiplicated
166+
If there is no cash flow, Wealth index is obtained from the accumulated return multiplied
168167
by the initial investments. That is: initial_amount_pv * (Acc_Return + 1)
169168
169+
Parameters
170+
----------
171+
discounting : {'fv', 'pv'}
172+
Type of discounting to apply:
173+
- 'fv': Future Values - nominal values without discounting
174+
- 'pv': Present Values - values discounted to present using the discount rate
175+
include_negative_values : bool, default False
176+
Whether to include negative wealth index values in the result.
177+
If False, negative values are replaced with zeros.
178+
170179
Returns
171180
-------
172-
Time series of wealth index values for portfolio and accumulated inflation.
181+
pd.DataFrame
182+
Time series of wealth index values for portfolio and accumulated inflation (if applicable).
173183
174184
Examples
175185
--------
@@ -178,7 +188,7 @@ def wealth_index(self, discounting: Literal["fv", "pv"], include_negative_values
178188
>>> ind = ok.IndexationStrategy(pf) # Set Cash Flow Strategy parameters
179189
>>> ind.initial_investment = 100 # initial investments value
180190
>>> ind.frequency = "year" # withdrawals frequency
181-
>>> ind.amount = -0.5 * 12 # initial withdrawals amount
191+
>>> ind.amount = -6 # initial withdrawals amount
182192
>>> ind.indexation = "inflation" # the indexation is equal to inflation
183193
>>> pf.dcf.cashflow_parameters = ind # assign the strategy to Portfolio
184194
>>> pf.dcf.wealth_index(discounting="fv", include_negative_values=False).plot()

0 commit comments

Comments
 (0)