Preserve bank holidays when copying exchange-hours calendars
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 85/100
Hướng nghiên cứu
Đọc Common/Util/MarketHoursDatabaseJsonConverter.cs và Common/Securities/SecurityExchangeHours.cs, tập trung vào các đường dẫn sao chép mục và Update được mô tả trong issue. Tìm bài kiểm thử round-trip hiện có cho giờ thị trường và bổ sung kiểm thử hồi quy để bảo toàn các ngày nghỉ ngân hàng; thêm một kiểm thử làm mới để xác minh các ngày nghỉ đã bị xóa được loại bỏ. Hoàn tất khi cả hai lần chuyển đều dùng tập ngày nghỉ ngân hàng thay thế và các bài kiểm thử đều chạy thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Observed behavior
Bank holidays are not preserved when a market-hours calendar is serialized or refreshed:
MarketHoursDatabaseJsonConverter.MarketHoursDatabaseEntryJson(Entry)copies holidays, early closes and late opens, but never populatesBankHolidays(Common/Util/MarketHoursDatabaseJsonConverter.cs). Serializing a database entry with one explicit bank holiday and deserializing it produces zero bank holidays.SecurityExchangeHours.Updatereplaces_holidays,_earlyClosesand_lateOpens, but not_bankHolidays(Common/Securities/SecurityExchangeHours.cs:693-714). Updating a calendar containing one bank holiday from a calendar containing none leaves the old holiday present.MarketHoursDatabase.Entry.Updateuses this path when the database refreshes.
Both omissions exist on master. Bank holidays are used by expiry-date calculations, so losing or retaining an obsolete date can change those calculations even when the regular trading schedule is correct.
Minimal serialization reproduction
var day = new DateTime(2025, 11, 11);
var hours = new SecurityExchangeHours(
TimeZones.Utc,
Array.Empty<DateTime>(),
Enum.GetValues<DayOfWeek>().ToDictionary(d => d, LocalMarketHours.OpenAllDay),
new Dictionary<DateTime, TimeSpan>(),
new Dictionary<DateTime, TimeSpan>(),
new[] { day });
var database = new MarketHoursDatabase(
new Dictionary<SecurityDatabaseKey, MarketHoursDatabase.Entry>
{
[new SecurityDatabaseKey(Market.InteractiveBrokers, "TEST", SecurityType.Cfd)] =
new MarketHoursDatabase.Entry(TimeZones.Utc, hours)
});
var copy = JsonConvert.DeserializeObject<MarketHoursDatabase>(
JsonConvert.SerializeObject(database));
Console.WriteLine(hours.BankHolidays.Count); // 1
Console.WriteLine(copy.GetEntry(Market.InteractiveBrokers, "TEST", SecurityType.Cfd)
.ExchangeHours.BankHolidays.Count); // 0, expected 1
The refresh case was also reproduced by invoking SecurityExchangeHours.Update on the original hours, with SecurityExchangeHours.AlwaysOpen(TimeZones.Utc) as its replacement: actual bank-holiday count 1, expected 0.
Required result
Round-tripping an entry preserves its bank-holiday set, and refreshing an existing exchange-hours instance adopts the replacement set, including removals. Other calendar fields and existing inheritance rules remain unchanged. Add regression coverage for both transfers; the current round-trip test does not compare bank holidays.
- Ngôn ngữ chính
- C#
- Star
- 22.5k
- Fork
- 5.4k
- Merge trung bình
- 13 giờ 11 phút
- Pull request đã merge (30 ngày)
- 104
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
-
priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
QuantConnect/Lean#10191 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
QuantConnect/Lean#10187 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
QuantConnect/Lean#10175 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
QuantConnect/Lean#10147 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
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
Tất cả issue của QuantConnect/Lean
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area-ai untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dotnet/extensions#7956 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
microsoft/microsoft-ui-reactor#1567 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
openclaw/openclaw-windows-node#2287 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
AI Generated CI/CD ⚒️ Flaky-tests 🐦 go 🏃
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
valkey-io/valkey-glide#7772 ·
Maintainer thường phản hồi trong vòng 1 ngày