17 using System.Collections.Generic;
32 Func<DateTime, DateTime> result;
39 throw new ArgumentException($
"Expiry function not implemented for {symbol} in FuturesExpiryFunctions.FuturesExpiryDictionary");
48 public static Dictionary<DateTime, DateTime>
DairyReportDates =
new Dictionary<DateTime, DateTime>()
50 {
new DateTime(2012, 3, 1),
new DateTime(2012, 4, 2) },
51 {
new DateTime(2012, 4, 1),
new DateTime(2012, 5, 2) },
52 {
new DateTime(2012, 5, 1),
new DateTime(2012, 5, 31) },
53 {
new DateTime(2012, 6, 1),
new DateTime(2012, 7, 5) },
54 {
new DateTime(2012, 7, 1),
new DateTime(2012, 8, 1) },
55 {
new DateTime(2012, 8, 1),
new DateTime(2012, 8, 29) },
56 {
new DateTime(2012, 9, 1),
new DateTime(2012, 10, 3) },
57 {
new DateTime(2012, 10, 1),
new DateTime(2012, 10, 31) },
58 {
new DateTime(2012, 11, 1),
new DateTime(2012, 12, 5) },
59 {
new DateTime(2012, 12, 1),
new DateTime(2013, 1, 3) },
60 {
new DateTime(2013, 1, 1),
new DateTime(2013, 1, 30) },
61 {
new DateTime(2013, 2, 1),
new DateTime(2013, 2, 27) },
62 {
new DateTime(2013, 3, 1),
new DateTime(2013, 4, 3) },
63 {
new DateTime(2013, 4, 1),
new DateTime(2013, 5, 1) },
64 {
new DateTime(2013, 5, 1),
new DateTime(2013, 6, 5) },
65 {
new DateTime(2013, 6, 1),
new DateTime(2013, 7, 3) },
66 {
new DateTime(2013, 7, 1),
new DateTime(2013, 7, 31) },
67 {
new DateTime(2013, 8, 1),
new DateTime(2013, 9, 5) },
68 {
new DateTime(2013, 9, 1),
new DateTime(2013, 10, 18) },
69 {
new DateTime(2013, 10, 1),
new DateTime(2013, 10, 30) },
70 {
new DateTime(2013, 11, 1),
new DateTime(2013, 12, 4) },
71 {
new DateTime(2013, 12, 1),
new DateTime(2014, 1, 2) },
72 {
new DateTime(2014, 1, 1),
new DateTime(2014, 2, 5) },
73 {
new DateTime(2014, 2, 1),
new DateTime(2014, 3, 5) },
74 {
new DateTime(2014, 3, 1),
new DateTime(2014, 4, 2) },
75 {
new DateTime(2014, 4, 1),
new DateTime(2014, 4, 30) },
76 {
new DateTime(2014, 5, 1),
new DateTime(2014, 6, 4) },
77 {
new DateTime(2014, 6, 1),
new DateTime(2014, 7, 2) },
78 {
new DateTime(2014, 7, 1),
new DateTime(2014, 7, 30) },
79 {
new DateTime(2014, 8, 1),
new DateTime(2014, 9, 4) },
80 {
new DateTime(2014, 9, 1),
new DateTime(2014, 10, 1) },
81 {
new DateTime(2014, 10, 1),
new DateTime(2014, 11, 5) },
82 {
new DateTime(2014, 11, 1),
new DateTime(2014, 12, 3) },
83 {
new DateTime(2014, 12, 1),
new DateTime(2014, 12, 31) },
84 {
new DateTime(2015, 1, 1),
new DateTime(2015, 2, 4) },
85 {
new DateTime(2015, 2, 1),
new DateTime(2015, 3, 4) },
86 {
new DateTime(2015, 3, 1),
new DateTime(2015, 4, 1) },
87 {
new DateTime(2015, 4, 1),
new DateTime(2015, 4, 29) },
88 {
new DateTime(2015, 5, 1),
new DateTime(2015, 6, 3) },
89 {
new DateTime(2015, 6, 1),
new DateTime(2015, 7, 1) },
90 {
new DateTime(2015, 7, 1),
new DateTime(2015, 8, 5) },
91 {
new DateTime(2015, 8, 1),
new DateTime(2015, 9, 2) },
92 {
new DateTime(2015, 9, 1),
new DateTime(2015, 9, 30) },
93 {
new DateTime(2015, 10, 1),
new DateTime(2015, 11, 4) },
94 {
new DateTime(2015, 11, 1),
new DateTime(2015, 12, 2) },
95 {
new DateTime(2015, 12, 1),
new DateTime(2015, 12, 30) },
96 {
new DateTime(2016, 1, 1),
new DateTime(2016, 2, 3) },
97 {
new DateTime(2016, 2, 1),
new DateTime(2016, 3, 2) },
98 {
new DateTime(2016, 3, 1),
new DateTime(2016, 3, 30) },
99 {
new DateTime(2016, 4, 1),
new DateTime(2016, 5, 4) },
100 {
new DateTime(2016, 5, 1),
new DateTime(2016, 6, 2) },
101 {
new DateTime(2016, 6, 1),
new DateTime(2016, 6, 29) },
102 {
new DateTime(2016, 7, 1),
new DateTime(2016, 8, 3) },
103 {
new DateTime(2016, 8, 1),
new DateTime(2016, 8, 31) },
104 {
new DateTime(2016, 9, 1),
new DateTime(2016, 10, 5) },
105 {
new DateTime(2016, 10, 1),
new DateTime(2016, 11, 2) },
106 {
new DateTime(2016, 11, 1),
new DateTime(2016, 11, 30) },
107 {
new DateTime(2016, 12, 1),
new DateTime(2017, 1, 5) },
108 {
new DateTime(2017, 1, 1),
new DateTime(2017, 2, 1) },
109 {
new DateTime(2017, 2, 1),
new DateTime(2017, 3, 1) },
110 {
new DateTime(2017, 3, 1),
new DateTime(2017, 4, 5) },
111 {
new DateTime(2017, 4, 1),
new DateTime(2017, 5, 3) },
112 {
new DateTime(2017, 5, 1),
new DateTime(2017, 6, 1) },
113 {
new DateTime(2017, 6, 1),
new DateTime(2017, 6, 28) },
114 {
new DateTime(2017, 7, 1),
new DateTime(2017, 8, 2) },
115 {
new DateTime(2017, 8, 1),
new DateTime(2017, 8, 30) },
116 {
new DateTime(2017, 9, 1),
new DateTime(2017, 10, 4) },
117 {
new DateTime(2017, 10, 1),
new DateTime(2017, 11, 1) },
118 {
new DateTime(2017, 11, 1),
new DateTime(2017, 11, 29) },
119 {
new DateTime(2017, 12, 1),
new DateTime(2018, 1, 4) },
120 {
new DateTime(2018, 1, 1),
new DateTime(2018, 1, 31) },
121 {
new DateTime(2018, 2, 1),
new DateTime(2018, 2, 28) },
122 {
new DateTime(2018, 3, 1),
new DateTime(2018, 4, 4) },
123 {
new DateTime(2018, 4, 1),
new DateTime(2018, 5, 2) },
124 {
new DateTime(2018, 5, 1),
new DateTime(2018, 5, 31) },
125 {
new DateTime(2018, 6, 1),
new DateTime(2018, 7, 5) },
126 {
new DateTime(2018, 7, 1),
new DateTime(2018, 8, 1) },
127 {
new DateTime(2018, 8, 1),
new DateTime(2018, 8, 29) },
128 {
new DateTime(2018, 9, 1),
new DateTime(2018, 10, 3) },
129 {
new DateTime(2018, 10, 1),
new DateTime(2018, 10, 31) },
130 {
new DateTime(2018, 11, 1),
new DateTime(2018, 12, 5) },
131 {
new DateTime(2018, 12, 1),
new DateTime(2019, 1, 3) },
132 {
new DateTime(2019, 1, 1),
new DateTime(2019, 1, 30) },
133 {
new DateTime(2019, 2, 1),
new DateTime(2019, 2, 27) },
134 {
new DateTime(2019, 3, 1),
new DateTime(2019, 4, 3) },
135 {
new DateTime(2019, 4, 1),
new DateTime(2019, 5, 1) },
136 {
new DateTime(2019, 5, 1),
new DateTime(2019, 6, 5) },
137 {
new DateTime(2019, 6, 1),
new DateTime(2019, 7, 3) },
138 {
new DateTime(2019, 7, 1),
new DateTime(2019, 7, 31) },
139 {
new DateTime(2019, 8, 1),
new DateTime(2019, 9, 5) },
140 {
new DateTime(2019, 9, 1),
new DateTime(2019, 10, 2) },
141 {
new DateTime(2019, 10, 1),
new DateTime(2019, 10, 30) },
142 {
new DateTime(2019, 11, 1),
new DateTime(2019, 12, 4) },
143 {
new DateTime(2019, 12, 1),
new DateTime(2020, 1, 2) },
144 {
new DateTime(2020, 1, 1),
new DateTime(2020, 2, 5) },
145 {
new DateTime(2020, 2, 1),
new DateTime(2020, 3, 4) },
146 {
new DateTime(2020, 3, 1),
new DateTime(2020, 4, 1) },
147 {
new DateTime(2020, 4, 1),
new DateTime(2020, 4, 29) },
148 {
new DateTime(2020, 5, 1),
new DateTime(2020, 6, 3) },
149 {
new DateTime(2020, 6, 1),
new DateTime(2020, 7, 1) },
150 {
new DateTime(2020, 7, 1),
new DateTime(2020, 8, 5) },
151 {
new DateTime(2020, 8, 1),
new DateTime(2020, 9, 2) },
152 {
new DateTime(2020, 9, 1),
new DateTime(2020, 9, 30) },
153 {
new DateTime(2020, 10, 1),
new DateTime(2020, 11, 4) },
154 {
new DateTime(2020, 11, 1),
new DateTime(2020, 12, 2) },
155 {
new DateTime(2020, 12, 1),
new DateTime(2020, 12, 30) },
156 {
new DateTime(2021, 1, 1),
new DateTime(2021, 2, 3) },
157 {
new DateTime(2021, 2, 1),
new DateTime(2021, 3, 3) },
158 {
new DateTime(2021, 3, 1),
new DateTime(2021, 3, 31) },
159 {
new DateTime(2021, 4, 1),
new DateTime(2021, 5, 5) },
160 {
new DateTime(2021, 5, 1),
new DateTime(2021, 6, 3) },
161 {
new DateTime(2021, 6, 1),
new DateTime(2021, 6, 30) },
162 {
new DateTime(2021, 7, 1),
new DateTime(2021, 8, 4) },
163 {
new DateTime(2021, 8, 1),
new DateTime(2021, 9, 1) },
164 {
new DateTime(2021, 9, 1),
new DateTime(2021, 9, 29) },
165 {
new DateTime(2021, 10, 1),
new DateTime(2021, 11, 3) },
166 {
new DateTime(2021, 11, 1),
new DateTime(2021, 12, 1) },
167 {
new DateTime(2021, 12, 1),
new DateTime(2022, 1, 5) },
168 {
new DateTime(2022, 1, 1),
new DateTime(2022, 2, 2) },
169 {
new DateTime(2022, 2, 1),
new DateTime(2022, 3, 2) },
170 {
new DateTime(2022, 3, 1),
new DateTime(2022, 3, 30) },
171 {
new DateTime(2022, 4, 1),
new DateTime(2022, 5, 4) },
172 {
new DateTime(2022, 5, 1),
new DateTime(2022, 6, 2) },
173 {
new DateTime(2022, 6, 1),
new DateTime(2022, 6, 29) },
174 {
new DateTime(2022, 7, 1),
new DateTime(2022, 8, 3) },
175 {
new DateTime(2022, 8, 1),
new DateTime(2022, 8, 31) },
176 {
new DateTime(2022, 9, 1),
new DateTime(2022, 10, 5) },
177 {
new DateTime(2022, 10, 1),
new DateTime(2022, 11, 2) },
178 {
new DateTime(2022, 11, 1),
new DateTime(2022, 11, 30) },
179 {
new DateTime(2022, 12, 1),
new DateTime(2023, 1, 5) },
188 {
new DateTime(2019, 6, 1),
new DateTime(2019, 5, 17) },
189 {
new DateTime(2019, 7, 1),
new DateTime(2019, 6, 15) },
190 {
new DateTime(2019, 8, 1),
new DateTime(2019, 7, 17) },
191 {
new DateTime(2019, 9, 1),
new DateTime(2019, 8, 16) },
192 {
new DateTime(2019, 10, 1),
new DateTime(2019, 9, 14) },
193 {
new DateTime(2019, 11, 1),
new DateTime(2019, 10, 17) },
194 {
new DateTime(2019, 12, 1),
new DateTime(2019, 11, 15) },
195 {
new DateTime(2020, 1, 1),
new DateTime(2019, 12, 14) },
196 {
new DateTime(2020, 2, 1),
new DateTime(2020, 1, 22) },
197 {
new DateTime(2020, 3, 1),
new DateTime(2020, 2, 21) },
198 {
new DateTime(2020, 4, 1),
new DateTime(2020, 3, 21) },
199 {
new DateTime(2020, 5, 1),
new DateTime(2020, 4, 21) },
200 {
new DateTime(2020, 6, 1),
new DateTime(2020, 5, 21) },
201 {
new DateTime(2020, 7, 1),
new DateTime(2020, 6, 23) },
202 {
new DateTime(2020, 8, 1),
new DateTime(2020, 7, 21) },
203 {
new DateTime(2020, 9, 1),
new DateTime(2020, 8, 21) },
204 {
new DateTime(2020, 10, 1),
new DateTime(2020, 9, 22) },
205 {
new DateTime(2020, 11, 1),
new DateTime(2020, 10, 21) },
206 {
new DateTime(2020, 12, 1),
new DateTime(2020, 11, 21) },
207 {
new DateTime(2021, 1, 1),
new DateTime(2020, 12, 22) },
208 {
new DateTime(2021, 2, 1),
new DateTime(2021, 1, 21) },
209 {
new DateTime(2021, 3, 1),
new DateTime(2021, 2, 23) },
210 {
new DateTime(2021, 4, 1),
new DateTime(2021, 3, 23) },
211 {
new DateTime(2021, 5, 1),
new DateTime(2021, 4, 21) },
212 {
new DateTime(2021, 6, 1),
new DateTime(2021, 5, 21) },
213 {
new DateTime(2021, 7, 1),
new DateTime(2021, 6, 22) },
214 {
new DateTime(2021, 8, 1),
new DateTime(2021, 7, 21) },
215 {
new DateTime(2021, 9, 1),
new DateTime(2021, 8, 21) },
216 {
new DateTime(2021, 10, 1),
new DateTime(2021, 9, 21) },
217 {
new DateTime(2021, 11, 1),
new DateTime(2021, 10, 21) },
218 {
new DateTime(2021, 12, 1),
new DateTime(2021, 11, 23) },
219 {
new DateTime(2022, 1, 1),
new DateTime(2021, 12, 21) },
220 {
new DateTime(2022, 2, 1),
new DateTime(2022, 1, 21) },
221 {
new DateTime(2022, 3, 1),
new DateTime(2022, 2, 23) },
222 {
new DateTime(2022, 4, 1),
new DateTime(2022, 3, 22) },
223 {
new DateTime(2022, 5, 1),
new DateTime(2022, 4, 21) },
224 {
new DateTime(2022, 6, 1),
new DateTime(2022, 5, 21) },
225 {
new DateTime(2022, 7, 1),
new DateTime(2022, 6, 21) },
226 {
new DateTime(2022, 8, 1),
new DateTime(2022, 7, 21) },
227 {
new DateTime(2022, 9, 1),
new DateTime(2022, 8, 23) },
228 {
new DateTime(2022, 10, 1),
new DateTime(2022, 9, 21) },
229 {
new DateTime(2022, 11, 1),
new DateTime(2022, 10, 21) },
230 {
new DateTime(2022, 12, 1),
new DateTime(2022, 11, 22) },
238 public static readonly Dictionary<Symbol, Func<DateTime, DateTime>>
FuturesExpiryDictionary =
new Dictionary<Symbol, Func<DateTime, DateTime>>()
297 return lastBusinessDay;
311 return lastBusinessDay;
334 var lastWednesday = (from dateRange in Enumerable.Range(1, DateTime.DaysInMonth(time.Year, time.Month))
335 where
new DateTime(time.Year, time.Month, dateRange).DayOfWeek == DayOfWeek.Wednesday
336 select
new DateTime(time.Year, time.Month, dateRange)).Last();
348 time = time.AddMonths(1);
353 return thirdFriday.Add(
new TimeSpan(13,30,0));
362 time = time.AddMonths(1);
367 return thirdFriday.Add(
new TimeSpan(13,30,0));
376 time = time.AddMonths(1);
381 return thirdFriday.Add(
new TimeSpan(13,30,0));
390 time = time.AddMonths(1);
395 return thirdFriday.Add(
new TimeSpan(13,30,0));
404 time = time.AddMonths(1);
409 return thirdFriday.Add(
new TimeSpan (13,30,0));
421 time = time.AddMonths(1);
426 var priorBusinessDay = secondFriday.AddDays(-1);
429 priorBusinessDay = priorBusinessDay.AddDays(-1);
431 return priorBusinessDay.Add(TimeSpan.FromHours(21));
443 var priorBusinessDay = secondFriday.AddDays(-1);
446 priorBusinessDay = priorBusinessDay.AddDays(-1);
448 return priorBusinessDay.Add(TimeSpan.FromHours(21));
460 time = time.AddMonths(1);
465 var priorBusinessDay = secondFriday.AddDays(-1);
468 priorBusinessDay = priorBusinessDay.AddDays(-1);
470 return priorBusinessDay.Add(TimeSpan.FromHours(21));
485 secondLastBusinessDay = secondLastBusinessDay.AddDays(-1);
487 return secondLastBusinessDay.Add(TimeSpan.FromHours(6));
499 time = time.AddMonths(1);
507 thirdFriday = thirdFriday.AddDays(-1);
521 time = time.AddMonths(1);
529 thirdFriday = thirdFriday.AddDays(-1);
543 time = time.AddMonths(1);
551 thirdFriday = thirdFriday.AddDays(-1);
565 time = time.AddMonths(1);
570 var thursdaypriorsecondFriday = secondFriday.AddDays(-1);
574 thursdaypriorsecondFriday = thursdaypriorsecondFriday.AddDays(-1);
576 return thursdaypriorsecondFriday.Add(TimeSpan.FromHours(21));
588 time = time.AddMonths(1);
593 var thursdaypriorsecondFriday = secondFriday.AddDays(-1);
597 thursdaypriorsecondFriday = thursdaypriorsecondFriday.AddDays(-1);
599 return thursdaypriorsecondFriday.Add(TimeSpan.FromHours(21));
611 time = time.AddMonths(1);
618 thirdFriday = thirdFriday.AddDays(-1);
620 return thirdFriday.Add(
new TimeSpan(13, 30, 0));
632 time = time.AddMonths(1);
639 thirdFriday = thirdFriday.AddDays(-1);
641 return thirdFriday.Add(
new TimeSpan(13, 30, 0));
653 time = time.AddMonths(1);
660 thirdFriday = thirdFriday.AddDays(-1);
662 return thirdFriday.Add(
new TimeSpan(13, 30, 0));
674 time = time.AddMonths(1);
681 thirdFriday = thirdFriday.AddDays(-1);
683 return thirdFriday.Add(
new TimeSpan(13, 30, 0));
694 var expiryDate = nextThirdFriday.AddDays(-30);
698 if (holidays.Contains(expiryDate) || holidays.Contains(nextThirdFriday))
700 expiryDate = expiryDate.AddDays(-1);
703 return expiryDate.Add(
new TimeSpan(13, 0, 0));
715 time = time.AddMonths(1);
721 return thirdWednesday.Add(
new TimeSpan(18, 30, 0));
733 time = time.AddMonths(1);
740 return thirdFriday.Add(
new TimeSpan(13, 30, 0));
749 time = time.AddMonths(1);
762 time = time.AddMonths(1);
790 time = time.AddMonths(1);
794 var wednesdays = (from dateRange in Enumerable.Range(1, DateTime.DaysInMonth(time.Year, time.Month))
795 where
new DateTime(time.Year, time.Month, dateRange).DayOfWeek == DayOfWeek.Wednesday
796 select
new DateTime(time.Year, time.Month, dateRange));
798 var distanceFromFifteenthDay = wednesdays.Select(x => Math.Abs(15 - x.Day)).ToList();
799 var wednesdayIndex = distanceFromFifteenthDay.IndexOf(distanceFromFifteenthDay.Min());
800 var closestWednesday = wednesdays.ElementAt(wednesdayIndex);
806 return closestWednesday.Add(
new TimeSpan(20, 0, 0));
820 var priorBusinessDay = secondFriday.AddDays(-1);
824 while (holidays.Contains(priorBusinessDay) || !priorBusinessDay.IsCommonBusinessDay())
826 priorBusinessDay = priorBusinessDay.AddDays(-1);
828 return priorBusinessDay.Add(
new TimeSpan(14, 30, 0));
839 var lastDay =
new DateTime(time.Year, time.Month, DateTime.DaysInMonth(time.Year, time.Month));
840 var priorBusinessDay = lastDay.AddDays(-1);
844 while (holidays.Contains(priorBusinessDay) || !priorBusinessDay.IsCommonBusinessDay())
846 priorBusinessDay = priorBusinessDay.AddDays(-1);
848 return priorBusinessDay.Add(
new TimeSpan(13, 45, 0));
864 while (holidays.Contains(expiryday) || !expiryday.IsCommonBusinessDay())
866 expiryday = expiryday.AddDays(-1);
868 return expiryday.Add(
new TimeSpan(15, 30, 0));
884 while (holidays.Contains(expiryday) || !expiryday.IsCommonBusinessDay())
886 expiryday = expiryday.AddDays(-1);
888 return expiryday.Add(
new TimeSpan(15, 30, 0));
904 while (holidays.Contains(expiryday) || !expiryday.IsCommonBusinessDay())
906 expiryday = expiryday.AddDays(-1);
908 return expiryday.Add(
new TimeSpan(15, 30, 0));
923 return lastTradingDay.Add(
new TimeSpan(16, 15, 0));
938 return lastTradingDay.Add(
new TimeSpan(16, 15, 0));
952 return lastTradingDay.Add(
new TimeSpan(16, 15, 0));
967 return lastTradingDay.Add(
new TimeSpan(16, 15, 0));
981 return lastTradingDay.Add(
new TimeSpan(16, 15, 0));
995 return lastTradingDay.Add(
new TimeSpan(16, 15, 0));
1008 time = time.AddMonths(1);
1012 var sixteenth =
new DateTime(time.Year,time.Month,16);
1026 time = time.AddMonths(1);
1030 var sixteenth =
new DateTime(time.Year,time.Month, 16);
1044 time = time.AddMonths(1);
1048 var fifteenth =
new DateTime(time.Year,time.Month,15);
1061 time = time.AddMonths(1);
1065 var fifteenth =
new DateTime(time.Year,time.Month,15);
1078 time = time.AddMonths(1);
1082 var fifteenth =
new DateTime(time.Year,time.Month,15);
1095 time = time.AddMonths(1);
1099 var fifteenth =
new DateTime(time.Year,time.Month,15);
1112 time = time.AddMonths(1);
1116 var fifteenth =
new DateTime(time.Year,time.Month,15);
1129 time = time.AddMonths(1);
1133 var fifteenth =
new DateTime(time.Year,time.Month,15);
1146 time = time.AddMonths(1);
1150 var fifteenth =
new DateTime(time.Year,time.Month,15);
1177 return lastBusinessDay;
1187 time = time.AddMonths(1);
1200 var twoDaysPrior = thirdWednesday.AddDays(-2);
1202 return twoDaysPrior.Add(
new TimeSpan(10, 16, 0));
1218 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14,16,0));
1232 return businessDayPrecedingThridWednesday.Add(
new TimeSpan(14,16,0));
1248 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14,16,0));
1260 time = time.AddMonths(1);
1268 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14,16,0));
1284 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14,16,0));
1300 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14,16,0));
1312 time = time.AddMonths(1);
1320 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14,16,0));
1331 var fifteenth =
new DateTime(time.Year, time.Month, 15);
1337 return fifteenth.Add(
new TimeSpan(08,0,0));
1351 return lastPrecedingBusinessDay.Add(
new TimeSpan(14,15,0));
1366 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14,16,0));
1381 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14,16,0));
1393 time = time.AddMonths(1);
1401 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14,16,0));
1413 time = time.AddMonths(1);
1421 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
1433 time = time.AddMonths(1);
1441 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
1455 return lastFriday.Add(
new TimeSpan(15, 0, 0));
1469 return lastFriday.Add(
new TimeSpan(15, 0, 0));
1481 time = time.AddMonths(1);
1489 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
1502 var secondBusinessDayPrecedingThirdWednesday = thirdWednesday.AddDays(-2);
1503 while (holidays.Contains(secondBusinessDayPrecedingThirdWednesday) || !secondBusinessDayPrecedingThirdWednesday.IsCommonBusinessDay())
1505 secondBusinessDayPrecedingThirdWednesday = secondBusinessDayPrecedingThirdWednesday.AddDays(-1);
1508 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(3,0,0));
1521 time = time.AddMonths(1);
1529 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
1542 time = time.AddMonths(1);
1550 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
1563 time = time.AddMonths(1);
1571 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
1584 time = time.AddMonths(1);
1592 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
1604 time = time.AddMonths(1);
1612 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
1626 time = time.AddMonths(1);
1632 return seventhBusinessDayPrecedingLastBusinessDay.Add(
new TimeSpan(12,01,0));
1645 time = time.AddMonths(1);
1651 return seventhBusinessDayPrecedingLastBusinessDay.Add(
new TimeSpan(12,01,0));
1663 time = time.AddMonths(1);
1668 return lastBusinessDay.Add(
new TimeSpan(12,01,0));
1681 time = time.AddMonths(1);
1686 return lastBusinessDay.Add(
new TimeSpan(12,01,0));
1704 .Add(TimeSpan.FromHours(11));
1716 time = time.AddMonths(1);
1724 while (holidays.Contains(secondBusinessDayBeforeThirdWednesday) || !secondBusinessDayBeforeThirdWednesday.IsCommonBusinessDay())
1726 secondBusinessDayBeforeThirdWednesday = secondBusinessDayBeforeThirdWednesday.AddDays(-1);
1729 return secondBusinessDayBeforeThirdWednesday.Add(
new TimeSpan(19, 0, 0));
1742 time = time.AddMonths(1);
1748 return sevenBusinessDaysBeforeLastBusinessDay.Add(
new TimeSpan(12, 1, 0));
1761 time = time.AddMonths(1);
1806 return lastBusinessDay;
1820 var lastDay =
new DateTime(time.Year, time.Month, DateTime.DaysInMonth(time.Year, time.Month));
1822 while (holidays.Contains(lastDay) || !lastDay.IsCommonBusinessDay())
1824 lastDay = lastDay.AddDays(-1);
1886 return lastBusinessDay;
1973 return lastBusinessDay;
1987 var previousMonth = time.AddMonths(-1);
1988 var lastDay =
new DateTime(previousMonth.Year, previousMonth.Month, DateTime.DaysInMonth(previousMonth.Year, previousMonth.Month));
1990 while (!lastDay.IsCommonBusinessDay() || holidays.Contains(lastDay))
1992 lastDay = lastDay.AddDays(-1);
2079 return lastBusinessDay;
2090 var previousMonth = time.AddMonths(-1);
2091 var twentyFifthDay =
new DateTime(previousMonth.Year, previousMonth.Month, 25);
2092 while (!twentyFifthDay.IsCommonBusinessDay() || holidays.Contains(twentyFifthDay))
2097 return twentyFifthDay;
2112 return lastBusinessDay;
2171 return lastBusinessDay;
2217 var twentyFifthDayPriorMonth =
new DateTime(time.Year, time.Month, 25).AddMonths(-1);
2223 return twentyFifthDayPriorMonth;
2237 return lastBusinessDay;
2251 return lastBusinessDay;
2276 return lastBusinessDay;
2290 return lastBusinessDay;
2304 return lastBusinessDay;
2326 var twoMonthsPriorToContractMonth = time.AddMonths(-2);
2328 DateTime lastBusinessDay;
2330 if (twoMonthsPriorToContractMonth.Month == 2)
2341 return lastBusinessDay;
2352 var twentyFifth =
new DateTime(time.Year,time.Month,25);
2353 twentyFifth = twentyFifth.AddMonths(-1);
2355 var businessDays = -3;
2383 DateTime publicationDate;
2387 publicationDate =
new DateTime(time.Year, time.Month, 21).AddMonths(-1);
2391 publicationDate = publicationDate.AddDays(-1);
2393 while (!publicationDate.IsCommonBusinessDay());
2395 return publicationDate;
2409 return lastBusinessDay;
2434 return lastBusinessDay;
2448 return lastBusinessDay;
2484 while (holidays.Contains(lastBusinessDay) || !lastBusinessDay.IsCommonBusinessDay())
2486 lastBusinessDay = lastBusinessDay.AddDays(-1);
2489 return lastBusinessDay;
2502 while (holidays.Contains(lastBusinessDay) || !lastBusinessDay.IsCommonBusinessDay())
2504 lastBusinessDay = lastBusinessDay.AddDays(-1);
2507 return lastBusinessDay;
2520 while (holidays.Contains(lastBusinessDay) || !lastBusinessDay.IsCommonBusinessDay())
2522 lastBusinessDay = lastBusinessDay.AddDays(-1);
2525 return lastBusinessDay;
2549 while (holidays.Contains(lastBusinessDay) || !lastBusinessDay.IsCommonBusinessDay())
2551 lastBusinessDay = lastBusinessDay.AddDays(-1);
2554 return lastBusinessDay;
2578 while (holidays.Contains(lastBusinessDay) || !lastBusinessDay.IsCommonBusinessDay())
2580 lastBusinessDay = lastBusinessDay.AddDays(-1);
2583 return lastBusinessDay;
2596 while (holidays.Contains(lastBusinessDay) || !lastBusinessDay.IsCommonBusinessDay())
2598 lastBusinessDay = lastBusinessDay.AddDays(-1);
2601 return lastBusinessDay;
2614 while (holidays.Contains(lastBusinessDay) || !lastBusinessDay.IsCommonBusinessDay())
2616 lastBusinessDay = lastBusinessDay.AddDays(-1);
2619 return lastBusinessDay;
2632 while (holidays.Contains(lastBusinessDay) || !lastBusinessDay.IsCommonBusinessDay())
2634 lastBusinessDay = lastBusinessDay.AddDays(-1);
2637 return lastBusinessDay;
2648 var twentyFifthDayInPriorMonth =
new DateTime(time.Year, time.Month, 25).AddMonths(-1);
2651 while (i < 3 || !twentyFifthDayInPriorMonth.IsCommonBusinessDay() || holidays.Contains(twentyFifthDayInPriorMonth))
2653 if (twentyFifthDayInPriorMonth.IsCommonBusinessDay() &&
2654 !holidays.Contains(twentyFifthDayInPriorMonth))
2658 twentyFifthDayInPriorMonth = twentyFifthDayInPriorMonth.AddDays(-1);
2661 return twentyFifthDayInPriorMonth;
2672 var previousMonth = time.AddMonths(-1);
2673 previousMonth =
new DateTime(previousMonth.Year, previousMonth.Month, DateTime.DaysInMonth(previousMonth.Year, previousMonth.Month));
2686 var precedingMonth = time.AddMonths(-1);
2698 var previousMonth = time.AddMonths(-1);
2711 var twentyFifthPreviousMonth =
new DateTime(time.Year, time.Month, 25).AddMonths(-1);
2717 return twentyFifthPreviousMonth;
2728 var precedingMonth = time.AddMonths(-1);
2740 var firstDay =
new DateTime(time.Year,time.Month,1);
2755 var secondPrecedingMonth = time.AddMonths(-2);
2756 var nthLastBusinessDay = secondPrecedingMonth.Month == 12 ? 2 : 1;
2768 var fourteenthDay =
new DateTime(time.Year,time.Month,14);
2770 return twelfthDay.Add(
new TimeSpan(12,0,0));
2783 time = time.AddMonths(1);
2788 return lastBusinessDay.Add(
new TimeSpan(12,0,0));
2810 time = time.AddMonths(1);
2814 var lastday =
new DateTime(time.Year,time.Month,1);
2815 lastday = lastday.AddDays(-1);
2817 return tenthday.Add(
new TimeSpan(12,0,0));
2829 time = time.AddMonths(1);
2845 var daysInMonth = DateTime.DaysInMonth(time.Year, time.Month);
2847 if(time.Month == 11)
2849 var priorThursday = (from day in Enumerable.Range(1, daysInMonth)
2850 where
new DateTime(time.Year, time.Month, day).DayOfWeek == DayOfWeek.Thursday
2851 select
new DateTime(time.Year, time.Month, day)).Reverse().ElementAt(1);
2854 priorThursday = priorThursday.AddDays(-7);
2856 return priorThursday;
2859 var lastThursday = (from day in Enumerable.Range(1, daysInMonth)
2860 where
new DateTime(time.Year, time.Month, day).DayOfWeek == DayOfWeek.Thursday
2861 select
new DateTime(time.Year, time.Month, day)).Reverse().ElementAt(0);
2864 lastThursday = lastThursday.AddDays(-7);
2866 return lastThursday;
2879 time = time.AddMonths(1);
2898 time = time.AddMonths(1);
2913 time = time.AddMonths(1);
2934 time = time.AddMonths(1);
2952 time = time.AddMonths(1);
2956 var precedingMonth = time.AddMonths(-1);
2969 time = time.AddMonths(1);
3057 time = time.AddMonths(1);
3065 return lastBusinessDay;
3079 return lastBusinessDay;
3093 return lastBusinessDay;
3107 return lastBusinessDay;
3120 return lastBusinessDay.Add(
new TimeSpan(13, 30, 0));
3133 return lastBusinessDay.Add(
new TimeSpan(13, 25, 0));
3146 return lastBusinessDay.Add(
new TimeSpan(13, 30, 0));
3159 return lastBusinessDay.Add(
new TimeSpan(13, 25, 0));
3173 return lastBusinessDay;
3187 return lastBusinessDay;
3201 return lastBusinessDay;
3215 return lastBusinessDay;
3227 time = time.AddMonths(1);
3235 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
3247 time = time.AddMonths(1);
3255 return secondBusinessDayPrecedingThirdWednesday;
3267 time = time.AddMonths(1);
3275 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
3287 time = time.AddMonths(1);
3295 return firstBusinessDayPrecedingThirdWednesday;
3307 time = time.AddMonths(1);
3315 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
3327 time = time.AddMonths(1);
3335 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
3347 time = time.AddMonths(1);
3355 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
3373 return secondBusinessDayPrecedingLastBusinessDay.Add(
new TimeSpan(6,30,0));
3385 time = time.AddMonths(1);
3393 return firstBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
3405 time = time.AddMonths(1);
3413 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(14, 16, 0));
3429 return secondBusinessDayPrecedingThirdWednesday.Add(
new TimeSpan(3,0,0));
3438 time = time.AddMonths(1);
3443 return thirdFriday.Add(
new TimeSpan(13,30,0));
3452 time = time.AddMonths(1);
3457 return thirdFriday.Add(
new TimeSpan(13,30,0));
3466 time = time.AddMonths(1);
3471 return thirdFriday.Add(
new TimeSpan(13,30,0));
3480 time = time.AddMonths(1);
3485 return thirdFriday.Add(
new TimeSpan(13,30,0));
3500 var previousMonth = time.AddMonths(-1);
3501 var twentyFifthDay =
new DateTime(previousMonth.Year, previousMonth.Month, 25);
3503 var businessDays = -4;
3526 return lastBusinessDay;
3541 return lastBusinessDay;
3558 return lastBusinessDay;
3574 return lastBusinessDay;
3590 return lastBusinessDay;
3610 while (holidays.Contains(lastFriday))
3613 while (holidays.Contains(lastFriday))
3634 return lastBusinessDay;
3658 return lastFriday.Add(
new TimeSpan(15, 0, 0));
3681 return lastFriday.Add(
new TimeSpan(15, 0, 0));