1
$\begingroup$

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 ...)

$\endgroup$
1
  • $\begingroup$ Why do you have x range from 0 to 200 when the strikes are from 22.56 to 67.68? You are extrpolating well beyond both ends of the interval in which the strikes are located. PLot the results to see on which side(s) y has gone negative. $\endgroup$
    – nbbo2
    Mar 6 at 9:04

1 Answer 1

1
$\begingroup$

Use linear interpolation/extrapolation:

You are overfitting your volatility surface if you use a Cubic spline, hence giving you negative values for large strikes. In order to avoid this, you can simply do a linear extrapolation of the volatility surface:

import scipy as sc
import numpy as np
import matplotlib.pyplot as plt

Strikes = [22.56, 27.07, 31.58, 36.10, 40.61, 45.12, 49.63, 54.14, 58.66, 63.17, 67.68]

Vols = [97.44, 87.32, 79.73, 75.47, 73.58, 74.53, 78.61, 83.64, 88.03, 92.26, 96.44]


LinInterpolation = sc.interpolate.interp1d(Strikes, Vols,kind = 'linear',fill_value='extrapolate')

x = np.linspace(0, 200, 399)

plt.plot(x, LinInterpolation(x))

extrapolated volsurface

You can play around with the interpolator by changing the string in kind to eg. "quadratic" or "cubic". Documentation can be found here.

$\endgroup$
1
  • 1
    $\begingroup$ @GiovanniVenticinque If you found my answer useful, would you then consider pressing the green tick-mark under the votes? $\endgroup$
    – Pleb
    Mar 8 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.