Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-227

Hedging Error Lite

Problem

Compute the total absolute hedging error between realized and hedged payoffs.

Return sum of abs(realized[i] - hedged[i]).

Hint

Lower absolute error means a tighter hedge.

Test cases

case 1
in: [[1,2],[0.9,2.2]]
expected: 0.30000000000000016
case 2
in: [[3],[5]]
expected: 2
case 3
in: [[1,-1],[1,-1]]
expected: 0
Starter codePython
def hedging_error_lite(realized, hedged):
    # Your code here
    pass

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