Class AMaturityConverter

    • Field Detail

      • NOT_DOUBLE

        protected Pattern NOT_DOUBLE
        Want to interpret "2D" as two days and not 2.0
    • Constructor Detail

      • AMaturityConverter

        public AMaturityConverter()
    • Method Detail

      • getQueryCache

        protected com.quartetfs.biz.pivot.query.IQueryCache getQueryCache​(com.quartetfs.biz.pivot.IActivePivot pivot)
        Return the query cache bound to the current query. This cache contains values that can be shared among post processors involved in a query. The values in this cache are never shared with other queries.

        The query cache itself is thread-safe, actually implementing the concurrent map interface.

        Parameters:
        pivot - pivot
        Returns:
        current query cache, it is never null
      • toFraction

        public double toFraction​(com.quartetfs.biz.pivot.IActivePivot pivot,
                                 LocalDate asOfDate,
                                 BucketType bucketType,
                                 String tenorSet,
                                 String tenorOrDate,
                                 List<Object> leafCoordinates)
        Description copied from interface: IMaturityConverter
        Calculate a fraction between the asOfDate and the tenorOrDate. That fraction is an implementation detail and can be: a number of days, a year fraction, a fraction between two double values (e.g. between two strike values) etc. Extra parameters are required for query-time conversion.
        Specified by:
        toFraction in interface IMaturityConverter
        Parameters:
        pivot - The ActivePivot instance.
        asOfDate - The initial as-of-date.
        bucketType - The tenor store.
        tenorSet - The tenor set.
        tenorOrDate - The String representation of a tenor or date or number of days.
        leafCoordinates - Leaf coordinates required for query-time conversion.
        Returns:
        a long representing a number of days
      • tryParseAsDaysBetween

        protected Double tryParseAsDaysBetween​(String tenorOrDate)
        try converting tenorOrDate directly to the number of days by parsing it as a double.
        Parameters:
        tenorOrDate - the String representation of a tenor or date or number of days.
        Returns:
        the number of days if applicable, or null if tenorOrDate could not be parsed as a number of days.
      • dayCount

        protected long dayCount​(com.quartetfs.biz.pivot.IActivePivot pivot,
                                LocalDate start,
                                LocalDate end,
                                List<Object> leafCoordinates)
        Given start and end dates, calculate the number of days between them.

        This method uses the IDayCountConvention returned by getDayCountConvention(IActivePivot, List)

        Parameters:
        pivot - The ActivePivot instance.
        start - The start date.
        end - The end date.
        leafCoordinates - Leaf coordinates required for query-time conversion.
        Returns:
        a long representing a number of days.
      • toDate

        public LocalDate toDate​(com.quartetfs.biz.pivot.IActivePivot pivot,
                                LocalDate asOfDate,
                                BucketType bucketType,
                                String tenorSet,
                                String tenorOrDate,
                                List<Object> leafCoordinates)
        Description copied from interface: IMaturityConverter
        Convert tenorOrDate to a LocalDate. Extra parameters are required for query-time conversion.
        Specified by:
        toDate in interface IMaturityConverter
        Parameters:
        pivot - The ActivePivot instance.
        asOfDate - The initial as-of-date, for use with tenors.
        bucketType - The tenor store.
        tenorSet - The tenor set.
        tenorOrDate - The String representation of a tenor or date.
        leafCoordinates - Leaf coordinates required for query-time conversion.
        Returns:
        The LocalDate represented by tenorOrDate.
      • tryParseAsDate

        protected LocalDate tryParseAsDate​(String tenorOrDate)
        Try converting tenorOrDate directly to a date by parsing it as a date.
        Parameters:
        tenorOrDate - the String representation of a tenor or date.
        Returns:
        the date if applicable, or null if tenorOrDate could not be parsed as a date.
      • getDayCountConvention

        protected abstract IDayCountConvention getDayCountConvention​(com.quartetfs.biz.pivot.IActivePivot pivot,
                                                                     List<Object> leafCoordinates)
      • getTenorConverter

        protected abstract ITenorConverter getTenorConverter​(com.quartetfs.biz.pivot.IActivePivot pivot,
                                                             List<Object> leafCoordinates,
                                                             BucketType bucketType)
      • getBusinessDayConvention

        protected abstract IBusinessDayConvention getBusinessDayConvention​(com.quartetfs.biz.pivot.IActivePivot pivot,
                                                                           List<Object> leafCoordinates)
      • getBusinessDayCalendar

        protected abstract IBusinessDayCalendar getBusinessDayCalendar​(com.quartetfs.biz.pivot.IActivePivot pivot,
                                                                       List<Object> leafCoordinates)