GetNextMarketClose lets an excluded extended-hours session hide a regular close at midnight
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 22.5k
- Fork
- 5.4k
- Merge trung bình
- 22 giờ 6 phút
- Pull request đã merge (30 ngày)
- 81
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của QuantConnect/Lean
-
PDF report generation can overwrite HTML when the destination extension is not lowercase .htmlĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
QuantConnect/Lean#10082 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
QuantConnect/Lean#10059 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Library Request: highspyĐang mởlibrary-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
QuantConnect/Lean#10034 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
QuantConnect/Lean#9965 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
QuantConnect/Lean#9955 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của QuantConnect/Lean
Issue tương tự
-
bug emitter:client:csharp
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/typespec#12572 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-area-label
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area-networking
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dotnet/aspnetcore#70545 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
Maintainer thường phản hồi trong vòng 1 ngày