net.finmath.time.daycount
Class DayCountConvention_ACT_ACT_AFB
- java.lang.Object
-
- net.finmath.time.daycount.DayCountConvention_ACT
-
- net.finmath.time.daycount.DayCountConvention_ACT_ACT_AFB
-
- All Implemented Interfaces:
- DayCountConventionInterface
public class DayCountConvention_ACT_ACT_AFB extends DayCountConvention_ACT
Implementation of ACT/ACT AFB. Calculates the day count by calculating the actual number of days between startDate and endDate. The method is only exact, if the two calendar dates are (approximately) on the same time. A fractional day is rounded to the approximately nearest day (since daylight saving is not considered, the notion of nearest may be off by one hour). The day count fraction is calculated using ACT_ACT_AFB convention. The algorithm works as follows:-
If the interval from startDate to endDate spans more than a whole year, then
the number of whole years is subtracted from the endDate year and added (as an integer) to the day count fraction.
Here, subtraction of whole year(s) means:
- If the end date is on a February 29th and the resulting day is not in a leap year, it will be set to February 28th of that year (i.e., we preserve "end of month").
- If the end date is on a February 28th of a non-leap year and the resulting day is in a leap year, it will be on February 29th of that year (i.e., we preserve "end of month").
- Otherwise the resulting day has the same day of month and the same month as the end year.
- For the remaining interval the actual number of days is divided by a denominator, where the denominator is 366.0 if February 29th is in between start and end and 365.0 otherwise.
-
-
Constructor Summary
Constructors Constructor and Description DayCountConvention_ACT_ACT_AFB()Create an ACT/ACT FBA daycount convention.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetDaycountFraction(java.util.Calendar startDate, java.util.Calendar endDate)Return the daycount fraction corresponding to the period from startDate to endDate given the specific daycount convention.java.lang.StringtoString()-
Methods inherited from class net.finmath.time.daycount.DayCountConvention_ACT
daysBetween, getDaycount
-
-
-
-
Constructor Detail
-
DayCountConvention_ACT_ACT_AFB
public DayCountConvention_ACT_ACT_AFB()
Create an ACT/ACT FBA daycount convention.
-
-
Method Detail
-
getDaycountFraction
public double getDaycountFraction(java.util.Calendar startDate, java.util.Calendar endDate)Description copied from interface:DayCountConventionInterfaceReturn the daycount fraction corresponding to the period from startDate to endDate given the specific daycount convention.- Parameters:
startDate- The start date given as aCalendar.endDate- The end date given as aCalendar.- Returns:
- The daycount fraction corresponding to the given period.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG