# Calculate Annualized Return / Annualized Sharpe From Portfolio

If I have a portfolio of stocks that I invest in and out of at different holding periods and different times of the year. How would one calculate the annualized returns and annualized sharpe ratio of the portfolio?

# Edit

I am trying so far:

Right now my idea was... take the cumulative gross profit of the portfolio, so summing the daily PnL for all stocks say from year 2009 to present day. Then I did the following, I use R -

# Annualized return
Aret <- (1+total.PnL.sum)^(1/8.51685393258427)-1


is this somewhat correct for the annualized return? I am using 8.51 years... as all the stock purchases were over 8.5 years at different times etc..

Or do you assume a 252 number here?

1. For finding the returns during a calendar year (or other period) there are two methods:

a) The IRR (internal rate of return) method requires the values of the portfolio at the end of year n-1 and end of year n, and the dates and amounts of any cash additions/withdrawals from the portfolio during the year.

If you put these dates and amounts into an Excel sheet, the =XIRR() function can be used to compute the rate of return.

There is also a simple formula called the Modified Dietz method that can be used to find the approximate rate of return given the same information (the two won't give exactly the same result, however).

b) A more sophisticated method called the TWR (Time Weighted Return) is used by most mutual funds and institutional investors, but it requires more information. You need the starting and ending values of the portfolio, the dates and amounts of cash flows, but also the value of the portfolio at the time of these external cash inflows/outflows. This will allow you to compute an exact rate of return between two inflow/outflow events; you then link together the returns during these "closed" periods to find the TWR for the entire year.

One convenient way to handle these calculations is to pretend that your portfolio is actually a mutual fund from which you withdraw or add money. You keep track of the number of Units the MF has issued and the Net Asset Value per unit. When you add/withdraw money the number of units increases/decreases (issuance/redemption process); at the close of that day you also compute the value of the portfolio and divide by number of units to find the NAV per unit. This is sometimes called the BAI method of accounting.

1. Finally, computing the Sharpe ratio requires the most information of all. For this you need the NAV for every trading day of the year (typically 252 days), or equivalently the daily return for each trading day of the year. Some brokerage firms will let you download the daily values of your portfolio and the daily inflows/outflows, from which you can compute the daily returns.
• Thanks for the different methods, I will need to research them. Right now my idea was... take the cumulative gross profit of the portfolio, so summing the daily PnL for all stocks say from year 2009 to present day. Then I did the following, I use R - # Annualized return Aret <- (1+total.PnL.sum)^(1/8.51685393258427)-1 is this somewhat correct for the annualized return? – Andrew Bannerman Oct 24 '17 at 0:36
• sorry the total value was in the total.PnL.sum variable - lets say its the growth of $1.... so its$33 now. Aret <- (1+33)^(1/8.51685393258427)-1 – Andrew Bannerman Oct 24 '17 at 0:51
• Yes, that will give you a compound annual growth rate (CAGR), which could be good enough for some purposes. – Alex C Oct 24 '17 at 0:56
• Ok very cool! How would I then work out the annualized sharpe ratio? Can it be explained to me in formula format so I can follow along! – Andrew Bannerman Oct 24 '17 at 0:59
• Fyi - I am running back tests, so its more a measure for comparing back tests versus calculating specific portfolio metrics. – Andrew Bannerman Oct 24 '17 at 1:04