Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-102

Tracking Error

Problem

Compute the tracking error as the population standard deviation of the active returns portfolio[t] - benchmark[t].

Return 0.0 when the lists are empty or have different lengths.

Hint

Tracking error is the volatility of the return difference, not of either series.

Test cases

case 1
in: [[0.02,0.03,0.01],[0.01,0.01,0]]
expected: 0.004714045207910316
case 2
in: [[0.05,0.05],[0.02,0.02]]
expected: 0
case 3
in: [[0.01,-0.01],[0,0]]
expected: 0.01
case 4
in: [[],[]]
expected: 0
Starter codePython
def tracking_error(portfolio, benchmark):
    # Your code here
    pass

4 test cases · run your code against them in the editor