Main Content

ratetimes

Change time intervals defining interest-rate environment

Description

[Rates,EndTimes,StartTimes] = ratetimes(Compounding,RefRates,RefEndTimes,RefStartTimes,EndTimes,StartTimes) change time intervals defining an interest-rate environment where interval points are input as times in periodic units.

ratetimes takes an interest-rate environment defined by yields over one collection of time intervals and computes the yields over another set of time intervals. The zero rate is assumed to be piecewise linear in time.

example

[Rates,EndTimes,StartTimes] = ratetimes(Compounding,RefRates,RefEndTimes,RefStartTimes,EndTimes,StartTimes,ValuationDate) change time intervals defining an interest-rate environment where ValuationDate is passed and interval points are input as dates.

Entering ValuationDate invokes the date interpretation; omitting ValuationDate invokes the default time interpretations.

example

Examples

collapse all

ratetimes takes an interest-rate environment defined by yields over one collection of time intervals and computes the yields over another set of time intervals. The zero rate is assumed to be piecewise linear in time.

The reference environment is a collection of zero rates at 6, 12, and 24 months. Create a collection of 1-year forward rates beginning at 0, 6, and 12 months.

RefRates = [0.05; 0.06; 0.065];
RefEndTimes = [1; 2; 4];
StartTimes = [0; 1; 2];
EndTimes   = [2; 3; 4];
Rates = ratetimes(2, RefRates, RefEndTimes, 0, EndTimes,StartTimes)
Rates = 3×1

    0.0600
    0.0688
    0.0700

Interpolate a zero yield curve to different dates. Zero curves start at the default date of ValuationDate.

RefRates = [0.04; 0.05; 0.052];
RefDates = [729756; 729907; 730121];
Dates    = [730241; 730486];
ValuationDate   = 729391;
Rates = ratetimes(2, RefRates, RefDates, [], Dates, [], ValuationDate)
Rates = 2×1

    0.0520
    0.0520

Input Arguments

collapse all

Compounding rate for which the input zero rates are compounded when annualized, specified as one of the following scalar integers. Compounding determines the formula for the discount factors (Disc):

  • If Compounding = 0 for simple interest:

    • Disc = 1/(1 + Z * T), where T is time in years and simple interest assumes annual times F = 1.

  • If Compounding = 1, 2, 3, 4, 6, 12:

    • Disc = (1 + Z/F)^(-T), where F is the compounding frequency, Z is the zero rate, and T is the time in periodic units, for example, T = F is one year.

  • If Compounding = 365:

    • Disc = (1 + Z/F)^(-T), where F is the number of days in the basis year and T is a number of days elapsed computed by basis.

  • If Compounding = -1:

    • Disc = exp(-T*Z), where T is time in years.

Data Types: double

Reference rates, specified as an NREFPTS-by-NCURVES matrix in decimal form. RefRates are the yields over investment intervals from RefStartTimes, when the cash flow is valued, to RefEndTimes, when the cash flow is received.

Data Types: double

End times, specified as a scalar or an NREFPTS-by-1 vector using serial date numbers or date character vectors, or with times in periodic units ending the intervals corresponding to RefRates. When RefEndTimes is not a date, the value for RefEndTimes is T computed from SIA semi-annual time factors, Tsemi, by the formula T = Tsemi/2 * F, where F is the compounding frequency. F is set to 1 for continuous compounding.

Note

When ValuationDate is not passed, RefEndTimes is interpreted as times. If Compounding = 365 (daily), RefEndTimes is measured in days.

Data Types: double | char

(Optional) Start times, specified a scalar or an NREFPTS-by-1 vector using serial date numbers or date character vectors, or with times in periodic units starting the intervals corresponding to RefRates. RefStartDates must be earlier than RefEndDates. When RefStarTimes is not a date, the value for RefStartTimes is T computed from SIA semi-annual time factors, Tsemi, by the formula T = Tsemi/2 * F, where F is the compounding frequency. F is set to 1 for continuous compounding.

Note

When ValuationDate is not passed, RefStartTimes is interpreted as times. If Compounding = 365 (daily), RefStartTimes is measured in days.

(Optional) NREFPTS-by-1 vector or scalar of times in periodic units starting the intervals corresponding to RefRates. Default = 0.

Data Types: double | char

End of interval where rates are desired, specified as a scalar or NPOINTS-by-1 vector using serial date numbers or date character vectors.

Note

You can specify the investment intervals either with input times or with input dates. Entering ValuationDate invokes the date interpretation; omitting ValuationDate invokes the default time interpretations.

Data Types: double | char

(Optional) Starting new interval where rates are desired, specified as a scalar or NPOINTS-by-1 vector using serial date numbers or date character vectors.

Note

You can specify the investment intervals either with input times or with input dates. Entering ValuationDate invokes the date interpretation; omitting ValuationDate invokes the default time interpretations.

Data Types: double | char

(Optional) Observation date of the investment horizons entered in RefStartTimes and RefEndTimes, specified as a serial date number or data character vector.

Note

You can specify the investment intervals either with input times or with input dates. Entering ValuationDate invokes the date interpretation; omitting ValuationDate invokes the default time interpretations.

Data Types: double | char

Output Arguments

collapse all

Rates implied by the reference interest-rate structure and sampled at new intervals, returned as an NPOINTS-by-NCURVES.

Times ending the new intervals, returned as an NPOINTS-by-1 column vector, measured in periodic units.

Times starting the new intervals where rates are desired, returned as an NPOINTS-by-1 column vector, measured in periodic units.

Version History

Introduced before R2006a