1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// ############################################################################
// FUNCTIONS
// ############################################################################
/// Treynor's (1965) risk-reward ratio.
///
/// `Treynor ratio = (r_p - r) / beta_p`
///
/// Where:
///
/// * `r_p` is the average return of the portfolio.
/// * `r` is the risk-free return over the same period.
/// * `beta_p` is the beta of the portfolio.
/// Sharpe's (1966) risk-reward ratio.
///
/// `Sharpe ratio = (r_p - r) / sigma_p`
///
/// Where:
///
/// * `r_p` is the average return of the portfolio.
/// * `r` is the risk-free return over the same period.
/// * `sigma_p` is the standard deviation of the portfolio returns.
/// Sortino and Price's (1994) risk-reward ratio.
///
/// `Sortino ratio = (r_p - r) / sigma_down`
///
/// Where:
///
/// * `r_p` is the average return of the portfolio.
/// * `r` is the risk-free return over the same period.
/// * `sigma_down` is the *downside* standard deviation of the portfolio returns, also known as semistandard deviation.
/// Burke's (1994) risk-reward ratio.
///
/// `Burke ratio = (r_p - r) / ss_drawdowns`
///
/// Where:
///
/// * `r_p` is the average return of the portfolio.
/// * `r` is the risk-free return over the same period.
/// * `ss_drawdowns` is the sum of the squared drawdowns.
/// Return on VaR (value-at-risk).
///
/// `Return on var = r_p / var`
///
/// Where:
///
/// * `r_p` is the average return of the portfolio.
/// * `var` is the Value-at-Risk.
/// Jensen's Measure (alpha).
///
/// `Jensen's Alpha = r_p - (r + beta_p * (r_m - r))`
///
/// Where:
///
/// * `r_p` is the average return of the portfolio.
/// * `r` is the risk-free return over the same period.
/// * `beta_p` is the beta of the portfolio.
/// * `r_m` is the expected market return.
// ############################################################################
// TESTS
// ############################################################################
// NEED TESTS HERE