Class FloatingpointDate

java.lang.Object
net.finmath.time.FloatingpointDate

public class FloatingpointDate extends Object
This class provides the library wide conversion from a floating point number to a LocalDate. While in practical applications a date or time should always be represented with a proper date class, e.g. LocalDate or LocalDateTime. In financial applications the measurement of time distances has to be based on a solid definition, e.g., daycount conventions to calculate daycount fractions. However, many mathematical models described in text books rely on time being modeled as some real value \( t \). To allow for both approaches to co-exists this class fixes the interpretation of a floating point number representing time, unless otherwise specified. So it still possible that models use their own "conversion". Examples where the specification of this contract is important: - the way of measuring time in an NSS curve determines the interpretation of the NSS parameters. - in the textbook Black-Scholes models, multiplying volatility by W(t), changing from an ACT/365 to ACT/360 would represent a re-scaling of the volatilities. The specification of this internal time representation is to some extend just a convention which defines the unit of internal model parameters. A constant volatility measured against a floating point time ACT/365 corresponds 1:1: to a constant volatility measure again a floating point time ACT/360 with a conversion factor of 360/365. However, the situation is not always trivial, since a constant volatility measured against a floating point time ACT/365 would correspond to a weakly time-dependent volatility volatility measured against ACT/ACT. Such nuances represent differences in the model, a model calibration will ensure that the parameters are choosen such that the model matches observed quantities independent from the convention used to express internal model parameters.
Version:
1.1
Author:
Christian Fries
  • Method Details

    • getDateFromFloatingPointDate

      public static LocalDateTime getDateFromFloatingPointDate(LocalDateTime referenceDate, double floatingPointDate)
      Convert a floating point date to a LocalDateTime. Note: This method currently performs a rounding to the next second. If referenceDate is null, the method returns null.
      Parameters:
      referenceDate - The reference date associated with \( t=0 \).
      floatingPointDate - The value to the time offset \( t \).
      Returns:
      The date resulting from adding Math.round(fixingTime*SECONDS_PER_DAY) seconds to referenceDate, where one day has SECONDS_PER_DAY seconds and SECONDS_PER_DAY is a constant 365*24*60*60
    • getFloatingPointDateFromDate

      public static double getFloatingPointDateFromDate(LocalDateTime referenceDate, LocalDateTime date)
      Convert a given date to a floating point date using a given reference date.
      Parameters:
      referenceDate - The reference date associated with \( t=0 \).
      date - The given date to be associated with the return value \( T \).
      Returns:
      The value T measuring the distance of reference date and date by ACT/365 with SECONDS_PER_DAY seconds used as the smallest time unit and SECONDS_PER_DAY is a constant 365*24*60*60.
    • getDateFromFloatingPointDate

      public static LocalDate getDateFromFloatingPointDate(LocalDate referenceDate, double floatingPointDate)
      Convert a floating point date to a LocalDate. Note: This method currently performs a rounding to the next day. In a future extension intra-day time offsets may be considered. If referenceDate is null, the method returns null.
      Parameters:
      referenceDate - The reference date associated with \( t=0 \).
      floatingPointDate - The value to the time offset \( t \).
      Returns:
      The date resulting from adding Math.round(fixingTime*365.0) days to referenceDate.
    • getFloatingPointDateFromDate

      public static double getFloatingPointDateFromDate(LocalDate referenceDate, LocalDate date)
      Convert a given date to a floating point date using a given reference date.
      Parameters:
      referenceDate - The reference date associated with \( t=0 \).
      date - The given daten to be associated with the return value \( T \).
      Returns:
      The value T measuring the distance of reference date and date by ACT/365.