net.finmath.time.daycount
Class DayCountConvention_30U_360
- java.lang.Object
-
- net.finmath.time.daycount.DayCountConvention_30U_360
-
- All Implemented Interfaces:
- DayCountConventionInterface
public class DayCountConvention_30U_360 extends java.lang.Object implements DayCountConventionInterface
Calculates the day count using the US 30/360 adjusted method. The daycount is calculated via(endDateYear - startDateYear) * 360.0 + (endDateMonth - startDateMonth) * 30.0 + (endDateDay - startDateDay)where startDateDay and endDateDay are adjusted towards 30, when being larger than 30 or if isEndOfMonth, also if they fall on the last day of February. See 30/360 US definition for details. This day count convention is sometime called Bond basis.-
The method
getDaycountcorresponds to the implementation of the "US method" of Excel function DAYS360, i.e., DAYS360(startDate,endDate,FALSE). -
The method
getDaycountFractioncorresponds to the implementation of the "30U/360 method" of Excel function YEARFRAC, i.e., YEARFRAC(startDate,endDate,0).
-
-
Constructor Summary
Constructors Constructor and Description DayCountConvention_30U_360()Create a 30U/360 day count convention.DayCountConvention_30U_360(boolean isEndOfMonth)Create a 30U/360 day count convention.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetDaycount(java.util.Calendar startDate, java.util.Calendar endDate)Return the number of days between startDate and endDate given the specific daycount convention.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.
-
-
-
Constructor Detail
-
DayCountConvention_30U_360
public DayCountConvention_30U_360()
Create a 30U/360 day count convention.
-
DayCountConvention_30U_360
public DayCountConvention_30U_360(boolean isEndOfMonth)
Create a 30U/360 day count convention.- Parameters:
isEndOfMonth- If true, an end-of-month day will always count as "30", even if we are in February.
-
-
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.
-
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.- Specified by:
getDaycountFractionin interfaceDayCountConventionInterface- Parameters:
startDate- The start date given as aCalendar.endDate- The end date given as aCalendar.- Returns:
- The daycount fraction corresponding to the given period.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG