Skip to content

Commit

Permalink
Add Martin Luther King's day 2025 holiday to CME futures entries (#8515)
Browse files Browse the repository at this point in the history
* Add Martin Luther King'day holiday to CME futures entries

Add unit test for MCL futures expiry function, first contract of 2025 expires on Jan17 but was returning the 20th

* Add holiday to equity and index

And by extension to options and index options

* Add holiday to other entries
  • Loading branch information
jhonabreul authored Jan 9, 2025
1 parent ca7f771 commit 8937995
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Data/market-hours/market-hours-database.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"1/1/2025",
"1/2/2007",
"1/9/2025",
"1/20/2025",
"1/19/1998",
"1/18/1999",
"1/17/2000",
Expand Down Expand Up @@ -146,7 +147,6 @@
"1/17/2022",
"1/16/2023",
"1/15/2024",
"1/20/2025",
"2/16/1998",
"2/15/1999",
"2/21/2000",
Expand Down Expand Up @@ -614,6 +614,7 @@
"12/24/2023",
"12/31/2023",
"3/29/2024",
"1/20/2025",
"4/18/2025",
"6/19/2025"
],
Expand Down Expand Up @@ -720,6 +721,7 @@
"1/17/2022",
"1/16/2023",
"1/15/2024",
"1/20/2025",
"2/16/1998",
"2/15/1999",
"2/21/2000",
Expand Down Expand Up @@ -1000,6 +1002,7 @@
"1/2/2023",
"1/2/2007",
"1/9/2025",
"1/20/2025",
"1/19/1998",
"1/18/1999",
"1/17/2000",
Expand Down Expand Up @@ -1304,6 +1307,7 @@
"1/1/2022",
"1/1/2024",
"1/2/2023",
"1/20/2025",
"1/2/2007",
"1/19/1998",
"1/18/1999",
Expand Down Expand Up @@ -1610,6 +1614,7 @@
"1/1/2022",
"1/1/2024",
"1/9/2025",
"1/20/2025",
"1/2/2023",
"1/2/2007",
"1/19/1998",
Expand Down Expand Up @@ -1946,6 +1951,7 @@
"1/17/2022",
"1/16/2023",
"1/15/2024",
"1/20/2025",
"2/16/1998",
"2/15/1999",
"2/21/2000",
Expand Down Expand Up @@ -108063,6 +108069,7 @@
"1/17/2022",
"1/16/2023",
"1/15/2024",
"1/20/2025",
"2/16/1998",
"2/15/1999",
"2/21/2000",
Expand Down Expand Up @@ -122110,6 +122117,7 @@
"1/17/2022",
"1/16/2023",
"1/15/2024",
"1/20/2025",
"2/16/1998",
"2/15/1999",
"2/21/2000",
Expand Down
14 changes: 14 additions & 0 deletions Tests/Common/Securities/Futures/FuturesExpiryFunctionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ public void HSIFutures()
Assert.AreEqual(new DateTime(2025, 2, 27, 16, 0, 0), expiration(new DateTime(2025, 2, 1)));
}

[Test]
public void MCLFutures()
{
var canonical = Symbol.Create("MCL", SecurityType.Future, Market.NYMEX);
var expiration = FuturesExpiryFunctions.FuturesExpiryDictionary[canonical];

// 1/25 is Saturday and 1/20 is a holiday
Assert.AreEqual(new DateTime(2025, 1, 17, 0, 0, 0), expiration(new DateTime(2025, 2, 1)));
// Whole weekend in between
Assert.AreEqual(new DateTime(2025, 2, 19, 0, 0, 0), expiration(new DateTime(2025, 3, 1)));
// Normal case
Assert.AreEqual(new DateTime(2025, 4, 21, 0, 0, 0), expiration(new DateTime(2025, 5, 1)));
}

[Test]
public void FuturesExpiryFunction_MissingSymbol_ShouldThrowArgumentException()
{
Expand Down

0 comments on commit 8937995

Please sign in to comment.