<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">### VolSurface::Calibration::Equities

This repository is [Binary.com](https://www.Binary.com)'s equities volatility calibration - a variant of standard SABR model. This assumes that the input volatility surface is in moneyness terms, with a matrix of moneyness and tenor defined. 

Basically a Volatility Surface Calibration algorithm tries to check a Vol-Surface to make sure it satisfies some basic requirements. If not, it will change the surface to make it a valid VolSurface - satisfying arbitrage free prices across tenors and strikes. The standard SABR (stochastic alpha, beta, rho) model is used to estimate implied volatility of an instrument in the derivatives market. It is one of the most popular models in the industry, represented by:

```

دƒ_impl= خ± x logâپ،(F_0âپ„K)/D(خ¶) x  {1+[(2خ³_2-خ³_(1 )^2+1âپ„(F_mid^2 ))/24 x   ((دƒ_0 C(F_mid ))/خ±)^2+ (دپخ³_1)/4 x  (دƒ_0 C((F_mid ))/خ±+ (2-3دپ^2)/24]  x خµ }

```
The above equation basically expresses implied volatility as some sort of moneyness function (the alpha x log(F/K)D(...) part). This term is adjusted by a factor in the square brackets and then added back. In our variant of the standard SABR approach, we modify the terms in the square brackets. This calibration approach is based upon modeling the term structure of ATM volatility and Skew using exponential functions, as it is widely observed that ATM vols term structure or skew term structure is mostly convex. We have observed that this variant results in a more consistent option prices.

For optimization, we use a form of the Downhill Simplex Method or Nelder-Mead (available as the R function optim). 

### Documentation

Further details of the calibration model is available in MS Word and pdf formats inside 'documentation' directory as below:

[MS Word Format](documentation/Binary's_equities_volatility_calibration.docx)

[PDF Format](documentation/Binary's_equities_volatility_calibration.pdf)

### Example

Here is an example on how to call this module to get calibration parameters for a Volatility Surface.

```

use VolSurface::Calibration::Equities;

my $vol_surface = { 7  =&gt; { smile =&gt; { 90 =&gt; 0.1, 100 =&gt; 0.09, 110 =&gt; 0.2 } },
                    31 =&gt; { smile =&gt; { 90 =&gt; 0.2, 100 =&gt; 0.1 , 110 =&gt; 0.3 } },
                    61 =&gt; { smile =&gt; { 90 =&gt; 0.3, 100 =&gt; 0.2 , 110 =&gt; 0.3 } }
                  };

my $calibrator = VolSurface::Calibration::Equities-&gt;new(
                        surface =&gt; $vol_surface, 
                        term_by_day =&gt; [7, 31, 61], 
                        smile_points =&gt; [90, 100, 110]);

my $calibration_parameters = $calibrator-&gt;compute_parameterization;


```

The result will contain *calibration error* and *calibration parameters*. The calibration error is stored in `$calibration_parameters-&gt;{calibration_error}`. 
The calibration parameters (atmvol1year, kurtosisshort, atmvolshort, kurtosislong, skewlong, skewwingL, skewshort, atmvolLong, atmWingL, atmWingR, skew1year and kurtosisgrowth)
are stored in `$calibration_parameters-&gt;{values}` in a hashmap.
As this algorithm is recursive, you can feed the result `$calibration_parameters` again into the calibrator to achieve a better calibration result.

```

$calibrator = VolSurface::Calibration::Equities-&gt;new(
                        surface =&gt; $vol_surface, 
                        term_by_day =&gt; [7, 31, 61], 
                        smile_points =&gt; [90, 100, 110],
                        parameterization =&gt; $calibration_parameters);

my $better_calibration_parameters = $calibrator-&gt;compute_parameterization;

```

Here is a sample output of `compute_parameterization`:

```

{
  'date' =&gt; '2015-10-15T02:11:08Z',
  'calibration_error' =&gt; '74.4405707998374',
  'values' =&gt; {
                'skewwingR' =&gt; '1.85252856710673',
                'atmvol1year' =&gt; '0.208269684036621',
                'kurtosisshort' =&gt; '0.77476212605903',
                'atmvolshort' =&gt; '-0.0841520078952032',
                'kurtosislong' =&gt; '-0.393354944343425',
                'skewlong' =&gt; '-0.963533070236581',
                'skewwingL' =&gt; '1.93193338213629',
                'skewshort' =&gt; '0.405037188649962',
                'atmvolLong' =&gt; '-0.252945255396345',
                'atmWingL' =&gt; '1.19267660894242',
                'atmWingR' =&gt; '1.82430685141442',
                'skew1year' =&gt; '0.302983949090027',
                'kurtosisgrowth' =&gt; '0.69108830722333'
              }
};

```
</pre></body></html>