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

Closed
#9,948 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Amadeus-22 is already working on this.

Since Oct 30, 2026.

  • #10169 by @quantconnect-kronos — closed without merging

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend, data

Research direction

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.

Written by the indexing model from the issue text.

Description

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.

Dominant language
C#
Stars
22.6k
Forks
5.4k
Avg merge
11h 39m
Merged PRs (30d)
104

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantConnect/Lean

All issues in QuantConnect/Lean

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.