Main Content

discountfactors

Calculate discount factors for a ratecurve object

Description

example

outDF = discountfactors(obj,inpDates) calculates the discount factors for a ratecurve object.

Examples

collapse all

Create a ratecurve object using ratecurve.

Settle = datetime(2019,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,'Compounding',2,'Basis',5,'InterpMethod',"pchip",'ShortExtrapMethod',"linear",'LongExtrapMethod',"pchip")
myRC = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: 2
                Basis: 5
                Dates: [10x1 datetime]
                Rates: [10x1 double]
               Settle: 15-Sep-2019
         InterpMethod: "pchip"
    ShortExtrapMethod: "linear"
     LongExtrapMethod: "pchip"

Compute the discount factors using discountfactors.

CurveSettle = datetime(2019,9,15);
outRates = discountfactors(myRC,CurveSettle+30:30:CurveSettle+720)
outRates = 1×24

    0.9996    0.9992    0.9988    0.9983    0.9979    0.9974    0.9970    0.9965    0.9961    0.9956    0.9951    0.9946    0.9941    0.9936    0.9931    0.9926    0.9921    0.9915    0.9910    0.9904    0.9899    0.9893    0.9887    0.9881

Input Arguments

collapse all

ratecurve object, specified using a previously created ratecurve object.

Data Types: object

Input dates, specified as a scalar or an NPOINTS-by-1 vector using a datetime array, string array, or date character vectors.

To support existing code, discountfactors also accepts serial date numbers as inputs, but they are not recommended.

Output Arguments

collapse all

Discount factors, returned as a numeric.

Version History

Introduced in R2020a

expand all