Main Content

volatilities

Compute implied volatilities when using SABR pricer

Description

example

outVolatilities = volatilities(inpPricer,ExerciseDate,ForwardValue,Strike) computes implied volatilities for a Swaption instrument when you use a SABR pricer.

Examples

collapse all

This example shows the workflow to compute implied volatilities for a Swaption Instrument.

Create ratecurve Object

Create a ratecurve object using ratecurve.

ValuationDate = datetime(2016,3,5);
ZeroDates = datemnth(ValuationDate,[1 2 3 6 9 12*[1 2 3 4 5 6 7 8 9 10 12]])';
ZeroRates = [-0.33 -0.28 -0.24 -0.12 -0.08 -0.03 0.015 0.028 ...
            0.033 0.042 0.056 0.095 0.194 0.299 0.415 0.525]'/100;
Compounding = 1;
ZeroCurve = ratecurve("zero",ValuationDate,ZeroDates,ZeroRates,'Compounding',Compounding)
ZeroCurve = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: 1
                Basis: 0
                Dates: [16x1 datetime]
                Rates: [16x1 double]
               Settle: 05-Mar-2016
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Create SABR Model Object

Use finmodel to create a SABR model object.

Alpha = 0.0135;
Beta = 0.5;
Rho = 0.4654;
Nu = 0.4957;
Shift = 0.008;
 
SABRModel = finmodel("SABR",'Alpha',Alpha,'Beta',Beta,'Rho',Rho,'Nu',Nu,'Shift',Shift)
SABRModel = 
  SABR with properties:

             Alpha: 0.0135
              Beta: 0.5000
               Rho: 0.4654
                Nu: 0.4957
             Shift: 0.0080
    VolatilityType: "black"

Create SABR Pricer Object

Use finpricer to create a SABR pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

SABRPricer = finpricer("Analytic", 'Model', SABRModel,'DiscountCurve', ZeroCurve)
SABRPricer = 
  SABR with properties:

    DiscountCurve: [1x1 ratecurve]
            Model: [1x1 finmodel.SABR]

Compute Implied Volatilities

Use volatilities to compute the implied volatilites for a Swaption instrument.

SwaptionExerciseDate = datetime(2017,3,5);
ForwardValue = 0.0007;
StrikeGrid = [-0.5; -0.25; -0.125; 0; 0.125; 0.25; 0.5; 1.0; 1.5]/100;
MarketStrikes = ForwardValue + StrikeGrid;

outVolatilities = volatilities(SABRPricer, SwaptionExerciseDate, ForwardValue, MarketStrikes)
outVolatilities = 9×1

    0.2132
    0.1500
    0.1409
    0.1474
    0.1609
    0.1752
    0.2004
    0.2372
    0.2627

Input Arguments

collapse all

SABR pricer, specified as a previously created SABR pricer object.

Data Types: object

Option exercise date, specified as a scalar datetime, serial date number, date character vector, or date string.

Data Types: double | char | string | datetime

Forward swap rate, specified as a scalar decimal.

Data Types: object

Strike rate, specified as a scalar decimal.

Data Types: double

Output Arguments

collapse all

Output volatilities, returned as a numeric.

Introduced in R2020b