All problems
Information Ratio
Problem
Compute the information ratio as mean(active) / std(active), where active[t] = portfolio[t] - benchmark[t] and std is the population standard deviation.
Return 0.0 when the lists are empty, differ in length, or the active return has zero standard deviation.
Hint
It measures active return per unit of active risk.
Test cases
case 1
in: [[0.02,0.03,0.01],[0.01,0.01,0]]
expected: 2.8284271247461903
case 2
in: [[0.05,0.05],[0.02,0.02]]
expected: 0
case 3
in: [[0.01,-0.01],[0,0]]
expected: 0
case 4
in: [[],[]]
expected: 0
Starter codePython
def information_ratio(portfolio, benchmark):
# Your code here
pass4 test cases · run your code against them in the editor