Vanilla
instrument object
Create and price a Vanilla
instrument object using this
workflow:
Use fininstrument
to create a Vanilla
instrument object.
Use finmodel
to specify
a BlackScholes
, Heston
, Bates
, Merton
, or Dupire
model for
the Vanilla
instrument.
When using a BlackScholes
model, use finpricer
to
specify a FiniteDifference
, , , BlackScholes
, BjerksundStensland
, RollGeskeWhaley
, VannaVolga
, or
AssetMonteCarlo
pricing method for the
Vanilla
instrument.
When using a Heston
, Bates
, or
Merton
model, use finpricer
to
specify a FiniteDifference
, NumericalIntegration
, FFT
, or AssetMonteCarlo
pricing method for the
Vanilla
instrument.
When using a Dupire
model, use finpricer
to
specify a FiniteDifference
pricing method for the
Vanilla
instrument.
For more information on this workflow, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.
For more information on the available models and pricing methods for a
Vanilla
instrument, see Choose Instruments, Models, and Pricers.
creates a VanillaObj
= fininstrument(InstrumentType
,'Strike
',strike_value,'ExerciseDate
',exercise_date)Vanilla
object by specifying
InstrumentType
and sets the properties for the
required name-value pair arguments Strike
and
ExerciseDate
. For more information on a
Vanilla
instrument, see More About.
sets optional properties using
additional name-value pairs in addition to the required arguments in the
previous syntax. For example, VanillaObj
= fininstrument(___,Name,Value
)VanillaObj =
fininstrument("Vanilla",'Strike',100,'ExerciseDate',datetime(2019,1,30),'OptionType',"put",'ExerciseStyle',"American",'Name',"vanilla_instrument")
creates a Vanilla
put option with an American exercise.
You can specify multiple name-value pair arguments.
InstrumentType
— Instrument type"Vanilla"
| character vector with value 'Vanilla'
Instrument type, specified as a string with the value of
"Vanilla"
or a character vector with the value of
'Vanilla'
.
Data Types: char
| string
Vanilla
Name-Value Pair ArgumentsSpecify required
and optional comma-separated pairs of Name,Value
arguments.
Name
is the argument name and Value
is
the corresponding value. Name
must appear inside quotes. You
can specify several name and value pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
VanillaObj =
fininstrument("Vanilla",'Strike',100,'ExerciseDate',datetime(2019,1,30),'OptionType',"put",'ExerciseStyle',"American",'Name',"vanilla_instrument")
Vanilla
Name-Value Pair Arguments'Strike'
— Option strike price valueOption strike price value, specified as the comma-separated pair
consisting of 'Strike'
and a scalar nonnegative
numeric value.
Note
When using a "Bermudan"
ExerciseStyle
with a FiniteDifference
pricer, the
Strike
is a vector.
Data Types: double
'ExerciseDate'
— Option exercise dateExerciseStyle
is
"Bermudan"
Option exercise date, specified as the comma-separated pair
consisting of 'ExerciseDate'
and a scalar
datetime, serial date number, date character vector, or date string.
Note
For a European option, there is only one
ExerciseDate
on the option expiry
date.
When using a "Bermudan"
ExerciseStyle
with a FiniteDifference
pricer, the
ExerciseDate
is a vector.
If you use a date character vector or date string, the format must
be recognizable by datetime
because
the ExerciseDate
property is stored as a
datetime.
Data Types: double
| char
| string
| datetime
Vanilla
Name-Value Pair Arguments'OptionType'
— Option type"call"
(default) | string with value "call"
or
"put"
| character vector with value 'call'
or
'put'
Option type, specified as the comma-separated pair consisting of
'OptionType'
and a scalar string or character vector.
Note
When you use a RollGeskeWhaley
pricer with a
Vanilla
option,
OptionType
must be
'call'
.
Data Types: char
| string
'ExerciseStyle'
— Option exercise style"European"
(default) | string with value "European"
,
"American"
, or "Bermudan"
| character vector with value 'European'
,
'American'
, or
'Bermudan'
Option exercise style, specified as the comma-separated pair
consisting of 'ExerciseStyle'
and a scalar string
or character vector.
Note
When you use a BlackScholes
pricer with a
Vanilla
option, the
'American'
option type is not
supported.
When you use a RollGeskeWhaley
or a BjerksundStensland
pricer with a
Vanilla
option, you must
specify an 'American'
option.
When you use a NumericalIntegration
pricer with a
Bates
, Merton
, or Heston
model for a
Vanilla
option, the
ExerciseStyle
must be
'European'
.
When you use a FFT
pricer with a Bates
, Merton
, or Heston
model for a
Vanilla
option, the
ExerciseStyle
must be
'European'
.
When you use an AssetMonteCarlo
pricer with a BlackScholes
, Bates
, Merton
, or Heston
model for a
Vanilla
option, the
ExerciseStyle
can be
'American'
,
'European'
, or
'Bermudan'
.
When you use a FiniteDifference
pricer with a BlackScholes
, Dupire
, Bates
, Merton
, or Heston
model for a
Vanilla
option, the
ExerciseStyle
can be
'American'
,
'European'
, or
'Bermudan'
.
For more information on
ExerciseStyle
, see Supported Exercise Styles.
Data Types: string
| char
'Name'
— User-defined name for instrument" "
(default) | string | character vectorUser-defined name for the instrument, specified as the
comma-separated pair consisting of 'Name'
and a
scalar string or character vector.
Data Types: char
| string
Strike
— Option strike price valueOption strike price value, returned as a scalar nonnegative numeric value.
Data Types: double
ExerciseDate
— Option exercise dateOption exercise date, returned as a datetime.
Data Types: datetime
OptionType
— Option type"call"
(default) | string with value "call"
or
"put"
Option type, returned as a string with a value of
"call"
or "put"
.
Data Types: string
ExerciseStyle
— Option type"European"
(default) | string with value "European"
,
"American"
, or "Bermudan"
Option exercise style, returned as a string with a value of
"European"
, "American"
, or
"Bermudan"
.
Data Types: string
Name
— User-defined name for instrument" "
(default) | stringUser-defined name for the instrument, returned as a string.
Data Types: string
setExercisePolicy | Set exercise policy for FixedBondOption ,
FloatBondOption , or Vanilla instrument |
This example shows the workflow to price a Vanilla
instrument when you use a BlackScholes
model and a BlackScholes
pricing method.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2018,5,1),'Strike',29,'OptionType',"put",'ExerciseStyle',"european",'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "put" ExerciseStyle: "european" ExerciseDate: 01-May-2018 Strike: 29 Name: "vanilla_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes",'Volatility',0.25)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2500 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,1,1); Maturity = datetime(2019,1,1); Rate = 0.05; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',1)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 1 Dates: 01-Jan-2019 Rates: 0.0500 Settle: 01-Jan-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create BlackScholes
Pricer Object
Use finpricer
to create a BlackScholes
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("analytic",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',30,'DividendValue',0.045)
outPricer = BlackScholes with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 30 DividendValue: 0.0450 DividendType: "continuous"
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(outPricer,VanillaOpt,["all"])
Price = 1.2046
outPR = priceresult with properties: Results: [1x7 table] PricerData: []
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Rho Theta
______ ________ ________ _______ ______ _______ _______
1.2046 -0.36943 0.086269 -9.3396 6.4702 -4.0959 -2.3107
This example shows the workflow to price an American option for a Vanilla
instrument when you use a BlackScholes
model and a RollGeskeWhaley
pricing method.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'Strike',105,'ExerciseDate',datetime(2022,9,15),'OptionType',"call",'ExerciseStyle',"american",'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "call" ExerciseStyle: "american" ExerciseDate: 15-Sep-2022 Strike: 105 Name: "vanilla_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes","Volatility",0.2)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2000 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create RollGeskeWhaley
Pricer Object
Use finpricer
to create a RollGeskeWhaley
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("analytic",'Model',BlackScholesModel,'DiscountCurve',myRC,'SpotPrice',100,'DividendValue',timetable(datetime(2021,6,15),0.25),'PricingMethod',"RollGeskeWhaley")
outPricer = RollGeskeWhaley with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 100 DividendValue: [1x1 timetable] DividendType: "cash"
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(outPricer,VanillaOpt,["all"])
Price = 19.9066
outPR = priceresult with properties: Results: [1x7 table] PricerData: []
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Theta Rho
______ _______ _________ ______ ______ _______ ______
19.907 0.66568 0.0090971 3.344 72.804 -3.4537 186.68
This example shows the workflow to price a Vanilla
instrument for foreign exchange (FX) when you use a BlackScholes
model and a BlackScholes
pricing method. Assume that the current exchange rate is $0.52 and has a volatility of 12% per annum. The annualized continuously compounded foreign risk-free rate is 8% per annum.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2022,9,15),'Strike',.50,'OptionType',"put",'ExerciseStyle',"european",'Name',"vanilla_fx_option")
VanillaOpt = Vanilla with properties: OptionType: "put" ExerciseStyle: "european" ExerciseDate: 15-Sep-2022 Strike: 0.5000 Name: "vanilla_fx_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
Sigma = .12; BlackScholesModel = finmodel("BlackScholes","Volatility",Sigma)
BlackScholesModel = BlackScholes with properties: Volatility: 0.1200 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create BlackScholes
Pricer Object
Use finpricer
to create a BlackScholes
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument. When pricing currencies using a Vanilla
instrument, the DividendType
must be 'continuous'
and DividendValue
is the annualized risk-free interest rate in the foreign country.
ForeignRate = 0.08; outPricer = finpricer("analytic",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',.52,'DividendType',"continuous",'DividendValue',ForeignRate)
outPricer = BlackScholes with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 0.5200 DividendValue: 0.0800 DividendType: "continuous"
Price Vanilla
FX Instrument
Use price
to compute the price and sensitivities for the Vanilla
FX instrument.
[Price, outPR] = price(outPricer,VanillaOpt,["all"])
Price = 0.0738
outPR = priceresult with properties: Results: [1x7 table] PricerData: []
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Vega Rho Theta
________ ________ ______ _______ _______ _______ _________
0.073778 -0.49349 2.0818 -4.7899 0.27021 -1.3216 -0.013019
This example shows the workflow to price an American option for a Vanilla
instrument when you use a BlackScholes
model and an AssetMonteCarlo
pricing method.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'Strike',105,'ExerciseDate',datetime(2022,9,15),'OptionType',"call",'ExerciseStyle',"american",'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "call" ExerciseStyle: "american" ExerciseDate: 15-Sep-2022 Strike: 105 Name: "vanilla_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes","Volatility",0.2)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2000 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",BlackScholesModel,'SpotPrice',150,'simulationDates',datetime(2022,9,15))
outPricer = GBMMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 150 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.BlackScholes] DividendType: "continuous" DividendValue: 0
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(outPricer,VanillaOpt,["all"])
Price = 61.2010
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Rho Theta Vega
______ _______ _________ ______ ______ _______ ______
61.201 0.93074 0.0027813 2.2812 313.95 -3.7909 41.626
This example shows the workflow to price an American option for a Vanilla
instrument when you use a Heston
model and an AssetMonteCarlo
pricing method.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'Strike',105,'ExerciseDate',datetime(2022,9,15),'OptionType',"call",'ExerciseStyle',"american",'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "call" ExerciseStyle: "american" ExerciseDate: 15-Sep-2022 Strike: 105 Name: "vanilla_option"
Create Heston
Model Object
Use finmodel
to create a Heston
model object.
HestonModel = finmodel("Heston",'V0',0.032,'ThetaV',0.07,'Kappa',0.003,'SigmaV',0.02,'RhoSV',0.09)
HestonModel = Heston with properties: V0: 0.0320 ThetaV: 0.0700 Kappa: 0.0030 SigmaV: 0.0200 RhoSV: 0.0900
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create AssetMonteCarlo
Pricer Object
Use finpricer
to create an AssetMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("AssetMonteCarlo",'DiscountCurve',myRC,"Model",HestonModel,'SpotPrice',150,'simulationDates',datetime(2022,9,15))
outPricer = HestonMonteCarlo with properties: DiscountCurve: [1x1 ratecurve] SpotPrice: 150 SimulationDates: 15-Sep-2022 NumTrials: 1000 RandomNumbers: [] Model: [1x1 finmodel.Heston] DividendType: "continuous" DividendValue: 0
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(outPricer,VanillaOpt,["all"])
Price = 60.5637
outPR = priceresult with properties: Results: [1x8 table] PricerData: [1x1 struct]
outPR.Results
ans=1×8 table
Price Delta Gamma Lambda Rho Theta Vega VegaLT
______ _______ _________ ______ ______ _______ ______ _______
60.564 0.94774 0.0011954 2.3473 326.36 -3.7126 35.272 0.31155
This example shows the workflow to price a Bermudan option for a Vanilla
instrument when you use a BlackScholes
model and a FiniteDifference
pricing method.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'Strike',[110,120],'ExerciseDate',[datetime(2022,9,15) ; datetime(2023,9,15)],'OptionType',"call",'ExerciseStyle',"Bermudan",'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "call" ExerciseStyle: "bermudan" ExerciseDate: [15-Sep-2022 15-Sep-2023] Strike: [110 120] Name: "vanilla_option"
Create BlackScholes
Model Object
Use finmodel
to create a BlackScholes
model object.
BlackScholesModel = finmodel("BlackScholes","Volatility",0.2)
BlackScholesModel = BlackScholes with properties: Volatility: 0.2000 Correlation: 1
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
Settle = datetime(2018,9,15); Maturity = datetime(2023,9,15); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',12)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 12 Dates: 15-Sep-2023 Rates: 0.0350 Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create FiniteDifference
Pricer Object
Use finpricer
to create a FiniteDifference
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("FiniteDifference",'Model',BlackScholesModel,'DiscountCurve',myRC,'SpotPrice',100)
outPricer = FiniteDifference with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.BlackScholes] SpotPrice: 100 GridProperties: [1x1 struct] DividendType: "continuous" DividendValue: 0
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(outPricer,VanillaOpt,["all"])
Price = 17.3930
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Lambda Theta Rho Vega
______ _______ ________ ______ _______ ______ ______
17.393 0.58203 0.008905 3.3463 -3.1757 203.94 87.324
This example shows the workflow to price a Vanilla
instrument when you use a Heston
model and various pricing methods.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
Settle = datetime(2017,6,29); Maturity = datemnth(Settle,6); Strike = 80; VanillaOpt = fininstrument('Vanilla','ExerciseDate',Maturity,'Strike',Strike,'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "call" ExerciseStyle: "european" ExerciseDate: 29-Dec-2017 Strike: 80 Name: "vanilla_option"
Create Heston
Model Object
Use finmodel
to create a Heston
model object.
V0 = 0.04; ThetaV = 0.05; Kappa = 1.0; SigmaV = 0.2; RhoSV = -0.7; HestonModel = finmodel("Heston",'V0',V0,'ThetaV',ThetaV,'Kappa',Kappa,'SigmaV',SigmaV,'RhoSV',RhoSV)
HestonModel = Heston with properties: V0: 0.0400 ThetaV: 0.0500 Kappa: 1 SigmaV: 0.2000 RhoSV: -0.7000
Create ratecurve
object
Create a ratecurve
object using ratecurve
.
Rate = 0.03;
ZeroCurve = ratecurve('zero',Settle,Maturity,Rate);
Create NumericalIntegration
, FFT
, and FiniteDifference
Pricer Objects
Use finpricer
to create a NumericalIntegration
, FFT
, and FiniteDifference
pricer objects and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
SpotPrice = 80; Strike = 80; DividendYield = 0.02; NIPricer = finpricer("NumericalIntegration",'Model', HestonModel,'SpotPrice',SpotPrice,'DiscountCurve',ZeroCurve,'DividendValue',DividendYield)
NIPricer = NumericalIntegration with properties: Model: [1x1 finmodel.Heston] DiscountCurve: [1x1 ratecurve] SpotPrice: 80 DividendType: "continuous" DividendValue: 0.0200 AbsTol: 1.0000e-10 RelTol: 1.0000e-10 IntegrationRange: [1.0000e-09 Inf] CharacteristicFcn: @characteristicFcnHeston Framework: "heston1993" VolRiskPremium: 0 LittleTrap: 1
FFTPricer = finpricer("FFT",'Model',HestonModel, ... 'SpotPrice',SpotPrice,'DiscountCurve',ZeroCurve, ... 'DividendValue',DividendYield,'NumFFT',8192)
FFTPricer = FFT with properties: Model: [1x1 finmodel.Heston] DiscountCurve: [1x1 ratecurve] SpotPrice: 80 DividendType: "continuous" DividendValue: 0.0200 NumFFT: 8192 CharacteristicFcnStep: 0.0100 LogStrikeStep: 0.0767 CharacteristicFcn: @characteristicFcnHeston DampingFactor: 1.5000 Quadrature: "simpson" VolRiskPremium: 0 LittleTrap: 1
FDPricer = finpricer("FiniteDifference",'Model',HestonModel,'SpotPrice',SpotPrice,'DiscountCurve',ZeroCurve,'DividendValue',DividendYield)
FDPricer = FiniteDifference with properties: DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel.Heston] SpotPrice: 80 GridProperties: [1x1 struct] DividendType: "continuous" DividendValue: 0.0200
Price Vanilla
Instrument
Use the following sensitivities when pricing the Vanilla
instrument.
InpSensitivity = ["delta", "gamma", "theta", "rho", "vega", "vegalt"];
Use price
to compute the price and sensitivities for the Vanilla
instrument that uses the NumericalIntegration
pricer.
[PriceNI, outPR_NI] = price(NIPricer,VanillaOpt,InpSensitivity)
PriceNI = 4.7007
outPR_NI = priceresult with properties: Results: [1x7 table] PricerData: []
Use price
to compute the price and sensitivities for the Vanilla
instrument that uses the FFT
pricer.
[PriceFFT, outPR_FFT] = price(FFTPricer,VanillaOpt,InpSensitivity)
PriceFFT = 4.7007
outPR_FFT = priceresult with properties: Results: [1x7 table] PricerData: []
Use price
to compute the price and sensitivities for the Vanilla
instrument that uses the FiniteDifference
pricer.
[PriceFD, outPR_FD] = price(FDPricer,VanillaOpt,InpSensitivity)
PriceFD = 4.7003
outPR_FD = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
Aggregate the price results.
[outPR_NI.Results;outPR_FFT.Results;outPR_FD.Results]
ans=3×7 table
Price Delta Gamma Theta Rho Vega VegaLT
______ _______ ________ _______ ______ ______ ______
4.7007 0.57747 0.03392 -4.8474 20.805 17.028 5.2394
4.7007 0.57747 0.03392 -4.8474 20.805 17.028 5.2394
4.7003 0.57722 0.035254 -4.8483 20.801 17.046 5.2422
Compute Option Price Surfaces
Use the price
function for the NumericalIntegration
pricer and the price
function for the FFT
pricer to compute the prices for a range of Vanilla
instruments.
Maturities = datemnth(Settle,(3:3:24)'); NumMaturities = length(Maturities); Strikes = (20:10:160)'; NumStrikes = length(Strikes); [Maturities_Full,Strikes_Full] = meshgrid(Maturities,Strikes); NumInst = numel(Strikes_Full); VanillaOptions(NumInst, 1) = fininstrument("vanilla",... "ExerciseDate", Maturities_Full(1), "Strike", Strikes_Full(1)); for instidx=1:NumInst VanillaOptions(instidx) = fininstrument("vanilla",... "ExerciseDate", Maturities_Full(instidx), "Strike", Strikes_Full(instidx)); end Prices_NI = price(NIPricer, VanillaOptions); Prices_FFT = price(FFTPricer, VanillaOptions); figure; surf(Maturities_Full,Strikes_Full,reshape(Prices_NI,[NumStrikes,NumMaturities])); title('Price (Numerical Integration)'); view(-112,34); xlabel('Maturity') ylabel('Strike')
figure; surf(Maturities_Full,Strikes_Full,reshape(Prices_FFT,[NumStrikes,NumMaturities])); title('Price (FFT)'); view(-112,34); xlabel('Maturity') ylabel('Strike')
A vanilla option is a category of options that includes only the most standard components.
A vanilla option has an expiration date and straightforward strike price. American-style options and European-style options are both categorized as vanilla options.
The payoff for a vanilla option is as follows:
For a call:
For a put:
where:
St is the price of the underlying asset at time t.
K is the strike price.
For more information, see Vanilla Option.
After creating a Vanilla
instrument object, you can use setExercisePolicy
to
change the size of the options. For example, if you have the following
instrument:
VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2021,5,1),'Strike',29,'OptionType',"put",'ExerciseStyle',"European")
Vanilla
instrument's size by changing the
ExerciseStyle
from "European"
to
"American"
, use setExercisePolicy
:VanillaOpt = setExercisePolicy(VanillaOpt,[datetime(2021,1,1) datetime(2022,1,1)],100,'American')
Existe una versión modificada de este ejemplo en su sistema. ¿Prefiere abrir esta versión?
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.
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: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.