Modeling the Interest-Rate Term Structure
Financial Instruments Toolbox™ includes a set of functions to encapsulate interest-rate term information into a single structure. These functions present a convenient way to package all information related to interest-rate terms into a common format, and to resolve interdependencies when one or more of the parameters is modified. For information, see:
Creating or Modifying intenvset for a discussion of how to create or modify an interest-rate term structure (
RateSpec
) using theintenvset
functionObtaining Specific Properties Using intenvget for a discussion of how to extract specific properties from a
RateSpec
Creating or Modifying intenvset
This example shows how to create or modify an interest-rate term structure RateSpec
using intenvset
.
When using RateSpec
to specify the rate term structure to price instruments based on yields (zero coupon rates) or forward rates, specify zero rates or forward rates as the input argument. However, the RateSpec
structure is not limited or specific to this problem domain. RateSpec
is an encapsulation of rates-times relationships; intenvset
acts as either a constructor or a modifier, and intenvget
as an accessor. The interest rate models supported by the Financial Instruments Toolbox™ software work either with zero coupon rates or forward rates.
Consider this table of interest rates.
From | To | Rate |
---|---|---|
15 Feb 2000 | 15 Aug 2000 | 0.05 |
15 Feb 2000 | 15 Feb 2001 | 0.056 |
15 Feb 2000 | 15 Aug 2001 | 0.06 |
15 Feb 2000 | 15 Feb 2002 | 0.065 |
15 Feb 2000 | 15 Aug 2002 | 0.075 |
Use the information in this table to populate the RateSpec
structure.
StartDates = '15-Feb-2000'; EndDates = ['15-Aug-2000'; '15-Feb-2001'; '15-Aug-2001'; '15-Feb-2002'; '15-Aug-2002']; Compounding = 2; ValuationDate = '15-Feb-2000'; Rates = [0.05; 0.056; 0.06; 0.065; 0.075]; rs = intenvset('Compounding',Compounding,'StartDates', ... StartDates, 'EndDates', EndDates, 'Rates', Rates, ... 'ValuationDate', ValuationDate)
rs = struct with fields:
FinObj: 'RateSpec'
Compounding: 2
Disc: [5×1 double]
Rates: [5×1 double]
EndTimes: [5×1 double]
StartTimes: [5×1 double]
EndDates: [5×1 double]
StartDates: 730531
ValuationDate: 730531
Basis: 0
EndMonthRule: 1
Some of the properties filled in the structure were not passed explicitly in the call to RateSpec
. The values of the automatically completed properties depend on the properties that are explicitly passed. Consider for example the StartTimes
and EndTimes
vectors. Since the StartDates
and EndDates
vectors are passed in, and the ValuationDate
, intenvset
has all the information required to calculate StartTimes
and EndTimes
. Hence, the StartTimes
and EndTimes
properties are read-only.
Obtaining Specific Properties Using intenvget
This example shows how to use intenvget
to obtain function-specific properties from the interest-rate term structure.
Consider this table of interest rates.
From | To | Rate |
---|---|---|
15 Feb 2000 | 15 Aug 2000 | 0.05 |
15 Feb 2000 | 15 Feb 2001 | 0.056 |
15 Feb 2000 | 15 Aug 2001 | 0.06 |
15 Feb 2000 | 15 Feb 2002 | 0.065 |
15 Feb 2000 | 15 Aug 2002 | 0.075 |
Use the information in this table to populate the RateSpec
structure.
StartDates = '15-Feb-2000'; EndDates = ['15-Aug-2000'; '15-Feb-2001'; '15-Aug-2001'; '15-Feb-2002'; '15-Aug-2002']; Compounding = 2; ValuationDate = '15-Feb-2000'; Rates = [0.05; 0.056; 0.06; 0.065; 0.075]; rs = intenvset('Compounding',Compounding,'StartDates', ... StartDates, 'EndDates', EndDates, 'Rates', Rates, ... 'ValuationDate', ValuationDate)
rs = struct with fields:
FinObj: 'RateSpec'
Compounding: 2
Disc: [5×1 double]
Rates: [5×1 double]
EndTimes: [5×1 double]
StartTimes: [5×1 double]
EndDates: [5×1 double]
StartDates: 730531
ValuationDate: 730531
Basis: 0
EndMonthRule: 1
To obtain the vector EndTimes
from the RateSpec
structure, use intenvget
.
EndTimes = intenvget(rs, 'EndTimes')
EndTimes = 5×1
1
2
3
4
5
Use intenvget
to obtain Disc
, the values for the discount factors that were calculated automatically by intenvset
.
Disc = intenvget(rs, 'Disc')
Disc = 5×1
0.9756
0.9463
0.9151
0.8799
0.8319
These discount factors correspond to the periods starting from StartDates
and ending in EndDates
.
Use the RateSpec
structure with its functions to examine how changes in specific properties of the interest-rate term structure affect those depending on it. For example, change the value of Compounding
from 2
(semiannual) to 1
(annual).
rs = intenvset(rs, 'Compounding', 1);
Since StartTimes
and EndTimes
are measured in units of periodic discount, a change in Compounding
from 2
to 1
redefines the basic unit from semiannual to annual. This means that a period of six months is represented with a value of 0.5
, and a period of one year is represented by 1
. To obtain the vectors StartTimes
and EndTimes
, enter:
StartTimes = intenvget(rs, 'StartTimes'); EndTimes = intenvget(rs, 'EndTimes'); Times = [StartTimes, EndTimes]
Times = 5×2
0 0.5000
0 1.0000
0 1.5000
0 2.0000
0 2.5000
Since all the values in StartDates
are the same as the valuation date, all StartTimes
values are 0
. On the other hand, the values in the EndDates
vector are dates separated by six-month periods. Since the redefined value of compounding is 1
, EndTimes
becomes a sequence of numbers separated by increments of 0.5
.
See Also
instbond
| instcap
| instcf
| instfixed
| instfloat
| instfloor
| instoptbnd
| instoptembnd
| instoptfloat
| instoptemfloat
| instrangefloat
| instswap
| instswaption
| intenvset
| bondbyzero
| cfbyzero
| fixedbyzero
| floatbyzero
| intenvprice
| intenvsens
| swapbyzero
| floatmargin
| floatdiscmargin
| hjmtimespec
| hjmtree
| hjmvolspec
| bondbyhjm
| capbyhjm
| cfbyhjm
| fixedbyhjm
| floatbyhjm
| floorbyhjm
| hjmprice
| hjmsens
| mmktbyhjm
| oasbyhjm
| optbndbyhjm
| optfloatbyhjm
| optembndbyhjm
| optemfloatbyhjm
| rangefloatbyhjm
| swapbyhjm
| swaptionbyhjm
| bdttimespec
| bdttree
| bdtvolspec
| bdtprice
| bdtsens
| bondbybdt
| capbybdt
| cfbybdt
| fixedbybdt
| floatbybdt
| floorbybdt
| mmktbybdt
| oasbybdt
| optbndbybdt
| optfloatbybdt
| optembndbybdt
| optemfloatbybdt
| rangefloatbybdt
| swapbybdt
| swaptionbybdt
| hwtimespec
| hwtree
| hwvolspec
| bondbyhw
| capbyhw
| cfbyhw
| fixedbyhw
| floatbyhw
| floorbyhw
| hwcalbycap
| hwcalbyfloor
| hwprice
| hwsens
| oasbyhw
| optbndbyhw
| optfloatbyhw
| optembndbyhw
| optemfloatbyhw
| rangefloatbyhw
| swapbyhw
| swaptionbyhw
| bktimespec
| bktree
| bkvolspec
| bkprice
| bksens
| bondbybk
| capbybk
| cfbybk
| fixedbybk
| floatbybk
| floorbybk
| oasbybk
| optbndbybk
| optfloatbybk
| optembndbybk
| optemfloatbybk
| rangefloatbybk
| swapbybk
| swaptionbybk
| capbyblk
| floorbyblk
| swaptionbyblk
Topics
- Pricing Using Interest-Rate Term Structure
- Pricing Using Interest-Rate Term Structure
- Pricing Using Interest-Rate Tree Models
- Graphical Representation of Trees
- Understanding Interest-Rate Term Structure
- Supported Interest-Rate Instrument Functions
- Supported Equity Derivative Functions
- Supported Energy Derivative Functions
- Mapping Financial Instruments Toolbox Functions for Interest-Rate Instrument Objects