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) ... 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 }
The above code is useful in simulations only (and in backtestings & forward testings using simulated data). Should not be used for other purposes. Wikipedia writes For modelling Volatility Smile using real market data maybe the following Python code could be used: https://blog.quantinsti.com/volatility-smile-origin-implications/ Other related links: https://yandex.com/search/?text=modelling+volatility+smile&lr=100526
Fixing a typo in the OP: "Assumption: VolaSmile synchronous symmetric around the data pair ATM_S;ATM_IV" A related research paper: "Smile interpolation and calibration of the local volatility model" April 2005, Author(s): Nabil Kahale (ESCP Business School) Abstract and Figures The Black-and-Scholes formula provides a correspondence between the price of a plain option and the underlying asset volatility. Volatilities implied from prices of quoted plain options are, in general, not constant and depend on the strike and maturity of the option. We describe a new construction of an implied volatility surface from a discrete set of implied volatilities which is arbitrage-free and satisfies some smoothness conditions. Our algorithm allows the calibration to the smile of the local volatility model, a standard extension of the Black-and-Scholes model known to be hard to calibrate in practice. Plain options prices calculated from our local volatility surface using deterministic schemes or Monte Carlo simulation closely match input prices. This allows the pricing of exotic options in a way consistent with the price of quoted plain options. Call price on the USD/DEM exchange rate on August 1995 in terms of the maturity and the strike. … Implied risk-neutral density function of the spot of the USD/DEM exchange rate on August 1995 in terms of the maturity and the strike. … Local volatilities on the USD/DEM exchange rate on August 1995 in terms of the time and spot. …
The solution in the OP uses just 2 xy data pairs (ATM_S; ATM_IV) and (Higher_S;Higher_IV). I have also an extended model that accepts also more than 2 xy data pairs, and then works similarily like that in the OP, by simply operating on the right interval (ie where the given Sx falls to)... PM me if interested.
We use a type of graphics mathematical fit after using a modified cubic spline. See the orange line in the graph below. It is important to use delta as the x-axis. This makes the parameters comparable to other stocks. We calculate a slope and derivative for each expiration and a confidence figure. https://gyazo.com/54a70cdaeacff97bc693b6bc185b955d
Just curious: why are there no dots alongside the Jan-19 orange line? I guess these dots are the market IVs of the official strikes, right? The others have the line plus many dots. Is it b/c it's expired?
At the time this was snapped there were no options that had any delta >0 or <100 for the Jan 19th expirations. The dots represent actual strikes with the cyan = call mid IV and purple = put mid IV.