Calculate and review the Calmar ratio
Continue with the same strategy. From the previous exercise, you know that the average drawdown is approximately 11%, and that the average period is 22 days. Now you would like to get a better understanding of the risk-return profile of it. You plan to review the CAGR, max drawdown, then use them to calculate the Calmar ratio and assess the result.
The resInfo
DataFrame that contains all backtest statistics has been provided for you.
This exercise is part of the course
Financial Trading in Python
Exercise instructions
- Get the compound annual growth rate (CAGR) from
resInfo
. - Get the max drawdown from
resInfo
. - Calculate the Calmar ratio using
cagr
andmax_drawdown
. - Obtain the Calmar ratio directly from
resInfo
and review it.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Get the CAGR
cagr = ____
print('Compound annual growth rate: %.4f'% cagr)
# Get the max drawdown
max_drawdown = ____
print('Maximum drawdown: %.2f'% max_drawdown)
# Calculate Calmar ratio manually
calmar_calc = ____ / ____ * (-1)
print('Calmar Ratio calculated: %.2f'% calmar_calc)
# Get the Calmar ratio
calmar = ____
print('Calmar Ratio: %.2f'% calmar)