File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Changelog
22===========
33
4+ 0.0.69
5+ ------
6+
7+ - Added ` periods ` parameter to ` calmar() ` function to support custom annualization periods (fixes issue #455 )
8+ - Updated reports.py to pass periods parameter to Calmar ratio calculation for consistency with other metrics
9+
4100.0.68
511------
612
Original file line number Diff line number Diff line change @@ -1301,7 +1301,7 @@ def metrics(
13011301 metrics ["Volatility (ann.) %" ] = ret_vol
13021302
13031303 # Additional risk and return metrics
1304- metrics ["Calmar" ] = _stats .calmar (df , prepare_returns = False )
1304+ metrics ["Calmar" ] = _stats .calmar (df , prepare_returns = False , periods = win_year )
13051305 metrics ["Skew" ] = _stats .skew (df , prepare_returns = False )
13061306 metrics ["Kurtosis" ] = _stats .kurtosis (df , prepare_returns = False )
13071307
Original file line number Diff line number Diff line change @@ -1492,7 +1492,7 @@ def kurtosis(returns, prepare_returns=True):
14921492 return returns .kurtosis ()
14931493
14941494
1495- def calmar (returns , prepare_returns = True ):
1495+ def calmar (returns , prepare_returns = True , periods = 252 ):
14961496 """
14971497 Calculate the Calmar ratio (CAGR / Maximum Drawdown).
14981498
@@ -1503,6 +1503,7 @@ def calmar(returns, prepare_returns=True):
15031503 Args:
15041504 returns (pd.Series): Return series to analyze
15051505 prepare_returns (bool): Whether to prepare returns first (default: True)
1506+ periods (int): Periods per year for annualization (default: 252)
15061507
15071508 Returns:
15081509 float: Calmar ratio
@@ -1518,7 +1519,7 @@ def calmar(returns, prepare_returns=True):
15181519 returns = _utils ._prepare_returns (returns )
15191520
15201521 # Calculate CAGR and maximum drawdown
1521- cagr_ratio = cagr (returns )
1522+ cagr_ratio = cagr (returns , periods = periods )
15221523 max_dd = max_drawdown (returns )
15231524
15241525 # Return ratio of CAGR to absolute maximum drawdown
Original file line number Diff line number Diff line change 1- version = "0.0.68 "
1+ version = "0.0.69 "
You can’t perform that action at this time.
0 commit comments