Live: a split whose factor-file row first arrives after the row's date is never emitted (LiveSplitEventProvider)

Chiusa
#9,948 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Amadeus-22 ci sta già lavorando.

Dal 30/10/2026.

  • #10169 di @quantconnect-kronos — chiusa senza merge

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
backend, data

Direzione di ricerca

Start with Engine/DataFeeds/Enumerators/LiveSplitEventProvider.cs and SplitEventProvider.cs, then inspect CorporateFactorProvider.HasSplitEventOnNextTradingDay and the corresponding live dividend provider. Model a refreshed factor file that adds a row keyed to an already-processed date, and verify the split or dividend is emitted on the next tradable-date event; the issue also calls for preserving the existing event timing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Expected behavior

A live algorithm holding a US equity receives the Split (SplitType.SplitOccurred) event, and has its holdings quantity and price adjusted, for every split that the factor files carry before the split's effective session, however late the row reached the factor file relative to its own date.

Actual behavior

LiveSplitEventProvider only looks for a split row keyed to the current tradable date (CorporateFactorProvider.HasSplitEventOnNextTradingDay(eventArgs.Date)). A factor-file row that first appears in a refreshed factor file after the row's date has already passed is never seen, so the split is never emitted and the holdings are never adjusted, even when the split's effective session is still in the future at the time of the refresh.

Observed on a QuantConnect Cloud paper deployment (LEAN 2.5.0.0.18201, started Friday 2026-10-23 13:12 UTC) holding six Nasdaq symbols that all had reverse splits effective at the open of Monday 2026-10-26. Factor-file rows for a split effective on 10-26 are keyed to the previous trading day, 20261023.

  • COCH, HCTI, PPCB: the 20261023 row was already in the archive equity/usa/factor_files/factor_files_20261022.zip, which the deployment loaded at start-up on 10-23. HasSplitEventOnNextTradingDay(2026-10-23) matched, the Warning was emitted on 10-23 and SplitOccurred on the next tradable-date event (10-24 08:00 NY). Holdings were adjusted:
2026-10-24T12:00:13.99 TRACE:: AlgorithmManager.Run(): 10/24/2026 8:00:00 AM: Pre-Split for Split: COCH: 10 | 0.5959. Security Price: 0.5870 Holdings: -15453
2026-10-24T12:00:14.00 TRACE:: AlgorithmManager.Run(): 10/24/2026 8:00:00 AM: Post-Split for Split: COCH: 10 | 0.5959. Security Price: 5.8700 Holdings: -1545
  • GCTK, IPW, SBFM: the 20261023 row is absent from factor_files_20261022.zip and first present in factor_files_20261023.zip (built after the 10-23 session). The deployment's daily refresh loaded that file on 10-24 at 08:00 NY, and the provider logged the new row:
2026-10-24T12:00:13.99 TRACE:: LiveSplitEventProvider(GCTK,#0,GCTK,Minute,TradeBar,Trade,Adjusted,OpenInterest): new tradable date 20261024. New FactorFile: True. FactorFile.Count Old: 6 New: 7
2026-10-24T12:00:13.99 TRACE:: LiveSplitEventProvider(IPW,#0,IPW,Minute,TradeBar,Trade,Adjusted,OpenInterest): new tradable date 20261024. New FactorFile: True. FactorFile.Count Old: 5 New: 6
2026-10-24T12:00:13.99 TRACE:: LiveSplitEventProvider(SBFM,#0,SBFM,Minute,TradeBar,Trade,Adjusted,OpenInterest): new tradable date 20261024. New FactorFile: True. FactorFile.Count Old: 5 New: 6

HasSplitEventOnNextTradingDay(2026-10-24), (2026-10-25) and (2026-10-26) all look for a row keyed to that day; the row is keyed 20261023, so none matches. No Warning, no SplitOccurred, no Pre-Split line for any of the three through the 10-26 open. The deployment still prices the pre-split share counts at post-split prices (GCTK 1-for-2, IPW 1-for-12, SBFM 1-for-20).

Rows in the two archives (date, price factor, split factor, reference price):

gctk.csv  factor_files_20261022.zip: ... 20260828,1,15,0.282 / 20501231,1,1,0
gctk.csv  factor_files_20261023.zip: ... 20260828,1,30,0.282 / 20261023,1,2,0.4032 / 20501231,1,1,0
coch.csv  factor_files_20261022.zip: 20210422,1,10,1 / 20261023,1,10,0.5959 / 20501231,1,1,0

LiveDividendEventProvider has the same structure (DividendEventProvider.GetEvents line 102 calls HasDividendEventOnNextTradingDay(eventArgs.Date)), so a dividend row arriving one refresh late is skipped the same way.

Where

  • Engine/DataFeeds/Enumerators/LiveSplitEventProvider.cs lines 36-54: refreshes the factor file on each new tradable date, logs the row-count change, then defers to the base.
  • Engine/DataFeeds/Enumerators/SplitEventProvider.cs lines 72-108: emits a pending SplitOccurred, then calls HasSplitEventOnNextTradingDay(eventArgs.Date) for the current date only.
  • Common/Data/Auxiliary/CorporateFactorProvider.cs lines 147-151: SortedFactorFileData.IndexOfKey(date) is an exact-key lookup.

Proposed change

When the live provider's refresh produces a new factor-file instance, also check the rows keyed to dates between the last tradable date processed and eventArgs.Date (exclusive). If one of them is a split (or dividend) that the previous instance did not carry, treat it as the pending event: emit the Warning now and the SplitOccurred on the next tradable-date event, which is the same timing the engine already uses when the row is present on its own date (COCH above: Warning 10-23, SplitOccurred 10-24). Equivalent for LiveDividendEventProvider. This needs the base providers to expose the pending-event state (currently private _splitFactor / _referencePrice) or a protected hook for the derived live classes.

Reproduce

No cloud backtest reproduces it (the backtest provider reads one factor file for the run); the evidence is the live syslog above and the two dated factor-file archives, both read for this report. A unit test can model it: build a SplitEventProvider over a factor file without the 20261023 row, call GetEvents for 2026-10-23, swap the provider's factor file for one with the row, call GetEvents for 2026-10-24, 10-25 and 10-26, and assert that a Split is emitted; today none is.

Intercom conversation 215476559937869.

Lingua principale
C#
Stelle
22.6k
Fork
5.4k
Merge medio
11h 39m
PR unite (30g)
104

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di QuantConnect/Lean

Tutte le issue di QuantConnect/Lean

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.