price
Syntax
Description
[
computes the interest-rate 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. Use this syntax with the input
argument combination in the previous syntax.Price
,PriceResult
] = price(___,inpSensitivity
)
Examples
This example shows the workflow to price a FixedBond
instrument when using a HullWhite
model and an IRMonteCarlo
pricing method.
Create FixedBond
Instrument Object
Use fininstrument
to create a FixedBond
instrument object.
FixB = fininstrument("FixedBond","Maturity",datetime(2022,9,15),"CouponRate",0.05,'Name',"fixed_bond")
FixB = FixedBond with properties: CouponRate: 0.0500 Period: 2 Basis: 0 EndMonthRule: 1 Principal: 100 DaycountAdjustedCashFlow: 0 BusinessDayConvention: "actual" Holidays: NaT IssueDate: NaT FirstCouponDate: NaT LastCouponDate: NaT StartDate: NaT Maturity: 15-Sep-2022 Name: "fixed_bond"
Create HullWhite
Model Object
Use finmodel
to create a HullWhite
model object.
HullWhiteModel = finmodel("HullWhite",'Alpha',0.32,'Sigma',0.49)
HullWhiteModel = HullWhite with properties: Alpha: 0.3200 Sigma: 0.4900
Create ratecurve
Object
Create a ratecurve
object using ratecurve
.
Settle = datetime(2019,1,1); Type = 'zero'; ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]'; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]'; ZeroDates = Settle + ZeroTimes; myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: [10×1 datetime] Rates: [10×1 double] Settle: 01-Jan-2019 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create IRMonteCarlo
Pricer Object
Use finpricer
to create an IRMonteCarlo
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("IRMonteCarlo",'Model',HullWhiteModel,'DiscountCurve',myRC,'SimulationDates',ZeroDates)
outPricer = HWMonteCarlo with properties: NumTrials: 1000 RandomNumbers: [] DiscountCurve: [1×1 ratecurve] SimulationDates: [01-Jul-2019 01-Jan-2020 01-Jan-2021 01-Jan-2022 01-Jan-2023 01-Jan-2024 01-Jan-2026 01-Jan-2029 01-Jan-2039 01-Jan-2049] Model: [1×1 finmodel.HullWhite]
Price FixedBond
Instrument
Use price
to compute the price and sensitivities for the FixedBond
instrument.
[Price,outPR] = price(outPricer,FixB,["all"])
Price = 115.0303
outPR = priceresult with properties: Results: [1×4 table] PricerData: [1×1 struct]
outPR.Results
ans=1×4 table
Price Delta Gamma Vega
______ _______ ______ ____
115.03 -397.13 1430.4 0
Input Arguments
Pricer object, specified as a previously created IRMonteCarlo
pricer
object. Create the pricer object using finpricer
.
Data Types: object
Instrument object, specified as scalar or a vector of previously created instrument
objects. Create the instrument objects using fininstrument
. The following
instrument objects are supported:
Data Types: object
(Optional) List of sensitivities to compute, specified as an
NOUT
-by-1
or
1
-by-NOUT
cell array of character vectors or
string array.
The supported sensitivities depend on the pricing method.
inpInstrument | Supported Sensitivities |
---|---|
Cap | {'delta','gamma','vega','price'}
('vega' not supported when using SABRBraceGatarekMusiela model with the IRMonteCarlo
pricer.) |
Floor | {'delta','gamma','vega','price'}
('vega' not supported when using SABRBraceGatarekMusiela model with the IRMonteCarlo
pricer.) |
Swap | {'delta','gamma','vega','price'} |
Swaption | {'delta','gamma','vega','price'} |
FixedBond | {'delta','gamma','vega','price'}
('vega' not supported when using SABRBraceGatarekMusiela model with the IRMonteCarlo
pricer.) |
OptionEmbeddedFixedBond | {'delta','gamma','vega','price'}
('vega' not supported when using SABRBraceGatarekMusiela model with the IRMonteCarlo
pricer.) |
FixedBondOption | {'delta','gamma','vega','price'}
('vega' not supported when using SABRBraceGatarekMusiela model with the IRMonteCarlo
pricer.) |
FloatBond | {'delta','gamma','vega','price'}
('vega' not supported when using SABRBraceGatarekMusiela model with the IRMonteCarlo
pricer.) |
FloatBondOption | {'delta','gamma','vega','price'}
('vega' not supported when using SABRBraceGatarekMusiela model with the IRMonteCarlo
pricer.) |
OptionEmbeddedFloatBond | {'delta','gamma','vega','price'}
('vega' not supported when using SABRBraceGatarekMusiela model with the IRMonteCarlo
pricer.) |
inpSensitivity = 'All'
or inpSensitivity =
"All"
specifies that all sensitivities for the pricing method are returned.
This is the same as specifying inpSensitivity
to include each
sensitivity.
Example: inpSensitivity =
["delta","gamma","vega","price"]
Data Types: cell
| string
Output Arguments
Instrument price, returned as a numeric.
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
More About
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.
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.
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.
Version History
Introduced in R2021b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)