Cap
Cap instrument object
Description
Create and price a Cap instrument object for one or more
Cap instruments using this workflow:
Use
fininstrumentto create aCapinstrument object for one or more Cap instruments.Use
finmodelto specify aHullWhite,BlackKarasinski,BlackDermanToy,Black,Normal,BraceGatarekMusiela,SABRBraceGatarekMusiela,CoxIngersollRoss, orLinearGaussian2Fmodel for theCapinstrument object.Choose a pricing method.
When using a
HullWhite,BlackKarasinski,BlackDermanToy,Black,CoxIngersollRoss, orNormalmodel, usefinpricerfor pricing one or moreCapinstruments and specify:When using a
HullWhite,BlackKarasinski,BraceGatarekMusiela,SABRBraceGatarekMusiela, orLinearGaussian2Fmodel, usefinpricerto specify anIRMonteCarlopricing method for one or moreCapinstruments.
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
Cap instrument, see Choose Instruments, Models, and Pricers.
Creation
Syntax
Description
creates a CapOpt = fininstrument(InstrumentType,'Strike',strike_value,'Maturity',maturity_date)Cap object for one or more Cap instruments by
specifying InstrumentType and sets the properties for the required
name-value pair arguments Strike and
Maturity.
The Cap instrument supports vanilla and amortizing
caps.
sets optional properties using additional
name-value pairs in addition to the required arguments in the previous
syntax. For example, CapOpt = fininstrument(___,Name,Value)CapOpt =
fininstrument("Cap",'Strike',0.65,'Maturity',datetime(2019,1,30),'Reset',4,'Principal',100,'ResetOffset',1,'Basis',1,'DaycountAdjustedCashFlow',true,'BusinessDayConvention',"follow",'ProjectionCurve',ratecurve_object,'Name',"cap_option")
creates a Cap option with a strike of 0.65. You can
specify multiple name-value pair arguments.
Input Arguments
Instrument type, specified as a string with the value of
"Cap", a character vector with the value of
'Cap', an
NINST-by-1 string array with
values of "Cap", or an
NINST-by-1 cell array of
character vectors with values of 'Cap'.
Data Types: char | cell | string
Name-Value Arguments
Specify required
and optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where
Name is the argument name and Value is
the corresponding value. Name-value arguments must appear after other arguments,
but the order of the pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name in quotes.
Example: CapOpt =
fininstrument("Cap",'Strike',0.65,'Maturity',datetime(2019,1,30),'Reset',4,'Principal',100,'ResetOffset',1,'Basis',1,'DaycountAdjustedCashFlow',true,'BusinessDayConvention',"follow",'ProjectionCurve',ratecurve_object,'Name',"cap_option")
Required Cap Name-Value Pair Arguments
Cap strike price, specified as the comma-separated pair consisting
of 'Strike' and a scalar nonnegative decimal
value or an NINST-by-1
nonnegative numeric vector.
Data Types: double
Cap maturity date, specified as the comma-separated pair
consisting of 'ExerciseDate' and a scalar or an
NINST-by-1 vector using a
datetime array, string array, or date character vectors.
To support existing code, Cap also
accepts serial date numbers as inputs, but they are not recommended.
If you use date character vectors or strings, the format must be
recognizable by datetime because
the Maturity property is stored as a
datetime.
Optional Cap Name-Value Pair Arguments
Reset frequency payments per year, specified as the
comma-separated pair consisting of 'Reset' and a
scalar numeric or an
NINST-by-1 numeric
vector.
Data Types: double
Day count basis, specified as the comma-separated pair consisting
of 'Basis' and a scalar integer or an
NINST-by-1 vector of
integers with the following values:
0 — actual/actual
1 — 30/360 (SIA)
2 — actual/360
3 — actual/365
4 — 30/360 (PSA)
5 — 30/360 (ISDA)
6 — 30/360 (European)
7 — actual/365 (Japanese)
8 — actual/actual (ICMA)
9 — actual/360 (ICMA)
10 — actual/365 (ICMA)
11 — 30/360E (ICMA)
12 — actual/365 (ISDA)
13 — BUS/252
For more information, see Basis.
Data Types: double
Principal amount or principal value schedule, specified as the
comma-separated pair consisting of 'Principal'
and a scalar numeric or an
NINST-by-1 numeric vector
or a timetable.
Principal accepts a timetable, where the
first column is dates and the second column is its associated
principal value. The date indicates the last day that the principal
value is valid.
Note
If you are creating one or more Cap
instruments and use a timetable, the timetable specification
applies to all of the Cap instruments.
Principal does not accept an
NINST-by-1 cell array
of timetables as input.
Data Types: double | timetable
Lag in rate setting, specified as the comma-separated pair
consisting of 'ResetOffset' and a scalar numeric
or an NINST-by-1 numeric
vector.
Data Types: double
Flag to adjust cash flows based on the actual period day count,
specified as the comma-separated pair consisting of
'DaycountAdjustedCashFlow' and a scalar or an
NINST-by-1 vector with
values of true or
false.
Data Types: logical
Business day conventions, specified as the comma-separated pair
consisting of 'BusinessDayConvention' and a
scalar string or character vector or an
NINST-by-1 cell array of
character vectors or string array for a business day convention. The
selection for business day convention determines how nonbusiness
days are treated. Nonbusiness days are defined as weekends plus any
other date that businesses are not open (for example, statutory
holidays). Values are:
"actual"— Nonbusiness days are effectively ignored. Cash flows that fall on non-business days are assumed to be distributed on the actual date."follow"— Cash flows that fall on a nonbusiness day are assumed to be distributed on the following business day."modifiedfollow"— Cash flows that fall on a nonbusiness day are assumed to be distributed on the following business day. However, if the following business day is in a different month, the previous business day is adopted instead."previous"— Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day."modifiedprevious"— Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day. However, if the previous business day is in a different month, the following business day is adopted instead.
Data Types: char | cell | string
Holidays used in computing business days, specified as the
comma-separated pair consisting of 'Holidays' and
dates using an NINST-by-1
vector of a datetime array, string array, or date character vectors.
For
example:
H = holidays(datetime('today'),datetime(2025,12,15)); CapOpt = fininstrument("Cap",'Strike',100,'Maturity',datetime(2025,12,15),'Holidays',H)
To support existing code, Cap also
accepts serial date numbers as inputs, but they are not recommended.
Rate curve used in projecting the future cash flows, specified as
the comma-separated pair consisting of
'ProjectionCurve' and a scalar
ratecurve object or an
NINST-by-1 vector of
ratecurve objects. These objects must be
created using ratecurve. Use
this optional input if the forward curve is different from the
discount curve.
Data Types: object
User-defined name for one of more instruments, specified as the
comma-separated pair consisting of 'Name' and a
scalar string or character vector or an
NINST-by-1 cell array of
character vectors or string array.
Data Types: char | cell | string
Output Arguments
Cap instrument, returned as a Cap object.
Properties
Option strike price value, returned as a scalar nonnegative value or an
NINST-by-1 vector of nonnegative
values.
Data Types: double
Cap maturity date, returned as a scalar datetime or an
NINST-by-1 vector of
datetimes.
Data Types: datetime
Reset frequency payments per year, returned as a scalar numeric or an
NINST-by-1 numeric vector.
Data Types: double
Day count basis, returned as a scalar integer or an
NINST-by-1 vector of
integers.
Data Types: double
Principal amount or principal value schedule, returned as a scalar numeric
or an NINST-by-1 numeric vector for
principal amounts or a timetable for a principal value schedule.
Data Types: double | timetable
Lag in rate setting, returned as a scalar numeric or an
NINST-by-1 numeric vector.
Data Types: double
Flag to adjust cash flows based on the actual period day count, returned
as a scalar logical or an NINST-by-1
vector with values of true or
false.
Data Types: logical
Business day conventions, returned as a scalar string or an
NINST-by-1 string array.
Data Types: string
Holidays used in computing business days, returned as an
NINST-by-1 vector of
datetimes.
Data Types: datetime
Rate curve used in projecting the future cash flows, returned as a scalar
ratecurve object or an
NINST-by-1 vector of
ratecurve objects.
Data Types: object
User-defined name for the instrument, returned as a scalar string or an
NINST-by-1 string array.
Data Types: string
Examples
This example shows the workflow to price a vanilla Cap instrument when using a HullWhite model and a HullWhite pricing method.
Create Cap Instrument Object
Use fininstrument to create a Cap instrument object.
CapOpt = fininstrument("Cap",'Strike',0.02,'Maturity',datetime(2019,1,30),'Reset',4,'Principal',100,'Basis',8,'Name',"cap_option")
CapOpt =
Cap with properties:
Strike: 0.0200
Maturity: 30-Jan-2019
ResetOffset: 0
Reset: 4
Basis: 8
Principal: 100
ProjectionCurve: [0×0 ratecurve]
DaycountAdjustedCashFlow: 0
BusinessDayConvention: "actual"
Holidays: NaT
Name: "cap_option"
Create HullWhite Model Object
Use finmodel to create a HullWhite model object.
HullWhiteModel = finmodel("HullWhite",'Alpha',0.62,'Sigma',0.99)
HullWhiteModel =
HullWhite with properties:
Alpha: 0.6200
Sigma: 0.9900
Create ratecurve Object
Create a ratecurve object using ratecurve.
Settle = datetime(2018,9,15); 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: 15-Sep-2018
InterpMethod: "linear"
ShortExtrapMethod: "next"
LongExtrapMethod: "previous"
Create HullWhite Pricer Object
Use finpricer to create a HullWhite pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.
outPricer = finpricer("analytic",'Model',HullWhiteModel,'DiscountCurve',myRC)
outPricer =
HullWhite with properties:
DiscountCurve: [1×1 ratecurve]
Model: [1×1 finmodel.HullWhite]
Price Cap Instrument
Use price to compute the price for the Cap instrument.
Price = price(outPricer,CapOpt)
Price = 2.9366
This example shows the workflow to price multiple vanilla Cap instruments when using a HullWhite model and a HullWhite pricing method.
Create Cap Instrument Object
Use fininstrument to create a Cap instrument object for three Cap instruments.
CapOpt = fininstrument("Cap",'Strike',0.02,'Maturity',datetime([2019,1,30 ; 2019,2,30 ; 2019,3,30]),'Reset',4,'Principal',[100 ; 200 ; 300],'Basis',8,'Name',"cap_option")
CapOpt=3×1 Cap array with properties:
Strike
Maturity
ResetOffset
Reset
Basis
Principal
ProjectionCurve
DaycountAdjustedCashFlow
BusinessDayConvention
Holidays
Name
Create HullWhite Model Object
Use finmodel to create a HullWhite model object.
HullWhiteModel = finmodel("HullWhite",'Alpha',0.62,'Sigma',0.99)
HullWhiteModel =
HullWhite with properties:
Alpha: 0.6200
Sigma: 0.9900
Create ratecurve Object
Create a ratecurve object using ratecurve.
Settle = datetime(2018,9,15); 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: 15-Sep-2018
InterpMethod: "linear"
ShortExtrapMethod: "next"
LongExtrapMethod: "previous"
Create HullWhite Pricer Object
Use finpricer to create a HullWhite pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.
outPricer = finpricer("analytic",'Model',HullWhiteModel,'DiscountCurve',myRC)
outPricer =
HullWhite with properties:
DiscountCurve: [1×1 ratecurve]
Model: [1×1 finmodel.HullWhite]
Price Cap Instruments
Use price to compute the prices for the Cap instruments.
Price = price(outPricer,CapOpt)
Price = 3×1
2.9366
7.4694
17.7915
This example shows the workflow to price a vanilla Cap instrument when you use a Normal model and a Normal pricing method.
Create ratecurve Object
Create a ratecurve object using ratecurve for the underlying interest-rate curve for the cap instrument.
Settle = datetime(2018,9,15); 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: 15-Sep-2018
InterpMethod: "linear"
ShortExtrapMethod: "next"
LongExtrapMethod: "previous"
Create Cap Instrument Object
Use fininstrument to create a Cap instrument object.
CapOpt = fininstrument("Cap",'Maturity',datetime(2022,9,15),'Strike',0.04,'ProjectionCurve',myRC)
CapOpt =
Cap with properties:
Strike: 0.0400
Maturity: 15-Sep-2022
ResetOffset: 0
Reset: 1
Basis: 0
Principal: 100
ProjectionCurve: [1×1 ratecurve]
DaycountAdjustedCashFlow: 0
BusinessDayConvention: "actual"
Holidays: NaT
Name: ""
Create Normal Model Object
Use finmodel to create a Normal model object.
NormalModel = finmodel("Normal",'Volatility',0.01)
NormalModel =
Normal with properties:
Volatility: 0.0100
Create Normal Pricer Object
Use finpricer to create a Normal pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.
outPricer = finpricer("analytic",'DiscountCurve',myRC,'Model',NormalModel)
outPricer =
Normal with properties:
DiscountCurve: [1×1 ratecurve]
Shift: 0
Model: [1×1 finmodel.Normal]
Price Cap Instrument
Use price to compute the price for the Cap instrument.
[Price, outPR] = price(outPricer, CapOpt)
Price = 0.0701
outPR =
priceresult with properties:
Results: [1×1 table]
PricerData: []
This example shows the workflow to price an amortizing Cap instrument when you use a Black model and a Black pricing method.
Create Cap Instrument Object
Use fininstrument to create an amortizing Cap instrument object.
CADates = [datetime(2020,9,1) ; datetime(2023,9,1)]; CAPrincipal = [100; 85]; Principal = timetable(CADates,CAPrincipal); CapOpt = fininstrument("Cap",'Maturity',datetime(2023,9,1),'Strike',0.015,'Principal',Principal,'Name',"cap_amortizing_option")
CapOpt =
Cap with properties:
Strike: 0.0150
Maturity: 01-Sep-2023
ResetOffset: 0
Reset: 1
Basis: 0
Principal: [2×1 timetable]
ProjectionCurve: [0×0 ratecurve]
DaycountAdjustedCashFlow: 0
BusinessDayConvention: "actual"
Holidays: NaT
Name: "cap_amortizing_option"
Create Black Model Object
Use finmodel to create a Black model object.
BlackModel = finmodel("Black",'Volatility',0.2)
BlackModel =
Black with properties:
Volatility: 0.2000
Shift: 0
Create ratecurve Object
Create a ratecurve object using ratecurve.
Settle = datetime(2018,9,1); Type = 'zero'; ZeroTimes = [calyears([1 2 3 4 5 7 10])]'; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168]'; ZeroDates = Settle + ZeroTimes; myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates);
Create Black Pricer Object
Use finpricer to create a Black pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.
outPricer = finpricer("analytic",'Model',BlackModel,'DiscountCurve',myRC)
outPricer =
Black with properties:
Model: [1×1 finmodel.Black]
DiscountCurve: [1×1 ratecurve]
Price Cap Instrument
Use price to compute the price for the Cap instrument.
Price = price(outPricer,CapOpt)
Price = 0.3897
This example shows the workflow to price a vanilla Cap instrument when using a HullWhite model and an IRTree pricing method.
Create Cap Instrument Object
Use fininstrument to create a Cap instrument object.
CapOpt = fininstrument("Cap",'Strike',0.02,'Maturity',datetime(2020,1,30),'Reset',4,'Principal',100,'Basis',8,'Name',"cap_option")
CapOpt =
Cap with properties:
Strike: 0.0200
Maturity: 30-Jan-2020
ResetOffset: 0
Reset: 4
Basis: 8
Principal: 100
ProjectionCurve: [0×0 ratecurve]
DaycountAdjustedCashFlow: 0
BusinessDayConvention: "actual"
Holidays: NaT
Name: "cap_option"
Create HullWhite Model Object
Use finmodel to create a HullWhite model object.
HullWhiteModel = finmodel("HullWhite",'Alpha',0.01,'Sigma',0.10)
HullWhiteModel =
HullWhite with properties:
Alpha: 0.0100
Sigma: 0.1000
Create ratecurve Object
Create a ratecurve object using ratecurve.
Settle = datetime(2018,9,15); 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: 15-Sep-2018
InterpMethod: "linear"
ShortExtrapMethod: "next"
LongExtrapMethod: "previous"
Create IRTree Pricer Object
Use finpricer to create an IRTree pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.
CFdates = cfdates(Settle, CapOpt.Maturity, CapOpt.Reset, CapOpt.Basis); outPricer = finpricer("IRTree",'Model',HullWhiteModel,'DiscountCurve',myRC,'TreeDates',CFdates')
outPricer =
HWBKTree with properties:
Tree: [1×1 struct]
TreeDates: [6×1 datetime]
Model: [1×1 finmodel.HullWhite]
DiscountCurve: [1×1 ratecurve]
Price Cap Instrument
Use price to compute the price and sensitivities for the Cap instrument.
[Price, outPR] = price(outPricer,CapOpt,["all"])Price = 2.7733
outPR =
priceresult with properties:
Results: [1×4 table]
PricerData: [1×1 struct]
outPR.Results
ans=1×4 table
Price Delta Gamma Vega
______ ______ _______ ______
2.7733 28.932 -49.227 31.655
This example shows the workflow to price a Cap instrument when using a LinearGaussian2F model and an IRMonteCarlo pricing method.
Create Cap Instrument Object
Use fininstrument to create a Cap instrument object.
CapOpt = fininstrument("Cap","Maturity",datetime(2022,9,15),'Strike',0.01,'Reset',2,'Name',"cap_option")
CapOpt =
Cap with properties:
Strike: 0.0100
Maturity: 15-Sep-2022
ResetOffset: 0
Reset: 2
Basis: 0
Principal: 100
ProjectionCurve: [0×0 ratecurve]
DaycountAdjustedCashFlow: 0
BusinessDayConvention: "actual"
Holidays: NaT
Name: "cap_option"
Create LinearGaussian2F Model Object
Use finmodel to create a LinearGaussian2F model object.
LinearGaussian2FModel = finmodel("LinearGaussian2F",'Alpha1',0.07,'Sigma1',0.01,'Alpha2',0.5,'Sigma2',0.006,'Correlation',-0.7)
LinearGaussian2FModel =
LinearGaussian2F with properties:
Alpha1: 0.0700
Sigma1: 0.0100
Alpha2: 0.5000
Sigma2: 0.0060
Correlation: -0.7000
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',LinearGaussian2FModel,'DiscountCurve',myRC,'SimulationDates',ZeroDates)
outPricer =
G2PPMonteCarlo 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.LinearGaussian2F]
Price Cap Instrument
Use price to compute the price and sensitivities for the Cap instrument.
[Price,outPR] = price(outPricer,CapOpt,["all"])Price = 1.2156
outPR =
priceresult with properties:
Results: [1×4 table]
PricerData: [1×1 struct]
outPR.Results
ans=1×4 table
Price Delta Gamma Vega
______ ______ _____ ________________
1.2156 131.37 11048 126.5 -157.38
This example shows the workflow to price a Cap instrument when you use a CoxIngersollRoss model and an IRTree pricing method.
Create Cap Instrument Object
Use fininstrument to create a Cap instrument object.
Maturity = datetime(2027,1,1); StrikeCap = 0.055; Reset = 1; Cap = fininstrument("Cap",Strike=StrikeCap,Maturity=Maturity,Reset=Reset,Name="Cap_inst")
Cap =
Cap with properties:
Strike: 0.0550
Maturity: 01-Jan-2027
ResetOffset: 0
Reset: 1
Basis: 0
Principal: 100
ProjectionCurve: [0×0 ratecurve]
DaycountAdjustedCashFlow: 0
BusinessDayConvention: "actual"
Holidays: NaT
Name: "Cap_inst"
Create CoxIngersollRoss Model Object
Use finmodel to create a CoxIngersollRoss model object.
alpha = 0.03;
theta = 0.02;
sigma = 0.1;
CIRModel = finmodel("CoxIngersollRoss",Sigma=sigma,Alpha=alpha,Theta=theta)CIRModel =
CoxIngersollRoss with properties:
Sigma: 0.1000
Alpha: 0.0300
Theta: 0.0200
Create ratecurve Object
Create a ratecurve object using ratecurve.
Times= [calyears([1 2 3 4 ])]';
Settle = datetime(2023,1,1);
ZRates = [0.035; 0.042147; 0.047345; 0.052707]';
ZDates = Settle + Times;
Compounding = -1;
Basis = 1;
ZeroCurve = ratecurve("zero",Settle,ZDates,ZRates,Compounding = Compounding, Basis = Basis);Create IRTree Pricer Object
Use finpricer to create an IRTree pricer object for the CoxIngersollRoss model and use the ratecurve object for the 'DiscountCurve' name-value argument.
CIRPricer = finpricer("irtree",Model=CIRModel,DiscountCurve=ZeroCurve,Maturity=ZDates(end),NumPeriods=length(ZDates))CIRPricer =
CIRTree with properties:
Tree: [1×1 struct]
TreeDates: [4×1 datetime]
Model: [1×1 finmodel.CoxIngersollRoss]
DiscountCurve: [1×1 ratecurve]
Price Cap Instrument
Use price to compute the price for the Cap instrument.
[Price,outPR] = price(CIRPricer,Cap,"all")Price = 3.3361
outPR =
priceresult with properties:
Results: [1×4 table]
PricerData: [1×1 struct]
outPR.Results
ans=1×4 table
Price Delta Gamma Vega
______ ______ _______ ______
3.3361 142.25 -2632.5 26.325
More About
A cap is a contract that includes a guarantee that sets the maximum interest rate the holder pays, based on an otherwise floating interest rate.
A cap is a contract between two parties, where the buyer pays a premium to the seller in exchange for the right to receive payments if a specified interest rate exceeds a predetermined level (the cap rate) during a specified period. The cap rate is the maximum interest rate level above which the buyer of the cap instrument will receive payments. If the reference interest rate (for example, LIBOR) exceeds the cap rate, the buyer is entitled to receive a payment from the seller.
The payoff for a cap is:
For more information, see Cap.
Version History
Introduced in R2020aYou can price Cap instruments using a CoxIngersollRoss model object
and an IRTree pricing
method.
Although Cap supports serial date numbers,
datetime values are recommended instead. The
datetime data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.
To convert serial date numbers or text to datetime values, use the datetime function. For example:
t = datetime(738427.656845093,"ConvertFrom","datenum"); y = year(t)
y =
2021
There are no plans to remove support for serial date number inputs.
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)