Skip to content

Commit

Permalink
Add early closes for U.S. Indices in MHDB (#7707)
Browse files Browse the repository at this point in the history
* Add Unit tests and early closes to MHDB

* Nit change

* Add missing early closes
  • Loading branch information
Marinovsky authored Jan 19, 2024
1 parent 6cb9164 commit 580a043
Show file tree
Hide file tree
Showing 2 changed files with 260 additions and 4 deletions.
243 changes: 239 additions & 4 deletions Data/market-hours/market-hours-database.json
Original file line number Diff line number Diff line change
Expand Up @@ -56796,7 +56796,66 @@
"12/26/2022",
"12/25/2023",
"12/25/2024"
]
],
"earlyCloses": {
"7/3/2000": "12:00:00",
"7/3/2001": "12:00:00",
"7/5/2002": "12:00:00",
"7/3/2003": "12:00:00",
"7/3/2006": "12:00:00",
"7/3/2007": "12:00:00",
"7/3/2008": "12:00:00",
"7/3/2012": "12:00:00",
"7/3/2013": "12:00:00",
"7/3/2014": "12:00:00",
"7/3/2017": "12:00:00",
"7/3/2018": "12:00:00",
"7/3/2019": "12:00:00",
"7/3/2023": "12:00:00",
"7/3/2024": "12:00:00",
"11/26/1999": "12:00:00",
"11/24/2000": "12:00:00",
"11/23/2001": "12:00:00",
"11/29/2002": "12:00:00",
"11/28/2003": "12:00:00",
"11/26/2004": "12:00:00",
"11/25/2005": "12:00:00",
"11/24/2006": "12:00:00",
"11/23/2007": "12:00:00",
"11/28/2008": "12:00:00",
"11/27/2009": "12:00:00",
"11/26/2010": "12:00:00",
"11/25/2011": "12:00:00",
"11/23/2012": "12:00:00",
"11/29/2013": "12:00:00",
"11/28/2014": "12:00:00",
"11/27/2015": "12:00:00",
"11/25/2016": "12:00:00",
"11/24/2017": "12:00:00",
"11/23/2018": "12:00:00",
"11/29/2019": "12:00:00",
"11/27/2020": "12:00:00",
"11/26/2021": "12:00:00",
"11/25/2022": "12:00:00",
"11/24/2023": "12:00:00",
"11/29/2024": "12:00:00",
"12/24/2001": "12:00:00",
"12/24/2002": "12:00:00",
"12/24/2003": "12:00:00",
"12/26/2003": "12:00:00",
"12/24/2007": "12:00:00",
"12/24/2008": "12:00:00",
"12/24/2009": "12:00:00",
"12/24/2012": "12:00:00",
"12/24/2013": "12:00:00",
"12/24/2014": "12:00:00",
"12/24/2015": "12:00:00",
"12/24/2017": "12:00:00",
"12/24/2018": "12:00:00",
"12/24/2019": "12:00:00",
"12/24/2020": "12:00:00",
"12/24/2024": "12:00:00"
}
},
"Index-usa-VIX": {
"dataTimeZone": "America/Chicago",
Expand Down Expand Up @@ -57134,7 +57193,65 @@
"12/24/2021",
"12/26/2022",
"12/25/2023"
]
],
"earlyCloses": {
"7/3/2000": "12:15:00",
"7/3/2001": "12:15:00",
"7/5/2002": "12:15:00",
"7/3/2003": "12:15:00",
"7/3/2006": "12:15:00",
"7/3/2007": "12:15:00",
"7/3/2008": "12:15:00",
"7/3/2012": "12:15:00",
"7/3/2013": "12:15:00",
"7/3/2014": "12:15:00",
"7/3/2017": "12:15:00",
"7/3/2018": "12:15:00",
"7/3/2019": "12:15:00",
"7/3/2024": "12:00:00",
"11/26/1999": "12:15:00",
"11/24/2000": "12:15:00",
"11/23/2001": "12:15:00",
"11/29/2002": "12:15:00",
"11/28/2003": "12:15:00",
"11/26/2004": "12:15:00",
"11/25/2005": "12:15:00",
"11/24/2006": "12:15:00",
"11/23/2007": "12:15:00",
"11/28/2008": "12:15:00",
"11/27/2009": "12:15:00",
"11/26/2010": "12:15:00",
"11/25/2011": "12:15:00",
"11/23/2012": "12:15:00",
"11/29/2013": "12:15:00",
"11/28/2014": "12:15:00",
"11/27/2015": "12:15:00",
"11/25/2016": "12:15:00",
"11/24/2017": "12:15:00",
"11/23/2018": "12:15:00",
"11/29/2019": "12:15:00",
"11/27/2020": "12:15:00",
"11/26/2021": "12:15:00",
"11/25/2022": "12:15:00",
"11/24/2023": "12:15:00",
"11/29/2024": "12:00:00",
"12/24/2001": "12:15:00",
"12/24/2002": "12:15:00",
"12/24/2003": "12:15:00",
"12/26/2003": "12:15:00",
"12/24/2007": "12:15:00",
"12/24/2008": "12:15:00",
"12/24/2009": "12:15:00",
"12/24/2012": "12:15:00",
"12/24/2013": "12:15:00",
"12/24/2014": "12:15:00",
"12/24/2015": "12:15:00",
"12/24/2017": "12:15:00",
"12/24/2018": "12:15:00",
"12/24/2019": "12:15:00",
"12/24/2020": "12:15:00",
"12/24/2024": "12:00:00"
}
},
"Index-usa-NDX": {
"dataTimeZone": "America/Chicago",
Expand Down Expand Up @@ -57422,7 +57539,66 @@
"12/24/2021",
"12/26/2022",
"12/25/2023"
]
],
"earlyCloses": {
"7/3/2000": "13:00:00",
"7/3/2001": "13:00:00",
"7/5/2002": "13:00:00",
"7/3/2003": "13:00:00",
"7/3/2006": "13:00:00",
"7/3/2007": "13:00:00",
"7/3/2008": "13:00:00",
"7/3/2012": "13:00:00",
"7/3/2013": "13:00:00",
"7/3/2014": "13:00:00",
"7/3/2017": "13:00:00",
"7/3/2018": "13:00:00",
"7/3/2019": "13:00:00",
"7/3/2023": "13:00:00",
"7/3/2024": "13:00:00",
"11/26/1999": "13:00:00",
"11/24/2000": "13:00:00",
"11/23/2001": "13:00:00",
"11/29/2002": "13:00:00",
"11/28/2003": "13:00:00",
"11/26/2004": "13:00:00",
"11/25/2005": "13:00:00",
"11/24/2006": "13:00:00",
"11/23/2007": "13:00:00",
"11/28/2008": "13:00:00",
"11/27/2009": "13:00:00",
"11/26/2010": "13:00:00",
"11/25/2011": "13:00:00",
"11/23/2012": "13:00:00",
"11/29/2013": "13:00:00",
"11/28/2014": "13:00:00",
"11/27/2015": "13:00:00",
"11/25/2016": "13:00:00",
"11/24/2017": "13:00:00",
"11/23/2018": "13:00:00",
"11/29/2019": "13:00:00",
"11/27/2020": "13:00:00",
"11/26/2021": "13:00:00",
"11/25/2022": "13:00:00",
"11/24/2023": "13:00:00",
"11/29/2024": "13:00:00",
"12/24/2001": "13:00:00",
"12/24/2002": "13:00:00",
"12/24/2003": "13:00:00",
"12/26/2003": "13:00:00",
"12/24/2007": "13:00:00",
"12/24/2008": "13:00:00",
"12/24/2009": "13:00:00",
"12/24/2012": "13:00:00",
"12/24/2013": "13:00:00",
"12/24/2014": "13:00:00",
"12/24/2015": "13:00:00",
"12/24/2017": "13:00:00",
"12/24/2018": "13:00:00",
"12/24/2019": "13:00:00",
"12/24/2020": "13:00:00",
"12/24/2024": "13:00:00"
}
},
"Index-usa-SPX": {
"dataTimeZone": "America/Chicago",
Expand Down Expand Up @@ -57710,7 +57886,66 @@
"12/24/2021",
"12/26/2022",
"12/25/2023"
]
],
"earlyCloses": {
"7/3/2000": "12:00:00",
"7/3/2001": "12:00:00",
"7/5/2002": "12:00:00",
"7/3/2003": "12:00:00",
"7/3/2006": "12:00:00",
"7/3/2007": "12:00:00",
"7/3/2008": "12:00:00",
"7/3/2012": "12:00:00",
"7/3/2013": "12:00:00",
"7/3/2014": "12:00:00",
"7/3/2017": "12:00:00",
"7/3/2018": "12:00:00",
"7/3/2019": "12:00:00",
"7/3/2023": "12:00:00",
"7/3/2024": "12:00:00",
"11/26/1999": "12:00:00",
"11/24/2000": "12:00:00",
"11/23/2001": "12:00:00",
"11/29/2002": "12:00:00",
"11/28/2003": "12:00:00",
"11/26/2004": "12:00:00",
"11/25/2005": "12:00:00",
"11/24/2006": "12:00:00",
"11/23/2007": "12:00:00",
"11/28/2008": "12:00:00",
"11/27/2009": "12:00:00",
"11/26/2010": "12:00:00",
"11/25/2011": "12:00:00",
"11/23/2012": "12:00:00",
"11/29/2013": "12:00:00",
"11/28/2014": "12:00:00",
"11/27/2015": "12:00:00",
"11/25/2016": "12:00:00",
"11/24/2017": "12:00:00",
"11/23/2018": "12:00:00",
"11/29/2019": "12:00:00",
"11/27/2020": "12:00:00",
"11/26/2021": "12:00:00",
"11/25/2022": "12:00:00",
"11/24/2023": "12:00:00",
"11/29/2024": "12:00:00",
"12/24/2001": "12:00:00",
"12/24/2002": "12:00:00",
"12/24/2003": "12:00:00",
"12/26/2003": "12:00:00",
"12/24/2007": "12:00:00",
"12/24/2008": "12:00:00",
"12/24/2009": "12:00:00",
"12/24/2012": "12:00:00",
"12/24/2013": "12:00:00",
"12/24/2014": "12:00:00",
"12/24/2015": "12:00:00",
"12/24/2017": "12:00:00",
"12/24/2018": "12:00:00",
"12/24/2019": "12:00:00",
"12/24/2020": "12:00:00",
"12/24/2024": "12:00:00"
}
},
"IndexOption-usa-[*]": {
"dataTimeZone": "America/New_York",
Expand Down
21 changes: 21 additions & 0 deletions Tests/Common/Securities/MarketHoursDatabaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,27 @@ public void MissingOptionsEntriesResolveToUnderlyingMarketHours(string optionTic
}
}

[TestCase("SPX")]
[TestCase("NDX")]
[TestCase("VIX")]
public void USIndexOptionsResolveToUnderlyingEarlyCloses(string optionTicker)
{
var provider = MarketHoursDatabase.FromDataFolder();
var underlyingTicker = OptionSymbol.MapToUnderlying(optionTicker, SecurityType.Index);
var underlying = Symbol.Create(underlyingTicker, SecurityType.Index, Market.USA);
var option = Symbol.CreateOption(
underlying,
Market.USA,
default,
default,
default,
SecurityIdentifier.DefaultDate);

var underlyingEntry = provider.GetEntry(Market.USA, underlying, underlying.SecurityType);
var optionEntry = provider.GetEntry(Market.USA, option, option.SecurityType);
Assert.AreEqual(underlyingEntry.ExchangeHours.EarlyCloses, optionEntry.ExchangeHours.EarlyCloses);
}

[TestCase("GC", Market.COMEX, "OG")]
[TestCase("SI", Market.COMEX, "SO")]
[TestCase("HG", Market.COMEX, "HXE")]
Expand Down

0 comments on commit 580a043

Please sign in to comment.