Main Content

cirtimespec

Specify time structure for Cox-Ingersoll-Ross tree

Description

TimeSpec = cirtimespec(ValuationDate,Maturity,NumPeriods) creates a time spec for a Cox-Ingersoll-Ross (CIR) tree.

Note

Alternatively, you can use the Cap object to price cap instruments. For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

example

TimeSpec = cirtimespec(___,Name,Value) adds additional name-value pair arguments.

example

Examples

collapse all

Set the number of levels and node times for an CIR tree by specifying a four-period tree with time steps of 1 year.

ValuationDate = datetime(2017,1,1); 
Maturity = datetime(2021,1,1); 
NumPeriods = 4
NumPeriods = 
4
CIRTimeSpec = cirtimespec(ValuationDate, Maturity, NumPeriods)
CIRTimeSpec = struct with fields:
           FinObj: 'CIRTimeSpec'
    ValuationDate: 736696
         Maturity: 738157
       NumPeriods: 4
      Compounding: 1
            Basis: 0
     EndMonthRule: 1
             tObs: [0 1 2 3 4]
             dObs: [736696 737061 737426 737791 738157]

Input Arguments

collapse all

Date marking the pricing date and first observation in the tree, specified as a scalar datetime, string, or date character vector

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

Date marking the depth of the tree, specified as a scalar datetime, string, or date character vector.

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

Determines how many time steps are in tree, specified as a scalar using a nonnegative integer value.

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: TimeSpec = cirtimespec(Valuationdate,Maturity,NumPeriods,'Basis',3)

Frequency at which the rates are compounded when annualized, specified as the comma-separated pair consisting of 'Compounding' and a scalar value:

  • 1 — Annual compounding

  • 2 — Semiannual compounding

  • 3 — Compounding three times per year

  • 4 — Quarterly compounding

  • 6 — Bimonthly compounding

  • 12 — Monthly compounding

Data Types: double

Day count basis, specified as the comma-separated pair consisting of 'Basis' and a scalar value:

  • 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

End-of-month rule flag for generating dates when Maturity is an end-of-month date for a month having 30 or fewer days, specified as the comma-separated pair consisting of 'EndMonthRule' and a nonnegative integer [0, 1] using a scalar.

  • 0 = Ignore rule, meaning that a payment date is always the same numerical day of the month.

  • 1 = Set rule on, meaning that a payment date is always the last actual day of the month.

Data Types: logical

Output Arguments

collapse all

Time layout for the CIRTree, returned as a structure.

Version History

Introduced in R2018a

expand all