getForwardRates
Get forward rates for input dates for
IRDataCurve
Description
computes discount factors for input dates for an F
= getForwardRates(CurveObj
,InpDates
)IRDataCurve
object.
getForwardRates
returns discrete forward rates for the
intervals input into this function. For example, running the following
code:
getForwardRates(irdc, {Date1, Date2, Date3})
[Settle,
Date1]
, [Date1, Date2]
, and [Date2,
Date3]
.
adds optional name-value pair arguments. F
= getForwardRates(___,Name,Value
)
Examples
Get Forward Rates For Input Dates for an IRDataCurve
This example shows how to get forward rates for input dates for an IRDataCurve
.
CurveSettle = datenum('2-Mar-2016'); Data = [2.09 2.47 2.71 3.12 3.43 3.85 4.57 4.58]/100; Dates = datemnth(CurveSettle,12*[1 2 3 5 7 10 20 30]); irdc = IRDataCurve('Zero',CurveSettle,Dates,Data); getForwardRates(irdc, CurveSettle+30:30:CurveSettle+720)
ans = 24×1
0.0174
0.0180
0.0187
0.0193
0.0199
0.0205
0.0212
0.0218
0.0224
0.0230
⋮
Use getForwardRates to Compute the Five Year Forward Rate in Five Years Time
Use getForwardRates
to compute the forward rate from the Settle
date to 5 years from March 1, 2017 and then the forward rate for the period from 5 years to 10 years from March 1, 2017.
Data = [2.09 2.47 2.71 3.12 3.43 3.85 4.57 4.58]/100;
Dates = daysadd(736755,[360 2*360 3*360 5*360 7*360 10*360 20*360 30*360],1);
irdc = IRDataCurve('Zero',today,Dates,Data);
getForwardRates(irdc,datemnth(irdc.Settle,12*[5 10]))
ans = 2×1
0.0385
0.0457
The first element (.0312
) is the forward rate from the Settle
to 5 years from March 1, 2017. The second rate (0.0458
) is the forward rate for the period from 5 years to 10 years from March 1, 2017, in other words, the 5-year forward rate 5 years from March 1, 2017.
Compute the Six Month Forward Rates in 1 Month, 2 Months and 3 Months
Use the following data to create an IRDataCurve
object:
Data = [0.1 0.30 0.70 1.05 1.45 1.71 2.12 2.43 2.85 3.57]/100; Settle = datenum('08-Aug-2016'); % Today's date Dates = datemnth(Settle,[3 6 9 12*[1 2 3 5 7 10 20]]); irdc = IRDataCurve('Zero',Settle,Dates,Data)
irdc = Type: Zero Settle: 736550 (08-Aug-2016) Compounding: 2 Basis: 0 (actual/actual) InterpMethod: linear Dates: [10x1 double] Data: [10x1 double]
Compute the implied 6 month forward rates in 1 month, 2 months, and 3 months from the Settle
date.
IntervalMonth = 6; % Interval for 6 month forward rates FwdMonths = [1 2 3]'; % Starting in 1, 2, and 3 months from Settle N = length(FwdMonths); FwdRates_6M = zeros(N,1); for k = 1:N FwdDates = datemnth(irdc.Settle, [FwdMonths(k) FwdMonths(k)+IntervalMonth]); f = getForwardRates(irdc,FwdDates); FwdRates_6M(k) = f(2); end [FwdMonths FwdRates_6M]
ans = 3×2
1.0000 0.0050
2.0000 0.0074
3.0000 0.0101
Input Arguments
CurveObj
— Interest-rate curve object
object
Interest-rate curve object, specified by using IRDataCurve
.
Data Types: object
InpDates
— Input dates
vector
Input dates, specified using MATLAB® date format. The input dates must be after the
Settle
date of IRDataCurve
.
Data Types: double
Name-Value Arguments
Specify 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: F = getForwardRates(irdc,
CurveSettle+30:30:CurveSettle+720)
Compounding
— Compounding frequency per-year for forward rates
CurveObj.Compounding
(default) | possible values include: –1
, 0
,
1
, 2
, 3
,
4
, 6
,
12
.
Compounding frequency per-year for forward rates, specified as the
comma-separated pair consisting of 'Compounding'
and
a scalar numeric using one of the supported values:
−1
= Continuous compounding0
= Simple interest (no compounding)1
= Annual compounding2
= Semiannual compounding3
= Compounding three times per year4
= Quarterly compounding6
= Bimonthly compounding12
= Monthly compounding
Data Types: double
Basis
— Day count basis for the forward rates
0
(actual/actual) (default) | integer from 0
to 13
Day count basis for the forward rates, specified as the
comma-separated pair consisting of 'Basis'
and a
scalar integer.
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
Output Arguments
F
— Forward rates
vector
Forward rates, returned as a vector. getForwardRates
returns forward rates corresponding to the periodicity of the dates input to
getForwardRates
. For example, where the dates are
monthly, monthly forward rates are returned. The first element of the output
is the forward rate from the Settle
to one month, the
second element is the forward rate from one month to two months, and so
on.
Version History
Beispiel öffnen
Sie haben eine geänderte Version dieses Beispiels. Möchten Sie dieses Beispiel mit Ihren Änderungen öffnen?
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)