Main Content

getDiscountFactors

Get discount factors for input dates for IRDataCurve

Description

F = getDiscountFactors(CurveObj,InpDates) computes discount factors for input dates for an IRDataCurve object.

Note

The ratecurve object and the associated discountfactors were introduced in R2020a as part of a new object-based framework in the Financial Instruments Toolbox™ which supports end-to-end workflows in instrument modeling and analysis. For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

example

Examples

collapse all

This example shows how to get discount factors for input dates for an IRDataCurve.

CurveSettle = datetime(2016,3,2);
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);
getDiscountFactors(irdc, CurveSettle+30:30:CurveSettle+720)
ans = 24×1

    0.9986
    0.9971
    0.9956
    0.9940
    0.9924
    0.9907
    0.9890
    0.9873
    0.9855
    0.9836
      ⋮

Input Arguments

collapse all

Interest-rate curve object, specified by using IRDataCurve.

Data Types: object

Input dates, specified as an NINST-by-1 vector using a datetime array, string array, or date character vectors. The input dates must be after the Settle date of IRDataCurve.

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

Output Arguments

collapse all

Discount factors, returned as a vector.

Version History

Introduced in R2008b

expand all