Class PeriodActualTenorConverter
- java.lang.Object
-
- com.activeviam.risk.core.dates.impl.PeriodActualTenorConverter
-
- All Implemented Interfaces:
ITenorConverter
public class PeriodActualTenorConverter extends Object implements ITenorConverter
Simple implementation ofITenorConverter
.Supported tenors are:
- ON: "Overnight"
- TN: "Tomorrow Next"
- ISO-8601 periods, implemented using
Period.parse(CharSequence)
. If not present, a "P" will be prepended to the tenor before parsing.
-
-
Constructor Summary
Constructors Constructor Description PeriodActualTenorConverter(String tenorAndMaturityDefaultValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalDate
convert(com.qfs.store.IDatastoreVersion datastore, LocalDate asOfDate, BucketType bucketType, String tenorSet, String tenor, IBusinessDayConvention businessDayConvention, IBusinessDayCalendar calendar)
Given an as-of-date and a String representation of a tenor, returns the LocalDate representation of the tenor (after application of business day convention).LocalDate
convert(LocalDate asOfDate, String tenor, IBusinessDayConvention businessDayConvention, IBusinessDayCalendar calendar)
Given an as-of-date and a String representation of a tenor, returns the LocalDate representation of the tenor (after application of business day convention).protected LocalDate
nextBusinessDay(LocalDate asOfDate, IBusinessDayCalendar calendar)
protected Period
tryISO8601Period(String tenor)
Try to parse the tenor as a ISO-8601 period
-
-
-
Constructor Detail
-
PeriodActualTenorConverter
public PeriodActualTenorConverter(String tenorAndMaturityDefaultValue)
-
-
Method Detail
-
convert
public LocalDate convert(com.qfs.store.IDatastoreVersion datastore, LocalDate asOfDate, BucketType bucketType, String tenorSet, String tenor, IBusinessDayConvention businessDayConvention, IBusinessDayCalendar calendar) throws ParseException
Description copied from interface:ITenorConverter
Given an as-of-date and a String representation of a tenor, returns the LocalDate representation of the tenor (after application of business day convention).- Specified by:
convert
in interfaceITenorConverter
- Parameters:
datastore
- The datastore version.asOfDate
- The initial as-of-date.bucketType
- The tenor store.tenorSet
- The tenor set.tenor
- The String representation of a tenor.businessDayConvention
- The business day convention to use.calendar
- the business day calendar.- Returns:
- The LocalDate represented by the input tenor or date, given the as-of-date.
- Throws:
ParseException
- the tenor is not recognized.
-
convert
public LocalDate convert(LocalDate asOfDate, String tenor, IBusinessDayConvention businessDayConvention, IBusinessDayCalendar calendar) throws ParseException
Description copied from interface:ITenorConverter
Given an as-of-date and a String representation of a tenor, returns the LocalDate representation of the tenor (after application of business day convention).- Specified by:
convert
in interfaceITenorConverter
- Parameters:
asOfDate
- The initial as-of-date.tenor
- The String representation of a tenor.businessDayConvention
- The business day convention to use.calendar
- the business day calendar.- Returns:
- The LocalDate represented by the input tenor or date, given the as-of-date.
- Throws:
ParseException
- the tenor is not recognized.
-
nextBusinessDay
protected LocalDate nextBusinessDay(LocalDate asOfDate, IBusinessDayCalendar calendar)
-
-