price
Syntax
Description
[
computes the equity 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 in addition to the required arguments
in the previous syntax.Price
,PriceResult
] = price(___,inpSensitivity
)
Examples
Use AssetTree
Pricer and BlackScholes
Model to Price Vanilla
Instrument
This example shows the workflow to price a Vanilla
instrument when you use a BlackScholes
model and an AssetTree
pricing method.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2019,5,1),'Strike',29,'OptionType',"put",'ExerciseStyle',"european",'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "put" ExerciseStyle: "european" ExerciseDate: 01-May-2019 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(2020,1,1); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',1)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 1 Dates: 01-Jan-2020 Rates: 0.0350 Settle: 01-Jan-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create AssetTree
Pricer Object
Use finpricer
to create an AssetTree
pricer object for an LR equity tree and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
LRPricer = finpricer("AssetTree",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',30,'PricingMethod',"LeisenReimer",'Maturity',datetime(2019,5,1),'NumPeriods',15)
LRPricer = LRTree with properties: InversionMethod: PP1 Strike: 30 Tree: [1x1 struct] NumPeriods: 15 Model: [1x1 finmodel.BlackScholes] DiscountCurve: [1x1 ratecurve] SpotPrice: 30 DividendType: "continuous" DividendValue: 0 TreeDates: [02-Feb-2018 08:00:00 06-Mar-2018 16:00:00 08-Apr-2018 00:00:00 10-May-2018 08:00:00 11-Jun-2018 16:00:00 14-Jul-2018 00:00:00 15-Aug-2018 08:00:00 16-Sep-2018 16:00:00 ... ] (1x15 datetime)
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(LRPricer,VanillaOpt,"all")
Price = 2.2542
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Vega Lambda Rho Theta
______ ________ ________ ______ ______ _______ ________
2.2542 -0.33628 0.044039 12.724 -4.469 -16.433 -0.76073
Use AssetTree
Pricer and BlackScholes
Model to Price Vanilla
Instrument
This example shows the workflow to price a Vanilla
instrument when you use a BlackScholes
model and an AssetTree
pricing method for a Standard Trinomial (STT) tree.
Create Vanilla
Instrument Object
Use fininstrument
to create a Vanilla
instrument object.
VanillaOpt = fininstrument("Vanilla",'ExerciseDate',datetime(2019,5,1),'Strike',29,'OptionType',"put",'ExerciseStyle',"european",'Name',"vanilla_option")
VanillaOpt = Vanilla with properties: OptionType: "put" ExerciseStyle: "european" ExerciseDate: 01-May-2019 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(2020,1,1); Rate = 0.035; myRC = ratecurve('zero',Settle,Maturity,Rate,'Basis',1)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 1 Dates: 01-Jan-2020 Rates: 0.0350 Settle: 01-Jan-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create AssetTree
Pricer Object
Use finpricer
to create an AssetTree
pricer object for an Standard Trinomial equity tree and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
STTPricer = finpricer("AssetTree",'DiscountCurve',myRC,'Model',BlackScholesModel,'SpotPrice',30,'PricingMethod',"StandardTrinomial",'Maturity',datetime(2019,5,1),'NumPeriods',15)
STTPricer = STTree with properties: Tree: [1x1 struct] NumPeriods: 15 Model: [1x1 finmodel.BlackScholes] DiscountCurve: [1x1 ratecurve] SpotPrice: 30 DividendType: "continuous" DividendValue: 0 TreeDates: [02-Feb-2018 08:00:00 06-Mar-2018 16:00:00 08-Apr-2018 00:00:00 10-May-2018 08:00:00 11-Jun-2018 16:00:00 14-Jul-2018 00:00:00 15-Aug-2018 08:00:00 16-Sep-2018 16:00:00 ... ] (1x15 datetime)
Price Vanilla
Instrument
Use price
to compute the price and sensitivities for the Vanilla
instrument.
[Price, outPR] = price(STTPricer,VanillaOpt,"all")
Price = 2.2826
outPR = priceresult with properties: Results: [1x7 table] PricerData: [1x1 struct]
outPR.Results
ans=1×7 table
Price Delta Gamma Vega Lambda Rho Theta
______ _______ ________ _____ _______ _______ ________
2.2826 -0.2592 0.030949 12.51 -3.8981 -16.516 -0.73845
Input Arguments
inpInstrument
— Instrument object
Vanilla
object | Barrier
object | Asian
object | Lookback
object
Instrument object, specified as a scalar or vector of previously created instrument
objects. Create the instrument objects using fininstrument
. The following
instrument objects are supported:
Data Types: object
inpSensitivity
— List of sensitivities to compute
[ ]
(default) | string array with values "Price"
, "Delta"
,
"Gamma"
, "Vega"
, "Theta"
,
"Rho"
, "Lambda"
, and
"All"
| cell array of character vectors with values 'Price'
,
'Delta'
, 'Gamma'
, 'Vega'
,
'Theta'
, 'Rho'
, 'Lambda'
, and
'All'
(Optional) List of sensitivities to compute, specified as an
NOUT
-by-1
or a
1
-by-NOUT
cell array of character vectors or
string array with possible values of 'Price'
,
'Delta'
, 'Gamma'
, 'Vega'
,
'Theta'
, 'Rho'
, 'Lambda'
, and
'All'
.
inpSensitivity = {'All'}
or inpSensitivity =
["All"]
specifies that the output is 'Delta'
,
'Gamma'
, 'Vega'
, 'Theta'
,
'Rho'
, 'Lambda'
, and 'Price'
.
Using this syntax is the same as specifying inpSensitivity
to include
each sensitivity.
inpInstrument | Supported Sensitivities |
---|---|
Asian | {'delta','gamma','vega','theta','rho','lambda','price'} |
Barrier | {'delta','gamma','vega','theta','rho','lambda','price'} |
Lookback | {'delta','gamma','vega','theta','rho','lambda','price'} |
Vanilla | {'delta','gamma','vega','theta','rho','lambda','price'} |
Note
Sensitivities are calculated based on yield shifts of 1 basis point, where the ShiftValue = 1/10000. All sensitivities are returned as dollar sensitivities. To find the per-dollar sensitivities, divide the sensitivities by their respective instrument price.
Example: inpSensitivity =
{'delta','gamma','vega','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 a 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 that depends on the instrument that is being pricedAsian
andLookback
have an empty ([]
)PricerData
field because the pricing functions for these instruments cannot unambiguously assign a price to any node but the root node.Vanilla
andBarrier
have the following shared fields forPriceResult.PricerData.PriceTree
:PTree
contains the clean prices.ExTree
contains the exercise indicator arrays. Each element of the cell array is an array where1
indicates that an option is exercised and0
indicates that an option is not exercised.dObs
contains the date of each level of the tree.tObs
contains the observation times.Probs
contains the probability arrays. Each element of the cell array contains the up, middle, and down transition probabilities for each node of the level.
More About
Delta
A delta sensitivity measures the rate at which the price of an option is expected to change relative to a $1 change in the price of the underlying asset.
Delta is not a static measure; it changes as the price of the underlying asset changes (a concept known as gamma sensitivity), and as time passes. Options that are near the money or have longer until expiration are more sensitive to changes in delta.
Gamma
A gamma sensitivity measures the rate of change of an option's delta in response to a change in the price of the underlying asset.
In other words, while delta tells you how much the price of an option might move, gamma tells you how fast the option's delta itself will change as the price of the underlying asset moves. This is important because this helps you understand the convexity of an option's value in relation to the underlying asset's price.
Vega
A vega sensitivity measures the sensitivity of an option's price to changes in the volatility of the underlying asset.
Vega represents the amount by which the price of an option would be expected to change for a 1% change in the implied volatility of the underlying asset. Vega is expressed as the amount of money per underlying share that the option's value will gain or lose as volatility rises or falls.
Theta
A theta sensitivity measures the rate at which the price of an option decreases as time passes, all else being equal.
Theta is essentially a quantification of time decay, which is a key concept in options pricing. Theta provides an estimate of the dollar amount that an option's price would decrease each day, assuming no movement in the price of the underlying asset and no change in volatility.
Rho
A rho sensitivity measures the rate at which the price of an option is expected to change in response to a change in the risk-free interest rate.
Rho is expressed as the amount of money an option's price would gain or lose for a one percentage point (1%) change in the risk-free interest rate.
Lambda
A lambda sensitivity measures the percentage change in an option's price for a 1% change in the price of the underlying asset.
Lambda is a measure of leverage, indicating how much more sensitive an option is to price movements in the underlying asset compared to owning the asset outright.
Version History
Introduced in R2021a
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi 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)