GetNextMarketClose lets an excluded extended-hours session hide a regular close at midnight
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- C#
- Stelle
- 22.5k
- Fork
- 5.4k
- Merge medio
- 22h 6m
- PR unite (30g)
- 81
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di QuantConnect/Lean
-
PDF report generation can overwrite HTML when the destination extension is not lowercase .htmlAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
QuantConnect/Lean#10082 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
QuantConnect/Lean#10059 ·
I maintainer di solito rispondono entro 1 giorno
-
Library Request: highspyApertalibrary-request
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
QuantConnect/Lean#10034 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
QuantConnect/Lean#9965 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
QuantConnect/Lean#9955 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di QuantConnect/Lean
Issue simili
-
bug emitter:client:csharp
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
microsoft/typespec#12572 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area-networking
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/aspnetcore#70545 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 1 giorno