calculate_aggregate_returns#
API documentation for tradeexecutor.visual.equity_curve.calculate_aggregate_returns Python function.
- calculate_aggregate_returns(equity_curve, freq='BM')[source]#
Calculate strategy aggregatd results over different timespans.
Good to calculate
Monthly returns
Quaterly returns
See Aggregate return for more information what this metric represents.
Note
There are multiple ways to calculate aggregated returns and they give a bit different results. See this article for details: https://quantdare.com/calculate-monthly-returns-with-pandas/
Note
The current simplicist method does not calculate returns for the first and last period.
- Parameters:
equity_curve (Series) –
The equity curve of the portfolio.
freq (str | pandas._libs.tslibs.offsets.DateOffset) –
Pandas frequency string.
The default value is “month-end frequency”.
For valid values see https://stackoverflow.com/a/35339226/315168
- Returns:
Monthly returns for each month.
The array is keyed by the end date of the period e.g. July is 2021-07-31.
The first month can be incomplete, so its value is NaN.
- Return type:
Series