Canonical downloads hide contract-discovery failures

未关闭
#10,099 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
csharp

调研方向

Start with CanonicalDataDownloaderDecorator, in particular GetContractsData, where producerTask is started with Task.Run and never observed, and the finally block that calls CompleteAdding. Reproduce with a synthetic IDataDownloader and an IFutureChainProvider that throws on a later date, then enumerate Get to completion. Done means the discovery exception reaches the caller on both the first-date and later-date paths, with tests covering each.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C#
星标
22.6k
派生
5.4k
平均合并
11 小时 39 分钟
30 天内合并 PR
104

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

QuantConnect/Lean 的其他 Issue

查看 QuantConnect/Lean 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。