Course Name: Quantitative Portfolio Management, Section No: 14, Unit No: 1, Unit type: Notebook
A more accurate method is to use the geometric mean for calculating the annual returns:
geometric_mean_return = np.prod(1 + returns['portfolio']) ** (1/len(returns)) - 1
annual_returns = ((1 + geometric_mean_return)**(trading_days) - 1)*100