okama.Portfolio.get_cumulative_return

Portfolio.get_cumulative_return(period=None, real=False)

Calculate cumulative return over a given trailing period for the portfolio.

The cumulative return is the total change in the portfolio price during the investment period.

Inflation adjusted cumulative returns (real cumulative returns) are shown with real=True option. Annual inflation data is calculated for the same period if inflation=True in the AssetList.

Parameters:
period: str, int or None, default None

Trailing period in years. None - full time cumulative return. ‘YTD’ - (Year To Date) period of time beginning the first day of the calendar year up to the last month.

real: bool, default False

Cumulative return is adjusted for inflation (real cumulative return) if True. Portfolio should be initiated with Inflation=True for real cumulative return.

Returns:
Series

Cumulative rate of return values for portfolio and cumulative inflation (if inflation=True in Portfolio).

Examples

>>> pf = ok.Portfolio(['BTC-USD.CC', 'LTC-USD.CC'], weights=[.8, .2], last_date='2021-03')
>>> pf.get_cumulative_return(period=2, real=True)
portfolio_6232.PF    9.39381
dtype: float64