Class DayCountConventionFactory

  • All Implemented Interfaces:
    Serializable

    public class DayCountConventionFactory
    extends Object
    implements Serializable
    Factory methods for day count conventions.
    Version:
    1.0
    Author:
    Christian Fries
    See Also:
    Serialized Form
    • Method Detail

      • getDayCountConvention

        public static DayCountConvention getDayCountConvention​(String convention)
        Create a day count convention base on a convention string. The follwoing convention strings are supported
        • act/act isda
        • 30/360
        • 30E/360
        • 30U/360
        • act/360
        • act/365
        • act/act yearfrac
        Parameters:
        convention - A convention string.
        Returns:
        A day count convention object.
      • getDaycount

        public static double getDaycount​(LocalDate startDate,
                                         LocalDate endDate,
                                         String convention)
        Return the number of days between startDate and endDate given the specific daycount convention.
        Parameters:
        startDate - The start date given as a LocalDate.
        endDate - The end date given as a LocalDate.
        convention - A convention string.
        Returns:
        The number of days within the given period.
      • getDaycountFraction

        public static double getDaycountFraction​(LocalDate startDate,
                                                 LocalDate endDate,
                                                 String convention)
        Return the daycount fraction corresponding to the period from startDate to endDate given the specific daycount convention.
        Parameters:
        startDate - The start date given as a LocalDate.
        endDate - The end date given as a LocalDate.
        convention - A convention string.
        Returns:
        The daycount fraction corresponding to the given period.