The following simple C/C++ function gives the IV for the desired Sx from a Volatility Smile "curve".
It's a simple "V"-like model for quick testing/using, not the more realistic smoothed "U"-like model as in the above link.
Feel free to post a better code using Non-Linear Regression (Spline Interpolation etc.).
S and Sx in this context means of course the strikes (maybe better should have labelled it rather as K and Kx).
User can specify the degree of the Volatility Smile via the parameters ATM_S, ATM_IV, Higher_S, Higher_IV.
The function then interpolates (or extrapolates) accordingly, ie. applies a simple Linear Regression calc.
Examples for (10, 100), (20, 200) :
...
(Sx=8, IV=120)
(Sx=9, IV=110)
(Sx=10, IV=100)
(Sx=11, IV=110)
(Sx=12, IV=120)
...
It's a simple "V"-like model for quick testing/using, not the more realistic smoothed "U"-like model as in the above link.
Feel free to post a better code using Non-Linear Regression (Spline Interpolation etc.).
S and Sx in this context means of course the strikes (maybe better should have labelled it rather as K and Kx).
User can specify the degree of the Volatility Smile via the parameters ATM_S, ATM_IV, Higher_S, Higher_IV.
The function then interpolates (or extrapolates) accordingly, ie. applies a simple Linear Regression calc.
Examples for (10, 100), (20, 200) :
...
(Sx=8, IV=120)
(Sx=9, IV=110)
(Sx=10, IV=100)
(Sx=11, IV=110)
(Sx=12, IV=120)
...
Code:
double calc_IV_from_VolaSmile(const double ATM_S, const double ATM_IV, const double Higher_S, const double Higher_IV, const double Sx)
{ /* Assumption: VolaSmile synchronous around the data pair ATM_S;ATM_IV
ATTN: no plausi for passing Sx < 0, or Higher_S < ATM_S etc. Ie. you have to know what you do :-)
Example: (10, 100), (20, 200) --> (Sx=8, IV=120)
*/
const double dx = Higher_S - ATM_S;
const double dy = Higher_IV - ATM_IV;
const double y_per_1x = dy / dx;
return ATM_IV + y_per_1x * fabs(Sx - ATM_S); // fabs important
}
Last edited:


