Scoring for an example student

As discussed in the Scoring section, student performance is graded by Sharpe Ratio. Here, we walk through an example that explains how the Sharpe Ratio would be calculated for an example contest participant.

Matching up Calculations w/ Excel and Other Programs

As simple as it may seem, calculating logarithms can differ slightly (or sometimes, significantly) depending on the precision of the program you use. It’s possible to get different answers for the same log calcs in Excel, R, and Python, and the difference gets magnified when calculating GMRR.

Therefore, don’t worry too much if you try to follow along this example and wind up with numbers that differ slightly. For the purposes of fairness in the competition, it only matters that we use the same program for everyone – which, in this case, is the log() function in R.

Example Student’s Data

Let’s say that today’s date is 23 March 2021, and a student has been participating in the competition for seven days. Her end-of-day (EoD) portfolio balance, daily portfolio return, risk free rates, and daily excess return are as given in the table below:

The student’s daily portfolio returns are the log returns of her daily portfolio value. For example, on 18 March 2021, she started the day with $1,000,100.00 and ended with $1,000,050.00 in total portfolio value. Therefore her return for that day was:

# 'log()' here is the natural log, not base 10.
paste0(round(log(1000050.00 / 1000100.00) * 100, 5), "%")
## [1] "-0.005%"

Note that there’s no way to calculate a return on the very first day because there’s nothing to compare it to.

The risk free rate, \(r_{f}\) is assumed to be the 3 month CMT rate as published by the US Department of the Treasury (USDT). A quick visit to the USDT’s website confirms the rates presented in the table. The USDT presents CMT rates in an annualized format. Because the student’s daily returns are on a per trading day basis, we convert the annualized CMTs to a trading day basis by dividing by 252 – the number of trading days in one year.

The student’s excess return on any given day is determined by how much her portfolio return exceeded the risk free rate on that day; in other words, her excess return is the difference between her portfolio’s return and the risk free rate.

The student’s overall geometric mean excess return \(R_{p}\) is calculated as:

# Note that here, I'm rounding the returns to 4 digits, so the final answer will
# differ slightly than the one reported in the table (and used for official
# scoring) due to this rounding error.
student_excess_gmrr <- (
  (1 + -0.0061) * (1 + 0.0209) * (1 + -0.0050) * 
    (1 + 0.0200) * (1 + -0.0176) * (1 + 0.0226)
)^(1/6) - 1

print(paste0(round(student_excess_gmrr*100, digits = 4), "%"))
## [1] "0.5674%"

The students volatility of returns \(\sigma^{2}_{r}\) is the standard deviation of her excess gmrr:

student_vol <- sd(c(-0.0061, 0.0209, -0.0050, 0.0200, -0.0176, 0.0226))
print(paste0(round(student_vol*100, digits = 3), "%"))
## [1] "1.742%"

Finally, we can calculate the Sharpe Ratio for this student.

\[\begin{align*} {\tt Sharpe\ Ratio} = \frac{R_{p,e}}{\sigma^{2}} \end{align*}\]


\[\begin{align*} R_{p,e} & {\sf: Excess\ Portfolio\ Return} \\ \sigma^{2}_{r} & {\sf: Volatility\ of\ return} \end{align*}\]

Note that we’ve already taken the “\(-r_{f}\)” into account when we used the excess gmrr instead of the gmrr of the daily returns; in other words, with this notation the term “\(R_{p} - r_{f}\)” (as written in the Scoring section) equals \(R_{p,e}\).

Her Sharpe is:

student_Sharpe <- student_excess_gmrr / student_vol
## [1] 0.3256717