Class TenorFromArray

All Implemented Interfaces:
Serializable, Iterable<Double>, Tenor, TimeDiscretization

public class TenorFromArray extends TimeDiscretizationFromArray implements Tenor
Implements a time discretization based on dates using a reference date and an daycount convention / year fraction. The time as a double is represented as the year fraction from the reference date.
Version:
1.0
Author:
Christian Fries
See Also:
  • Constructor Details

    • TenorFromArray

      public TenorFromArray(LocalDate[] dates, LocalDate referenceDate)
      Parameters:
      dates - A set of dates.
      referenceDate - The reference date, which defines t=0 with respect to the internal double representation.
    • TenorFromArray

      public TenorFromArray(double[] timeDiscretization)
      Construct a tenor from a time discretization.
      Parameters:
      timeDiscretization - A time discretization.
    • TenorFromArray

      public TenorFromArray(Double[] timeDiscretization)
      Construct a tenor from a time discretization.
      Parameters:
      timeDiscretization - A time discretization.
    • TenorFromArray

      public TenorFromArray(double initial, int numberOfTimeSteps, double deltaT)
      Construct a tenor from meta data.
      Parameters:
      initial - First discretization point.
      numberOfTimeSteps - Number of time steps.
      deltaT - Time step size.
    • TenorFromArray

      public TenorFromArray(double initial, double last, double deltaT, TimeDiscretizationFromArray.ShortPeriodLocation shortPeriodLocation)
      Construct a tenor from meta data.
      Parameters:
      initial - First discretization point.
      last - Last time steps.
      deltaT - Time step size.
      shortPeriodLocation - Placement of the stub period.
  • Method Details

    • getReferenceDate

      public LocalDate getReferenceDate()
      Specified by:
      getReferenceDate in interface Tenor
      Returns:
      The reference date of this tenor, i.e., the date mapped to 0.0
    • getDate

      public LocalDate getDate(int timeIndex)
      Description copied from interface: Tenor
      Returns the date for the given time index.
      Specified by:
      getDate in interface Tenor
      Parameters:
      timeIndex - Time index
      Returns:
      Returns the date for a given time index.
    • getDaycountFraction

      public double getDaycountFraction(int timeIndex)
      Description copied from interface: Tenor
      Returns the day count fraction for the period form timeIndex to to timeIndex+1.
      Specified by:
      getDaycountFraction in interface Tenor
      Parameters:
      timeIndex - Time index
      Returns:
      Returns the day count fraction.
    • toString

      public String toString()
      Overrides:
      toString in class TimeDiscretizationFromArray