Add the Sortino ratio for downside risk

This commit is contained in:
Ryan Day
2013-01-28 08:55:14 -05:00
parent a49bd4af4b
commit 64ffa055c9
2 changed files with 90 additions and 0 deletions
+40
View File
@@ -327,6 +327,46 @@ class Risk(unittest.TestCase):
for x in self.metrics_06.year_periods],
[-0.066])
def test_algorithm_sortino_06(self):
self.assertEqual([round(x.sortino, 3)
for x in self.metrics_06.month_periods],
[4.491,
-2.842,
-2.052,
3.898,
7.023,
-8.532,
3.079,
-0.354,
-1.125,
3.009,
3.277,
-3.122])
self.assertEqual([round(x.sortino, 3)
for x in self.metrics_06.three_month_periods],
[-0.769,
-1.043,
6.677,
-2.77,
-3.209,
-6.769,
1.253,
1.085,
3.659,
1.674])
self.assertEqual([round(x.sortino, 3)
for x in self.metrics_06.six_month_periods],
[-2.728,
-3.258,
-1.84,
-1.366,
-1.845,
-3.415,
2.238])
self.assertEqual([round(x.sortino, 3)
for x in self.metrics_06.year_periods],
[-0.524])
def dtest_algorithm_beta_06(self):
self.assertEqual([round(x.beta, 3)
for x in self.metrics_06.month_periods],