Giovanni Venticinque
Giovanni Venticinque

Reputation: 11

How to interpolate volatility's skew using spline in Python

I have two lists to describe the function y(x) that represents strikes and the relative value of the skew of a volatility surface:

x_points = [22.56, 27.07, 31.58, 36.10, 40.61, 45.12, 49.63, 54.14, 58.66, 63.17, 67.68] %strikes value

y_points = [97.44, 87.32, 79.73, 75.47, 73.58, 74.53, 78.61, 83.64, 88.03, 92.26, 96.44] %vol value

I would like to perform cubic spline interpolation to retrieve the range 0;200 of the skew but, using the below code, i get some negative values (not consistent solution):

def f(x):
    x = np.linspace(0, 200, 399)

    tck = interpolate.splrep(x_points, y_points)

    return interpolate.splev(x, tck)

Can you please give me some feedback and help to get the problem solved? Maybe the curve should not be fit with Cubic Spline or i should add some constraints to the optimization problem (no idea at all ...)

Upvotes: 1

Views: 228

Answers (0)

Related Questions