Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CME::Impl Class Reference
+ Inheritance diagram for CME::Impl:
+ Collaboration diagram for CME::Impl:

Public Member Functions

std::string name () const override
 
bool isBusinessDay (const QuantLib::Date &d) const override
 

Detailed Description

Definition at line 36 of file cme.hpp.

Member Function Documentation

◆ name()

std::string name ( ) const
override

Definition at line 38 of file cme.hpp.

38{ return "CME Group"; }

◆ isBusinessDay()

bool isBusinessDay ( const QuantLib::Date &  d) const
override

Definition at line 32 of file cme.cpp.

32 {
33
34 Weekday w = date.weekday();
35 Day d = date.dayOfMonth();
36 Month m = date.month();
37 Year y = date.year();
38
39 Day dd = date.dayOfYear();
40 Day em = easterMonday(y);
41
42 if (isWeekend(w)
43 // New Year's Day (possibly moved to Monday if on Sunday)
44 || ((d == 1 || (d == 2 && w == Monday)) && m == January)
45 // Martin Luther King's birthday (third Monday in January)
46 || (y >= 1998 && (d >= 15 && d <= 21) && w == Monday && m == January)
47 // Washington's birthday (third Monday in February)
48 || ((d >= 15 && d <= 21) && w == Monday && m == February)
49 // Good Friday
50 || (dd == em - 3)
51 // Memorial Day (last Monday in May)
52 || (d >= 25 && w == Monday && m == May)
53 // Independence Day (Monday if Sunday or Friday if Saturday)
54 || ((d == 4 || (d == 5 && w == Monday) || (d == 3 && w == Friday)) && m == July)
55 // Labor Day (first Monday in September)
56 || (d <= 7 && w == Monday && m == September)
57 // Thanksgiving Day (fourth Thursday in November)
58 || ((d >= 22 && d <= 28) && w == Thursday && m == November)
59 // Christmas (Monday if Sunday or Friday if Saturday)
60 || ((d == 25 || (d == 26 && w == Monday) || (d == 24 && w == Friday)) && m == December))
61 return false;
62
63 return true;
64}