volatilities
Compute implied volatilities when using SABR
pricer
Description
computes implied volatilities for a outVolatilities
= volatilities(inpPricer
,ExerciseDate
,ForwardValue
,Strike
)Swaption
instrument when you
use a SABR
pricer.
Examples
Compute Implied Volatilities for Swaption Instrument
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 volatilities 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
inpPricer
— SABR pricer
SABR
pricer object
SABR pricer, specified as a previously created SABR
pricer
object.
Data Types: object
ExerciseDate
— Option exercise date
datetime | serial date number | date character vector | date string
Option exercise date, specified as a scalar datetime, serial date number, date character vector, or date string.
Data Types: double
| char
| string
| datetime
ForwardValue
— Forward swap rate
decimal
Forward swap rate, specified as a scalar decimal.
Data Types: object
Strike
— Strike rate
decimal
Strike rate, specified as a scalar decimal.
Data Types: double
Output Arguments
outVolatilities
— Output volatilities
numeric
Output volatilities, returned as a numeric.
Version History
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)