Skip to content

Canonical downloads hide contract-discovery failures #10099

Open

Description

Problem

CanonicalDataDownloaderDecorator does not observe failures from contract discovery. If a future/option chain provider throws, a canonical download can look like either no data or a successfully completed partial download.

Reproduction

Use a synthetic IDataDownloader that returns null for a canonical MNQ future and two minute bars for its dated contract. Set downloader-thread-count to 1 so the sequence is deterministic.

  1. Request December 8–9, 2025.
  2. Have IFutureChainProvider.GetFutureContractList return the dated contract for December 8.
  3. On December 9, throw InvalidOperationException("synthetic later-date discovery failure") instead of returning a chain.
  4. Enumerate the result of CanonicalDataDownloaderDecorator.Get to completion.

Observed: enumeration ends normally after the earlier contract's data. The discovery exception never reaches the caller. I also tested a provider that throws on its first call: Get returns null and reports no contracts rather than reporting the discovery failure. Both behaviors reproduce with the existing consuming-probe implementation as well as with a probe that preserves the first point.

These are synthetic local reproductions, with no external data-provider requests.

Cause and expected outcome

GetContractsData starts producerTask with Task.Run but never observes that task. GetContracts is lazy, so chain-provider exceptions occur inside the producer. Its finally calls CompleteAdding, making the consumer see normal completion despite the fault.

A fix must distinguish failed contract discovery from a genuinely empty or complete chain. A suggested approach is to observe the producer's failure when consuming the result, including the no-data path; if best-effort partial results are intended, the failure and incompleteness still need to be made explicit. Cover both first-date failure and failure after an earlier contract has produced data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions