Main Content

toRateSpec

Convert IRDataCurve object to RateSpec

Description

example

F = toRateSpec(CurveObj,InpDates) computes RateSpec object for input dates for an IRDataCurve object. The RateSpec object that is identical to the RateSpec structure created by the function intenvset.

Examples

collapse all

This example shows how to convert an IRDataCurve object to a RateSpec. First, an IRDataCurve object is created using the function IRDataCurve constructor with Dates and Data, then this object is converted to a RateSpec structure using the toRateSpec method.

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('Forward',CurveSettle,Dates,Data);
toRateSpec(irdc, CurveSettle+30:30:CurveSettle+365)
ans = struct with fields:
           FinObj: 'RateSpec'
      Compounding: 2
             Disc: [12x1 double]
            Rates: [12x1 double]
         EndTimes: [12x1 double]
       StartTimes: [12x1 double]
         EndDates: [12x1 double]
       StartDates: 736391
    ValuationDate: 736391
            Basis: 0
     EndMonthRule: 1

Input Arguments

collapse all

Interest-rate curve object, specified by using IRDataCurve.

Data Types: object

Input dates, specified using MATLAB® date format. The input dates must be after the Settle date of IRDataCurve.

Data Types: double

Output Arguments

collapse all

Rate spec, returned as an object. The RateSpec object that is identical to the RateSpec structure created by the function intenvset.

Alternatively, you can convert the RateSpec object to a ratecurve object (see Convert RateSpec to a ratecurve Object) and then use the Financial Instruments Toolbox™ object-based framework for pricing instruments.

Introduced in R2008b