price
Compute price for equity instrument with NumericalIntegration
pricer
Since R2020a
Syntax
Description
[
computes the instrument price and related pricing information based on the pricing object
Price
,PriceResult
] = price(inpPricer
,inpInstrument
)inpPricer
and the instrument object
inpInstrument
.
[
adds an optional argument to specify sensitivities.Price
,PriceResult
] = price(___,inpSensitivity
)
Examples
Use Numerical Integration Pricer and Merton Model to Price Vanilla Instrument
This example shows the workflow to price a Vanilla
instrument when you use a Merton
model and a NumericalIntegration
pricing method.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2020,3,15),'ExerciseStyle',"european",'Strike',105,'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "call" ExerciseStyle: "european" ExerciseDate: 15-Mar-2020 Strike: 105 Name: "vanilla_option"
Create Merton
Model Object
Use finmodel
to create a Merton
model object.
MertonModel = finmodel("Merton",'Volatility',0.45,'MeanJ',0.02,'JumpVol',0.07,'JumpFreq',0.09)
MertonModel = Merton with properties: Volatility: 0.4500 MeanJ: 0.0200 JumpVol: 0.0700 JumpFreq: 0.0900
Create ratecurve
Object
Create a flat ratecurve
object using ratecurve
.
myRC = ratecurve('zero',datetime(2019,9,15),datetime(2020,3,15),0.02)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: 15-Mar-2020 Rates: 0.0200 Settle: 15-Sep-2019 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create NumericalIntegration
Pricer Object
Use finpricer
to create a NumericalIntegration
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("numericalintegration",'Model',MertonModel,'DiscountCurve',myRC,'SpotPrice',100,'DividendValue',.01,'VolRiskPremium',0.9,'LittleTrap',false,'AbsTol',0.5,'RelTol',0.4,'Framework',"lewis2001")
outPricer = NumericalIntegration with properties: Model: [1x1 finmodel.Merton] DiscountCurve: [1x1 ratecurve] SpotPrice: 100 DividendType: "continuous" DividendValue: 0.0100 AbsTol: 0.5000 RelTol: 0.4000 IntegrationRange: [1.0000e-09 Inf] CharacteristicFcn: @characteristicFcnMerton76 Framework: "lewis2001" VolRiskPremium: 0.9000 LittleTrap: 0
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(outPricer,VanillaOpt,["all"])
Price = 10.7325
outPR = priceresult with properties: Results: [1x6 table] PricerData: []
outPR.Results
ans=1×6 table
Price Delta Gamma Theta Rho Vega
______ ______ ________ _______ ______ ______
10.732 0.5058 0.012492 -12.969 19.815 27.954
Input Arguments
inpPricer
— Pricer object
NumericalIntegration
object
Pricer object, specified as a scalar NumericalIntegration
pricer object. Use finpricer
to create the NumericalIntegration
pricer object.
Data Types: object
inpInstrument
— Instrument object
Vanilla
object
Instrument object, specified as a scalar or vector of Vanilla
instrument objects.
Use fininstrument
to create
Vanilla
instrument
objects.
Data Types: object
inpSensitivity
— List of sensitivities to compute
[ ]
(default) | string array with values "Price"
, "Delta"
,
"Gamma"
, "Vega"
, "Rho"
,
"Theta"
, "Vegalt"
, and
"All"
| cell array of character vectors with values 'Price'
,
'Delta'
, 'Gamma'
, 'Vega'
,
'Rho'
, 'Theta'
, 'Vegalt'
, and
'All'
(Optional) List of sensitivities to compute, specified as a
NOUT
-by-1
or a
1
-by-NOUT
cell array of character vectors or
string array with possible values of 'Price'
,
'Delta'
, 'Gamma'
, 'Vega'
,
'Rho'
, 'Theta'
, 'Vegalt'
, and
'All'
.
inpSensitivity = {'All'}
or inpSensitivity =
["All"]
specifies that the output is 'Delta'
,
'Gamma'
, 'Vega'
, 'Rho'
,
'Theta'
, 'Vegalt'
, and
'Price'
. This is the same as specifying
inpSensitivity
to include each sensitivity.
Example: inpSensitivity =
{'delta','gamma','vega','rho','theta','vegalt','price'}
Data Types: string
| cell
Output Arguments
Price
— Instrument price
numeric
Instrument price, returned as a numeric.
PriceResult
— Price result
PriceResult
object
Price result, returned as an object. The PriceResult
object. The
object has the following fields:
PriceResult.Results
— Table of results that includes sensitivities (if you specifyinpSensitivity
)PriceResult.PricerData
— Structure for pricer data
Version History
Introduced in R2020a
Beispiel öffnen
Sie haben eine geänderte Version dieses Beispiels. Möchten Sie dieses Beispiel mit Ihren Änderungen öffnen?
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)