GetNextMarketClose lets an excluded extended-hours session hide a regular close at midnight
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
这个 Issue 还没有评估数据。
描述
Expected behavior
When extendedMarketHours is false, an extended-hours session at the start of the next day must not hide a regular session's close at midnight.
Actual behavior
For a Sunday regular session from 18:00 to 24:00, followed by a Monday post-market session from 00:00 to 02:00 and a regular session from 14:00 to 16:00, querying Sunday evening for the next regular close returns Monday 16:00 instead of Monday 00:00.
Reproduction
var schedule = Enum.GetValues<DayOfWeek>()
.Select(day => LocalMarketHours.ClosedAllDay(day))
.ToDictionary(x => x.DayOfWeek);
schedule[DayOfWeek.Sunday] = new LocalMarketHours(DayOfWeek.Sunday,
new MarketHoursSegment(MarketHoursState.Market, TimeSpan.FromHours(18), TimeSpan.FromHours(24)));
schedule[DayOfWeek.Monday] = new LocalMarketHours(DayOfWeek.Monday,
new MarketHoursSegment(MarketHoursState.PostMarket, TimeSpan.Zero, TimeSpan.FromHours(2)),
new MarketHoursSegment(MarketHoursState.Market, TimeSpan.FromHours(14), TimeSpan.FromHours(16)));
var hours = new SecurityExchangeHours(TimeZones.NewYork, Enumerable.Empty<DateTime>(), schedule,
new Dictionary<DateTime, TimeSpan>(), new Dictionary<DateTime, TimeSpan>());
var close = hours.GetNextMarketClose(new DateTime(2024, 1, 7, 19, 0, 0), false);
// Expected: 2024-01-08 00:00:00
// Actual: 2024-01-08 16:00:00
Cause
SecurityExchangeHours.GetNextMarketClose passes the next day's first segment start (GetNextOrPreviousSegment(time, isNextDay: true)) to LocalMarketHours.GetMarketClose without checking whether that segment is eligible for the requested hours. Within a day, GetMarketClose already ignores an extended-hours next segment when extended hours are excluded; across midnight it doesn't, so the 24:00 → 00:00 boundary is treated as a continuation.
The fix must take only an eligible next-day segment into account when extended hours are excluded, and keep cross-midnight continuity when extended hours are included. It's the mirror of #10090 for market opens. No market in the bundled market hours database has this layout, so only custom exchange hours are affected.
- 主要语言
- C#
- 星标
- 22.5k
- 派生
- 5.4k
- 平均合并
- 22 小时 6 分钟
- 30 天内合并 PR
- 81
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
QuantConnect/Lean 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
QuantConnect/Lean#10082 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
QuantConnect/Lean#10059 ·
维护者通常 1 天内回复
-
library-request
难度 2/5 1-3 小时 新手友好度 76/100
QuantConnect/Lean#10034 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
QuantConnect/Lean#9965 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
QuantConnect/Lean#9955 ·
维护者通常 1 天内回复
查看 QuantConnect/Lean 的全部 Issue
相似的 Issue
-
bug emitter:client:csharp
难度 2/5 1-3 小时 新手友好度 84/100
microsoft/typespec#12572 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabled未关闭bug
难度 2/5 1-3 小时 新手友好度 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 条评论 ·
维护者通常 1 天内回复
-
area-networking
难度 2/5 1-3 小时 新手友好度 78/100
dotnet/aspnetcore#70545 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 87/100
维护者通常 1 天内回复