net.finmath.time.daycount
Class DayCountConvention_ACT
- java.lang.Object
-
- net.finmath.time.daycount.DayCountConvention_ACT
-
- All Implemented Interfaces:
- DayCountConventionInterface
- Direct Known Subclasses:
- DayCountConvention_ACT_360, DayCountConvention_ACT_365, DayCountConvention_ACT_365A, DayCountConvention_ACT_365L, DayCountConvention_ACT_ACT_AFB, DayCountConvention_ACT_ACT_ICMA, DayCountConvention_ACT_ACT_ISDA, DayCountConvention_ACT_ACT_YEARFRAC
public abstract class DayCountConvention_ACT extends java.lang.Object implements DayCountConventionInterface
Base class which 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).
-
-
Constructor Summary
Constructors Constructor and Description DayCountConvention_ACT()Create an ACT day count convention.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static doubledaysBetween(java.util.Calendar startDate, java.util.Calendar endDate)Returns the number of days, between two Calendar dates.doublegetDaycount(java.util.Calendar startDate, java.util.Calendar endDate)Return the number of days between startDate and endDate given the specific daycount convention.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.finmath.time.daycount.DayCountConventionInterface
getDaycountFraction
-
-
-
-
Constructor Detail
-
DayCountConvention_ACT
public DayCountConvention_ACT()
Create an ACT day count convention.
-
-
Method Detail
-
getDaycount
public double getDaycount(java.util.Calendar startDate, java.util.Calendar endDate)Description copied from interface:DayCountConventionInterfaceReturn the number of days between startDate and endDate given the specific daycount convention.- Specified by:
getDaycountin interfaceDayCountConventionInterface- Parameters:
startDate- The start date given as aCalendar.endDate- The end date given as aCalendar.- Returns:
- The number of days within the given period.
-
daysBetween
public static double daysBetween(java.util.Calendar startDate, java.util.Calendar endDate)Returns the number of days, between two Calendar dates. 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 formula implemented isMath.round( ((double)(endDate.getTimeInMillis()-startDate.getTimeInMillis())) / 1000.0 / 60.0 / 60.0 / 24)For more accurate calculation consider org.joda.time.Days.
However, the method is correct if each calendar is on the same time and they differ only by days.
- Parameters:
startDate- The start date of the interval.endDate- The end date of the interval.- Returns:
- Number of days between startDate and endDate.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG