Skip to content

Fix wildcard holidays overriding symbol early closes and late opens (#9866) - #9867

Closed
DivyaRaval1909 wants to merge 1 commit into
QuantConnect:masterfrom
DivyaRaval1909:bug-9866-wildcard-holidays-early-close-conflict
Closed

DivyaRaval1909 wants to merge 1 commit into
QuantConnect:masterfrom
DivyaRaval1909:bug-9866-wildcard-holidays-early-close-conflict

Conversation

@DivyaRaval1909

@DivyaRaval1909 DivyaRaval1909 commented Oct 4, 2026 •

Copy link
Copy Markdown

Description

When a market-wide wildcard entry in market-hours-database.json (such as Future-comex-[*]) lists a date as a holiday, MarketHoursDatabaseJsonConverter unions the wildcard's holidays into every specific symbol entry. However, specific symbol entries (such as Future-comex-MGC) often specify earlyCloses and lateOpens for those same half-days (e.g., CME Globex holidays like MLK Day, Presidents' Day, etc.).

Because SecurityExchangeHours checks _holidays before evaluating _earlyCloses and _lateOpens, the symbol was resolving to Closed All Day (is_closed_all_day = true), ignoring the symbol's explicit early close/late open schedule and skipping data on active trading sessions.

This PR:

  1. Updates MarketHoursDatabaseJsonConverter to exclude dates present in earlyCloses or lateOpens from holidayDates, ensuring specific symbol schedules take precedence over wildcard holidays.
  2. Updates the SecurityExchangeHours constructor to ensure _holidays excludes dates specified in earlyCloses and lateOpens.
  3. Adds unit test HandlesWildcardHolidayWithSymbolEarlyCloseAndLateOpen in MarketHoursDatabaseJsonConverterTests.cs.
  4. Adds unit test EarlyClosesAndLateOpensTakePrecedenceOverHolidays in SecurityExchangeHoursTests.cs.

Related Issue

Closes #9866

Motivation and Context

Prevents futures (and other securities) on COMEX/NYMEX/CBOT/ICE from being marked as closed all day on CME Globex holiday half-days where actual trading sessions occurred and historical data exists.

Requires Documentation Change

No.

How Has This Been Tested?

  • Added MarketHoursDatabaseJsonConverterTests.HandlesWildcardHolidayWithSymbolEarlyCloseAndLateOpen verifying MGC on 2020-01-20 is not treated as a holiday and resolves its 13:00 early close and 18:00 late open.
  • Added SecurityExchangeHoursTests.EarlyClosesAndLateOpensTakePrecedenceOverHolidays.
  • Ran existing MarketHoursDatabaseJsonConverterTests (HandlesRoundTrip, HandlesOverridingEarlyCloses, HandlesOverridingLateOpens) and verified all tests pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

@Martin-Molinero

Copy link
Copy Markdown
Member

Hey @DivyaRaval1909! Thank for the contribution, but we decided to go with a slightly different approach at #9869

@DivyaRaval1909
DivyaRaval1909 deleted the bug-9866-wildcard-holidays-early-close-conflict branch October 5, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants