Skip to content

Add the Hang Seng Index's afternoon-only severe weather sessions - #10253

Merged
quantconnect-kronos[bot] merged 2 commits into
masterfrom
kronos/bug-10242-hsi-typhoon-late-opens
Nov 27, 2026
Merged

quantconnect-kronos[bot] merged 2 commits into
masterfrom
kronos/bug-10242-hsi-typhoon-late-opens

Conversation

@quantconnect-kronos

@quantconnect-kronos quantconnect-kronos Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #10242

Description

On ten weekdays HKEX cancelled the morning session because of Typhoon Signal No. 8 or a Black Rainstorm Warning, then traded in the afternoon. The HKFE index calendar (Index-hkfe-[*], which Index-hkfe-HSI inherits) now has a late open on each of them, at the time HKEX's own notice gives for the afternoon start. Lean's existing late-open handling drops the morning session and starts the afternoon segment at that time. No other date or entry changes.

Date Event Afternoon open (HKT) HKEX notice
2008-06-25 Typhoon Fengshen 14:30 080625news
2009-09-15 Typhoon Koppu 14:30 0909152news
2012-07-24 Typhoon Vicente 13:00 1207242news
2013-05-22 Black Rainstorm 13:00 1305222news
2013-09-23 Typhoon Usagi 13:00 1309232news
2014-09-16 Typhoon Kalmaegi 13:00 1409162news
2020-08-19 Typhoon Higos 13:30 2008192news
2021-06-28 Black Rainstorm 13:30 2106283news
2022-08-25 Typhoon Ma-on 13:00 2208252news
2023-10-09 Typhoon Koinu 14:00 2310092news

How the list was built:

  • I scanned every Hang Seng Index minute file (December 2006 onward) for weekdays whose first bar is after 12:00. Every date above starts at exactly the time in the table.
  • I cross-checked them against HKEX's typhoon and rainstorm notices from 2000 to 2024-09-22. HKEX has traded through severe weather since 2024-09-23. The notices show no other afternoon-only day in that period.
  • 2008-02-11 also starts at 14:30 in the data, but neither the weather records nor HKEX's notices show any cause, so it isn't added.
  • 2003-07-24 was scheduled to open at 10:30 instead of 10:00, and actually opened at 10:32. That's a late morning open, and earlier than the data, so it isn't added either.

Related gaps on the same calendars, found while doing this and left out of this change:

How Has This Been Tested?

  • New MarketHoursDatabaseTests.HangSengIndexTradesOnlyInTheAfternoonOnSevereWeatherDays, one case per date. Each case resolves the HSI exchange hours from the data folder and checks that:

    • the day has one segment, from the afternoon open to 16:00;
    • a known ordinary trading day just before it, taken from the minute data, keeps both regular segments. The control days are given explicitly, because the calendar's own previous trading day can be a public holiday it doesn't list yet (2013-09-20, before 2013-09-23).

    All 10 cases pass. Against the base branch's market-hours-database.json, all 10 fail.

  • MarketHoursDatabaseTests, SecurityExchangeHoursTests and MarketHoursDatabaseJsonConverterTests: 278 passed, 1 skipped.

  • Full suite as CI runs it (dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "TestCategory!=TravisExclude&TestCategory!=ResearchRegressionTests"): 40047 passed, 0 failed, 112 skipped.

  • Tested end to end: a minute-resolution HSI backtest over 2009-09-14 to 2009-09-16 and over 2023-10-06 to 2023-10-10.

    • With this change, on 2009-09-15 and 2023-10-09 the first bar and the AfterMarketOpen scheduled event both come at the real afternoon open (14:30 and 14:00), and the exchange is closed at 10:15. The surrounding days are unchanged.
    • With the base branch's calendar, those days open at 09:30 and the algorithm gets fill-forwarded bars through the closed morning.

On days HKEX cancelled the morning session for a typhoon signal or a
black rainstorm warning and traded in the afternoon, the HKFE index
calendar now opens at the afternoon session's actual start, from HKEX's
notices for each date.

Closes #10242

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quantconnect-kronos quantconnect-kronos Bot added kronos:develop:working develop: in progress kronos:review Request review labels Nov 27, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued kronos:review:working review: in progress and removed kronos:review Request review kronos:review:queued review: queued labels Nov 27, 2026
@quantconnect-kronos-reviewer
quantconnect-kronos-reviewer Bot marked this pull request as ready for review November 27, 2026 16:13

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. This is a data-only fix for the ten dates that #10242 asks about, and nothing else on the HKFE calendars changes.

