corda / net.corda.finance.contracts / BusinessCalendar

BusinessCalendar

open class BusinessCalendar

A business calendar performs date calculations that take into account national holidays and weekends. This is a typical feature of financial contracts, in which a business may not want a payment event to fall on a day when no staff are around to handle problems.

Constructors

<init>

A business calendar performs date calculations that take into account national holidays and weekends. This is a typical feature of financial contracts, in which a business may not want a payment event to fall on a day when no staff are around to handle problems.

BusinessCalendar(holidayDates: SortedSet<LocalDate>)

Properties

holidayDates

val holidayDates: SortedSet<LocalDate>

Functions

applyRollConvention

open fun applyRollConvention(testDate: LocalDate, dateRollConvention: DateRollConvention): LocalDate

equals

open fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

isWorkingDay

open fun isWorkingDay(date: LocalDate): Boolean

moveBusinessDays

Returns a date which is the inbound date plus/minus a given number of business days. TODO: Make more efficient if necessary

fun moveBusinessDays(date: LocalDate, direction: DateRollDirection, i: Int): LocalDate

plus

operator fun plus(other: BusinessCalendar): BusinessCalendar

toString

open fun toString(): String

Companion Object Properties

EMPTY

val EMPTY: BusinessCalendar

Companion Object Functions

calculateDaysBetween

fun calculateDaysBetween(startDate: LocalDate, endDate: LocalDate, dcbYear: DayCountBasisYear, dcbDay: DayCountBasisDay): Int

createGenericSchedule

Calculates an event schedule that moves events around to ensure they fall on working days.

fun createGenericSchedule(startDate: LocalDate, period: Frequency, calendar: BusinessCalendar = EMPTY, dateRollConvention: DateRollConvention = DateRollConvention.Following, noOfAdditionalPeriods: Int = Integer.MAX_VALUE, endDate: LocalDate? = null, periodOffset: Int? = null): List<LocalDate>

getOffsetDate

Calculates the date from @startDate moving forward 'steps' of time size 'period'. Does not apply calendar logic / roll conventions.

fun getOffsetDate(startDate: LocalDate, period: Frequency, steps: Int = 1): LocalDate

parseDateFromString

Parses a date of the form YYYY-MM-DD, like 2016-01-10 for 10th Jan.

fun parseDateFromString(it: String): LocalDate