Business Day Lookup
KODIAK Oms Client & Server use the following implementation of getting valid trade dates and settlement dates. The Bond calculator control how ever uses the LMD webservice, for exampleapi.livemarketdata.com/v1/static_data/v1/next_settlementday/
.
public class Iceland : Calendar
{
public Iceland()
{
// Vegna breytinga á uppgjörsdögum hjá Verðbréfaskráningu
this.addedHolidays.Add(new DateTime(2020, 8, 24));
}
public override string CountryCode { get { return "IS"; } }
public override bool IsBusinessDay(DateTime date)
{
if (addedHolidays.Contains(date.Date))
return false;
if (removedHolidays.Contains(date.Date))
return true;
DayOfWeek w = date.DayOfWeek;
int d = date.Day, dd = date.DayOfYear;
int m = date.Month;
int y = date.Year;
int em = EasterMonday(y);
if (IsWeekend(w)
// New Year's Day (possibly moved to Monday)
//|| ((d == 1 || ((d == 2 || d == 3) && w == DayOfWeek.Monday)) && m == (int)Month.January)
|| (d == 1 && m == (int)Month.January)
// Holy Thursday
|| (dd == em - 4)
// Good Friday
|| (dd == em - 3)
// Easter Monday
|| (dd == em)
// First day of Summer
|| (d >= 19 && d <= 25 && w == DayOfWeek.Thursday && m == (int)Month.April)
// Ascension Thursday
|| (dd == em + 38)
// Pentecost Monday
|| (dd == em + 49)
// Labour Day
|| (d == 1 && m == (int)Month.May)
// Independence Day
|| (d == 17 && m == (int)Month.June)
// Commerce Day
|| (d <= 7 && w == DayOfWeek.Monday && m == (int)Month.August)
// Christmas Eve
|| (d == 24 && m == (int)Month.December)
// Christmas Day
|| (d == 25 && m == (int)Month.December)
// Boxing Day
|| (d == 26 && m == (int)Month.December))
return false;
return true;
}
}
public class Denmark : Calendar
{
public override string CountryCode
{
get { return "DK"; }
}
public override bool IsBusinessDay(DateTime date)
{
if (addedHolidays.Contains(date.Date))
return false;
if (removedHolidays.Contains(date.Date))
return true;
DayOfWeek w = date.DayOfWeek;
int d = date.Day, dd = date.DayOfYear;
Month m = (Month)date.Month;
int y = date.Year;
int em = EasterMonday(y);
if (IsWeekend(w)
// Maunday Thursday
|| (dd == em - 4)
// Good Friday
|| (dd == em - 3)
// Easter Monday
|| (dd == em)
// General Prayer Day
|| (dd == em + 25)
// Ascension
|| (dd == em + 38)
// Whit Monday
|| (dd == em + 49)
// New Year's Day
|| (d == 1 && m == Month.January)
// Constitution Day, June 5th
|| (d == 5 && m == Month.June)
// Christmas
|| (d == 25 && m == Month.December)
// Boxing Day
|| (d == 26 && m == Month.December))
return false;
return true;
}
}
public class Finland : Calendar
{
public override string CountryCode
{
get { return "FI"; }
}
public override bool IsBusinessDay(DateTime date)
{
if (addedHolidays.Contains(date.Date))
return false;
if (removedHolidays.Contains(date.Date))
return true;
DayOfWeek w = date.DayOfWeek;
int d = date.Day, dd = date.DayOfYear;
Month m = (Month)date.Month;
int y = date.Year;
int em = EasterMonday(y);
if (IsWeekend(w)
// New Year's Day
|| (d == 1 && m == Month.January)
// Epiphany
|| (d == 6 && m == Month.January)
// Good Friday
|| (dd == em - 3)
// Easter Monday
|| (dd == em)
// Ascension Thursday
|| (dd == em + 38)
// Labour Day
|| (d == 1 && m == Month.May)
// Midsummer Eve (Friday between June 18-24)
|| (w == DayOfWeek.Friday && (d >= 18 && d <= 24) && m == Month.June)
// Independence Day
|| (d == 6 && m == Month.December)
// Christmas Eve
|| (d == 24 && m == Month.December)
// Christmas
|| (d == 25 && m == Month.December)
// Boxing Day
|| (d == 26 && m == Month.December))
return false;
return true;
}
}