Quantcast

QuantLib - SABR Model.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

QuantLib - SABR Model.

Hurley Hurley

Hi,

I have a question regarding the SABR model in Quantlib. I am trying to fit a SABR vol surface to the following data.

    vector<double> strikes       = { 245.00, 247.50, 250.00, 252.50, 255.00, 257.50, 260.00, 262.50, 265.00 };
    vector<double> imp_vols    = { 12.45,  11.98,  11.47,  10.98,  10.52,  10.22,  9.81,   9.53,   9.39   };
    vector<double> last_prices = { 9.941,  7.859,  5.940,  4.245,  2.831,  1.768,  0.982,  0.498,  0.237  };

    double forward          = 254.12;
    double calendarTime = 34 / 365.0;
    double intRate          = 0.03;
    double discount        = std::exp(-intRate * calendarTime);

Assume the following SABR parameters.
    double Beta = 0.5;
    double NU   = 0.05;
    double Rho  = -0.5;

Also assuming the ATM vol is the 255.00 strike (ImpVol = 10.22).

Can someone please clarify what units the following parameters in the QuantLib method expects - strike, forward, expiryTime and alpha? When I input the raw data above I get results that don't make much sense.

QuantLib Method:
Real unsafeSabrVolatility(Rate strike, Rate forward, Time expiryTime, Real alpha, Real beta, Real nu, Real rho);

Regards,
Hurley


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: QuantLib - SABR Model.

Peter Caspers-4
Hi Hurley,

the strike and the forward only have to be “consistent with each other", so they look fine in your code below.

The expiryTime is normally chosen to be in years, i.e. close to 1.0 for one year (as it is apparently the case in your code), but of course you can use your own time unit for the whole model.

SABR’s alpha is an absolute value, so e.g. 0.10 would be a typical order of magnitude.

Finally, the return value of unsafeSabrVolatility(…) is also an absolute value, so 0.15 would be 15% lognormal volatility. I guess this is where you rather use percentage values in your code below, which you should divide by 100.0 to make them comparable with the output of the SABR function.

As a general rule, QuantLib mostly expects absolute values as an input, rarely percentage values or basispoints or the like. The only exception I can think of at the moment are percentage bond prices, which are given as 101.00.

Kind Regards
Peter

On 18 Dec 2016, at 09:44, Hurley Hurley <[hidden email]> wrote:


Hi,

I have a question regarding the SABR model in Quantlib. I am trying to fit a SABR vol surface to the following data.

    vector<double> strikes       = { 245.00, 247.50, 250.00, 252.50, 255.00, 257.50, 260.00, 262.50, 265.00 };
    vector<double> imp_vols    = { 12.45,  11.98,  11.47,  10.98,  10.52,  10.22,  9.81,   9.53,   9.39   };
    vector<double> last_prices = { 9.941,  7.859,  5.940,  4.245,  2.831,  1.768,  0.982,  0.498,  0.237  };

    double forward          = 254.12;
    double calendarTime = 34 / 365.0;
    double intRate          = 0.03;
    double discount        = std::exp(-intRate * calendarTime);

Assume the following SABR parameters.
    double Beta = 0.5;
    double NU   = 0.05;
    double Rho  = -0.5;

Also assuming the ATM vol is the 255.00 strike (ImpVol = 10.22).

Can someone please clarify what units the following parameters in the QuantLib method expects - strike, forward, expiryTime and alpha? When I input the raw data above I get results that don't make much sense.

QuantLib Method:
Real unsafeSabrVolatility(Rate strike, Rate forward, Time expiryTime, Real alpha, Real beta, Real nu, Real rho);

Regards,
Hurley

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Loading...