What I checked:

  • Times: each of the ten afternoon opens matches the resumption time in its linked HKEX notice.
  • Minute data: I scanned every Hang Seng Index minute file from December 2006 onward. The only weekdays whose first bar is after 12:00 are these ten, each at exactly the time in the table, plus 2008-02-11, which the PR leaves out on purpose.
  • How the calendar resolves: Index-hkfe-HSI takes its late opens from Index-hkfe-[*]. The only other place calendars inherit from is an option's underlying, and no HKFE option entries exist, so no other calendar picks these dates up. SecurityExchangeHours drops the morning segment and starts the afternoon at the late-open time, including when that time equals the regular 13:00 start. None of the dates is a holiday or an early close.
  • Tests: without these entries, the new tests fail at Segments.Single(). CI is green.

I set risk:low. It's an 11-line data change that's easy to revert. It replaces sessions that never traded with HKEX's published hours, and leaves every other date as it was. It's backed by per-date tests, green CI and an end-to-end run, and the data was checked against HKEX's notices.

The futures calendar has the same gap, which #10251 already tracks, so it doesn't hold this change.

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added risk:low Low risk and removed kronos:review:working review: in progress labels Nov 27, 2026
@quantconnect-kronos quantconnect-kronos Bot added the kronos:review Request review label Nov 27, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued and removed kronos:review Request review labels Nov 27, 2026
@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot added kronos:review:working review: in progress and removed kronos:review:queued review: queued labels Nov 27, 2026

@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. I compared minute-resolution Hang Seng Index backtests with and without the fix for all four reopening times (13:00, 13:30, 14:00, and 14:30 HKT). On each date, AfterMarketOpen and the first real bar matched the published open, and all 150 spurious morning fill-forward bars disappeared. The surrounding trading days kept the same scheduled opens and morning bar counts. Focused tests: 278 passed, 1 skipped; all 10 new cases rejected the base calendar.

One non-blocking test suggestion below. Small description correction: HKEX confirmed that July 24, 2003 was scheduled for 10:30 but actually opened at 10:32. It remains outside this afternoon-only fix.

@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot removed the kronos:review:working review: in progress label Nov 27, 2026
…er test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quantconnect-kronos
quantconnect-kronos Bot marked this pull request as draft November 27, 2026 16:27
@quantconnect-kronos quantconnect-kronos Bot added the kronos:review Request review label Nov 27, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued kronos:review:working review: in progress and removed kronos:review Request review kronos:review:queued review: queued labels Nov 27, 2026
@quantconnect-kronos-reviewer
quantconnect-kronos-reviewer Bot marked this pull request as ready for review November 27, 2026 16:51

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. 9f05d98 only changes the test: each case now names its own ordinary trading day instead of asking the calendar under test for one. I checked all ten control days against the Hang Seng Index minute data. Each one is a full session, both morning and afternoon, and it's the last trading day before its event. For 2013-09-23 that's 2013-09-19, because 2013-09-20 has no data. CI is green on this commit, and the calendar data is unchanged since my earlier approval.

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot removed the kronos:review:working review: in progress label Nov 27, 2026
@quantconnect-kronos quantconnect-kronos Bot added the kronos:review Request review label Nov 27, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot removed the kronos:review Request review label Nov 27, 2026
@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot added kronos:review:working review: in progress and removed kronos:review:queued review: queued labels Nov 27, 2026

@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The regression now uses known trading days rather than asking the calendar under test to select them. I verified morning and afternoon HSI minute data on all ten control dates, including September 19, 2013 in place of the September 20 holiday. The focused market-hours tests passed: 278 passed, 1 skipped.

@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot removed the kronos:review:working review: in progress label Nov 27, 2026
@quantconnect-kronos
quantconnect-kronos Bot merged commit bbce758 into master Nov 27, 2026
8 checks passed
@quantconnect-kronos
quantconnect-kronos Bot deleted the kronos/bug-10242-hsi-typhoon-late-opens branch November 27, 2026 16:57
@quantconnect-kronos quantconnect-kronos Bot removed the kronos:develop:working develop: in progress label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Low risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Market hours: Hang Seng Index calendar shows morning trading on historical typhoon days

0 participants