Floor
Description
Create and price a Floor
instrument object for one of more
Floor instruments using this workflow:
Use
fininstrument
to create aFloor
instrument object for one of more Floor instruments.Use
finmodel
to specify aHullWhite
,BlackKarasinski
,BlackDermanToy
,Black
,Normal
,BraceGatarekMusiela
,SABRBraceGatarekMusiela
,CoxIngersollRoss
, orLinearGaussian2F
model for theFloor
instrument object.Choose a pricing method.
When using a
HullWhite
,BlackKarasinski
,BlackDermanToy
,Black
,CoxIngersollRoss
, orNormal
model, usefinpricer
for pricing one or moreFloor
instruments and specify:When using a
HullWhite
,BlackKarasinski
,BraceGatarekMusiela
,SABRBraceGatarekMusiela
, orLinearGaussian2F
model, usefinpricer
to specify anIRMonteCarlo
pricing method for one or moreFloor
instruments.
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
Floor
instrument, see Choose Instruments, Models, and Pricers.
Creation
Syntax
Description
creates a FloorOpt
= fininstrument(InstrumentType
,'Strike
',strike_value,'Maturity
',maturity_date)Floor
object for one of more Floor instruments
by specifying InstrumentType
and sets the properties for the
required name-value pair argumentsStrike
and
Maturity
.
The Floor
instrument supports vanilla and amortizing
floors.
sets optional properties using
additional name-value pairs in addition to the required arguments in the
previous syntax. For example, FloorOpt
= fininstrument(___,Name,Value
)FloorOpt =
fininstrument("floor",'Strike',0.35,'Maturity',datetime(2019,1,30),'Reset',4,'Principal',100,'ResetOffset',1,'Basis',4,'DaycountAdjustedCashFlow',true,'BusinessDayConvention',"follow",'ProjectionCurve',ratecurve_object,'Name',"floor_option")
creates a Floor
instrument with a strike of 100 and a
maturity of January 30, 2019. You can specify multiple name-value pair
arguments.
Input Arguments
InstrumentType
— Instrument type
string with value "Floor"
| string array with values of "Floor"
| character vector with value 'Floor'
| cell array of character vectors with values of
'Floor'
Instrument type, specified as a string with the value of
"Floor"
, a character vector with the value of
'Floor'
, an
NINST
-by-1
string array with
values of "Floor"
, or an
NINST
-by-1
cell array of
character vectors with values of 'Floor'
.
Data Types: char
| cell
| string
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: FloorOpt =
fininstrument("floor",'Strike',0.35,'Maturity',datetime(2019,1,30),'Reset',4,'Principal',100,'ResetOffset',1,'Basis',4,'DaycountAdjustedCashFlow',true,'BusinessDayConvention',"follow",'ProjectionCurve',ratecurve_object,'Name',"floor_option")
Floor
Name-Value Pair ArgumentsStrike
— Option strike price value
scalar nonnegative decimal | vector of nonnegative decimals
Option strike price value, specified as the comma-separated pair
consisting of 'Strike'
and a scalar nonnegative
decimal or an NINST
-by-1
vector of nonnegative decimals.
Data Types: double
Maturity
— Floor maturity date
datetime array | string array | date character vector
Floor 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, Floor
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.
Floor
Name-Value Pair ArgumentsReset
— Reset frequency payments per year
1
(default) | scalar numeric with value of 0
,
1
, 2
,
3
, 4
, 6
, or
12
| numeric vector with values of 0
,
1
, 2
,
3
, 4
, 6
, or
12
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
Basis
— Day count basis
0
(actual/actual) (default) | scalar integer from 0
to
13
| vector of integers from 0
to
13
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
— Principal amount or principal value schedule
100
(default) | scalar numeric | numeric vector | timetable
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 Floor
instruments and use a timetable, the timetable specification
applies to all of the Floor
instruments.
Principal
does not accept an
NINST
-by-1
cell array
of timetables as input.
Data Types: double
| timetable
ResetOffset
— Lag in rate setting
0
(default) | scalar numeric | numeric vector
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
DaycountAdjustedCashFlow
— Flag to adjust cash flows based on actual period day count
false
(default) | scalar logical value of true
or
false
| vector of logical values of true
or
false
Flag to adjust cash flows based on actual period day count,
specified as the comma-separated pair consisting of
'DaycountAdjustedCashFlow'
and a scalar
logical or an NINST
-by-1
vector of logicals with values of true
or
false
.
Data Types: logical
BusinessDayConvention
— Business day conventions
"actual"
(default) | string | string array | character vector | cell array of character vectors
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 vector 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
— Holidays used in computing business days
NaT
(default) | datetime array | string array | date character vector
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)); FloorOpt = fininstrument("floor",'Strike',100,'Maturity',datetime(2025,12,15),'Holidays',H)
To support existing code, Floor
also
accepts serial date numbers as inputs, but they are not recommended.
ProjectionCurve
— Rate curve used in generating future cash flows
ratecurve.empty
(default) | ratecurve
object | vector of ratecurve
objects
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. This object is created
using ratecurve
. Use
this optional input if the forward curve is different from the
discount curve.
Data Types: object
Name
— User-defined name for instrument
" "
(default) | string | string array | character vector | cell array of character vectors
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
Properties
Strike
— Option strike price value
scalar nonnegative | vector of nonnegative values
Option strike price value, returned as a scalar nonnegative numeric or an
NINST
-by-1
vector of nonnegative
values.
Data Types: double
Maturity
— Floor maturity date
scalar datetime | vector of datetimes
Floor maturity date, returned as a scalar datetime or an
NINST
-by-1
vector of
datetimes.
Data Types: datetime
Reset
— Reset frequency payments per year
1
(default) | scalar numeric | numeric vector
Reset frequency payments per year, returned as a scalar numeric or an
NINST
-by-1
numeric vector.
Data Types: double
Basis
— Day count basis
0
(actual/actual) (default) | scalar integer from 0
to 13
| vector of integers from 0
to
13
Day count basis, returned as a scalar integer or an
NINST
-by-1
vector of
integers.
Data Types: double
Principal
— Principal amount or principal value schedule
100
(default) | scalar numeric | numeric vector | timetable
Principal amount or principal value schedule, returned as a scalar numeric
or an NINST
-by-1
numeric vector for
principal amount or a timetable for a principal value schedule.
Data Types: double
| timetable
ResetOffset
— Lag in rate setting
0
(default) | scalar numeric | numeric vector
Lag in rate setting, returned as a scalar numeric or an
NINST
-by-1
numeric vector.
Data Types: double
DaycountAdjustedCashFlow
— Flag to adjust cash flows based on actual period day count
false
(default) | scalar logical value of true
or
false
| vector of logical values of true
or
false
Flag to adjust cash flows based on actual period day count, returned as a
scalar logical or an NINST
-by-1
vector
of logical values with values of true
or
false
.
Data Types: logical
BusinessDayConvention
— Business day conventions
"actual"
(default) | string | string array
Business day conventions, returned as a scalar string or an
NINST
-by-1
string array.
Data Types: string
Holidays
— Holidays used in computing business days
NaT
(default) | datetimes
Holidays used in computing business days, returned as an
NINST
-by-1
vector of
datetimes.
Data Types: datetime
ProjectionCurve
— Rate curve used in generating future cash flows
ratecurve.empty
(default) | scalar ratecurve
object | vector of ratecurve
objects
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
Name
— User-defined name for instrument
" "
(default) | string | string array
User-defined name for the instrument, returned as a scalar string or an
NINST
-by-1
string array.
Data Types: string
Examples
Price Vanilla Floor
Instrument Using Black
Model and Black
Pricer
This example shows the workflow to price a vanilla Floor
instrument when you use a Black
model and a Black
pricing method.
Create ratecurve
Object
Create a ratecurve
object using ratecurve
for the underlying interest-rate curve for the floor
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: [10x1 datetime] Rates: [10x1 double] Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create Floor
Instrument Object
Use fininstrument
to create a Floor
instrument object.
FloorOpt = fininstrument("Floor",'Maturity',datetime(2022,9,15),'Strike',0.03,'ProjectionCurve',myRC)
FloorOpt = Floor with properties: Strike: 0.0300 Maturity: 15-Sep-2022 ResetOffset: 0 Reset: 1 Basis: 0 Principal: 100 ProjectionCurve: [1x1 ratecurve] DaycountAdjustedCashFlow: 0 BusinessDayConvention: "actual" Holidays: NaT Name: ""
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 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",'DiscountCurve',myRC,'Model',BlackModel)
outPricer = Black with properties: Model: [1x1 finmodel.Black] DiscountCurve: [1x1 ratecurve]
Price Floor
Instrument
Use price
to compute the price for the Floor
instrument.
[Price, outPR] = price(outPricer,FloorOpt)
Price = 8.0878
outPR = priceresult with properties: Results: [1x1 table] PricerData: []
Price Multiple Vanilla Floor
Instruments Using Black
Model and Black
Pricer
This example shows the workflow to price multiple vanilla Floor
instruments when you use a Black
model and a Black
pricing method.
Create ratecurve
Object
Create a ratecurve
object using ratecurve
for the underlying interest-rate curve for the floor
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: [10x1 datetime] Rates: [10x1 double] Settle: 15-Sep-2018 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create Floor
Instrument Object
Use fininstrument
to create a Floor
instrument object for three Floor instruments.
FloorOpt = fininstrument("Floor",'Maturity',datetime([2022,9,15 ; 2022,9,15 ; 2022,9,15]),'Strike',[0.03 ; 0.04 ; 0.05],'ProjectionCurve',myRC)
FloorOpt=3×1 Floor array with properties:
Strike
Maturity
ResetOffset
Reset
Basis
Principal
ProjectionCurve
DaycountAdjustedCashFlow
BusinessDayConvention
Holidays
Name
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 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",'DiscountCurve',myRC,'Model',BlackModel)
outPricer = Black with properties: Model: [1x1 finmodel.Black] DiscountCurve: [1x1 ratecurve]
Price Floor
Instruments
Use price
to compute the prices for the Floor
instruments.
[Price, outPR] = price(outPricer,FloorOpt)
Price = 3×1
8.0878
12.0033
15.9263
outPR=3×1 priceresult array with properties:
Results
PricerData
Price Vanilla Floor
Instrument Using HullWhite
Model and HullWhite
Pricer
This example shows the workflow to price a vanilla Floor
instrument when you use a HullWhite
model and a HullWhite
pricing method.
Create Floor
Instrument Object
Use fininstrument
to create a Floor
instrument object.
FloorOpt = fininstrument("Floor",'Strike',0.039,'Maturity',datetime(2019,1,30),'Reset',4,'Principal',100,'Basis',12,'Name',"floor_option")
FloorOpt = Floor with properties: Strike: 0.0390 Maturity: 30-Jan-2019 ResetOffset: 0 Reset: 4 Basis: 12 Principal: 100 ProjectionCurve: [0x0 ratecurve] DaycountAdjustedCashFlow: 0 BusinessDayConvention: "actual" Holidays: NaT Name: "floor_option"
Create HullWhite
Model Object
Use finmodel
to create a HullWhite
model object.
HullWhiteModel = finmodel("HullWhite",'Alpha',0.032,'Sigma',0.04)
HullWhiteModel = HullWhite with properties: Alpha: 0.0320 Sigma: 0.0400
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: [10x1 datetime] Rates: [10x1 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: [1x1 ratecurve] Model: [1x1 finmodel.HullWhite]
Price Floor
Instrument
Use price
to compute the price for the Floor
instrument.
Price = price(outPricer,FloorOpt)
Price = 1.2676
Price Amortizing Floor
Instrument Using Black
Model and Black
Pricer
This example shows the workflow to price an amortizing Floor
instrument when you use a Black
model and a Black
pricing method.
Create Floor
Instrument Object
Use fininstrument
to create an amortizing Floor
instrument object.
CADates = datetime([2020,9,1 ; 2023,9,1]); CAPrincipal = [100; 85]; Principal = timetable(CADates,CAPrincipal); FloorOpt = fininstrument("Floor",'Maturity',datetime(2023,9,1),'Strike',0.015,'Principal',Principal,'Name',"floor_amortizing_option")
FloorOpt = Floor with properties: Strike: 0.0150 Maturity: 01-Sep-2023 ResetOffset: 0 Reset: 1 Basis: 0 Principal: [2x1 timetable] ProjectionCurve: [0x0 ratecurve] DaycountAdjustedCashFlow: 0 BusinessDayConvention: "actual" Holidays: NaT Name: "floor_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: [1x1 finmodel.Black] DiscountCurve: [1x1 ratecurve]
Price Floor
Instrument
Use price
to compute the price for the Floor
instrument.
Price = price(outPricer,FloorOpt)
Price = 3.0030
Price Vanilla Floor
Instrument Using HullWhite
Model and IRTree
Pricer
This example shows the workflow to price a vanilla Floor
instrument when using a HullWhite
model and an IRTree
pricing method.
Create Floor
Instrument Object
Use fininstrument
to create a Floor
instrument object.
FloorOpt = fininstrument("Floor",'Strike',0.03,'Maturity',datetime(2020,1,30),'Reset',4,'Principal',100,'Basis',8,'Name',"floor_option")
FloorOpt = Floor with properties: Strike: 0.0300 Maturity: 30-Jan-2020 ResetOffset: 0 Reset: 4 Basis: 8 Principal: 100 ProjectionCurve: [0x0 ratecurve] DaycountAdjustedCashFlow: 0 BusinessDayConvention: "actual" Holidays: NaT Name: "floor_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: [10x1 datetime] Rates: [10x1 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, FloorOpt.Maturity, FloorOpt.Reset, FloorOpt.Basis); outPricer = finpricer("IRTree",'Model',HullWhiteModel,'DiscountCurve',myRC,'TreeDates',CFdates')
outPricer = HWBKTree with properties: Tree: [1x1 struct] TreeDates: [6x1 datetime] Model: [1x1 finmodel.HullWhite] DiscountCurve: [1x1 ratecurve]
Price Floor
Instrument
Use price
to compute the price and sensitivities for the Floor
instrument.
[Price, outPR] = price(outPricer,FloorOpt,["all"])
Price = 5.7821
outPR = priceresult with properties: Results: [1x4 table] PricerData: [1x1 struct]
outPR.Results
ans=1×4 table
Price Delta Gamma Vega
______ _______ ______ ______
5.7821 -110.54 141.45 31.821
Price Floor
Instrument Using BraceGatarekMusiela
Model and IRMonteCarlo
Pricer
This example shows the workflow to price a Floor
instrument when using a BraceGatarekMusiela
model and an IRMonteCarlo
pricing method.
Create Floor Instrument Object
Use fininstrument
to create a Floor
instrument object.
FloorOpt = fininstrument("Floor","Maturity",datetime(2022,9,15),'Strike',0.05,'Reset',1,'Name',"floor_option")
FloorOpt = Floor with properties: Strike: 0.0500 Maturity: 15-Sep-2022 ResetOffset: 0 Reset: 1 Basis: 0 Principal: 100 ProjectionCurve: [0x0 ratecurve] DaycountAdjustedCashFlow: 0 BusinessDayConvention: "actual" Holidays: NaT Name: "floor_option"
Create BraceGatarekMusiela Model Object
Use finmodel
to create a BraceGatarekMusiela
model object.
BGMVolFunc = @(a,t) (a(1)*t + a(2)).*exp(-a(3)*t) + a(4); BGMVolParams = [.3 -.02 .7 .14]; numRates = 20; VolFunc(1:numRates-1) = {@(t) BGMVolFunc(BGMVolParams,t)}; Beta = .08; CorrFunc = @(i,j,Beta) exp(-Beta*abs(i-j)); Correlation = CorrFunc(meshgrid(1:numRates-1)',meshgrid(1:numRates-1),Beta); BGM = finmodel("BraceGatarekMusiela",'Volatility',VolFunc,'Correlation',Correlation,'Period',1);
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])]'; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293]'; ZeroDates = Settle + ZeroTimes; myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: [9x1 datetime] Rates: [9x1 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',BGM,'DiscountCurve',myRC,'SimulationDates',ZeroDates)
outPricer = BGMMonteCarlo with properties: NumTrials: 1000 RandomNumbers: [] DiscountCurve: [1x1 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] Model: [1x1 finmodel.BraceGatarekMusiela]
Price Floor
Instrument
Use price
to compute the price and sensitivities for the Floor
instrument.
[Price,outPR] = price(outPricer,FloorOpt,["all"])
Price = 14.7975
outPR = priceresult with properties: Results: [1x3 table] PricerData: [1x1 struct]
outPR.Results
ans=1×3 table
Price Delta Gamma
______ _______ ______
14.797 -398.43 1399.5
Price Floor
Instrument Using CoxIngersollRoss
Model and IRTree
Pricer
This example shows the workflow to price a Floor
instrument when you use a CoxIngersollRoss
model and an IRTree
pricing method.
Create Floor
Instrument Object
Use fininstrument
to create a Floor
instrument object.
Maturity = datetime(2027,1,1); StrikeFloor = 0.035; Reset = 1; Floor = fininstrument("Floor",Strike=StrikeFloor,Maturity=Maturity,Reset=Reset,Name="Floor_inst")
Floor = Floor with properties: Strike: 0.0350 Maturity: 01-Jan-2027 ResetOffset: 0 Reset: 1 Basis: 0 Principal: 100 ProjectionCurve: [0x0 ratecurve] DaycountAdjustedCashFlow: 0 BusinessDayConvention: "actual" Holidays: NaT Name: "Floor_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: [1x1 struct] TreeDates: [4x1 datetime] Model: [1x1 finmodel.CoxIngersollRoss] DiscountCurve: [1x1 ratecurve]
Price Floor
Instrument
Use price
to compute the price for the Floor
instrument.
[Price,outPR] = price(CIRPricer,Floor,"all")
Price = 0.2361
outPR = priceresult with properties: Results: [1x4 table] PricerData: [1x1 struct]
outPR.Results
ans=1×4 table
Price Delta Gamma Vega
_______ _______ ______ ______
0.23606 -29.667 1968.3 6.1077
More About
Floor
A floor is a contract that includes a guarantee setting the minimum interest rate received by the holder, based on an otherwise floating interest rate.
A floor instrument sets a minimum interest rate, known as the floor rate, below which the interest payments on a loan or investment cannot fall. If the reference interest rate, such as LIBOR or a government bond yield, falls below the floor rate, the holder of the floor instrument will receive a payment to compensate for the difference.
The payoff for a floor is:
Version History
Introduced in R2020aR2023b: Support for Pricing Floor
Instruments Using CoxIngersollRoss
Model and IRTree
Pricer
You can price Floor
instruments using a CoxIngersollRoss
model object
and an IRTree
pricing
method.
R2022b: Serial date numbers not recommended
Although Floor
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.
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes 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)