Repository navigation
Keep the first data point of a canonical download - #10004
Closed
econstantin wants to merge 3 commits into
Closed
econstantin wants to merge 3 commits into
econstantin wants to merge 3 commits into
Conversation
CanonicalDataDownloaderDecorator.GetContractsData called Any() on the consuming enumerable of its BlockingCollection. That call removed 1 data point from the collection and dropped it. So each download of a canonical symbol through the chain provider lost the first data point that a contract added. Take the first data point with TryTake and return it before the rest. Add an internal constructor that takes the chain providers, so a test can run the decorator without the global Composer.
Add ReturnsTheOnlyBarForCanonicalFuture. With the old logic, a download of 1 bar returned 0 bars. Remove the wait between contracts from the test of every bar. The old logic dropped a data point in any thread order, so the test did not need it.
4 tasks done
Member
|
Included by #10096 thank you |
econstantin
deleted the
bug-10002-canonical-download-first-data-point
branch
November 18, 2026 02:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
CanonicalDataDownloaderDecorator.GetContractsDatacalled.Any()on the consuming enumerable of itsBlockingCollection. That call removed the first data point from the collection and dropped it.This change takes the first data point with
TryTake, and returns it before the rest of the collection.It also adds an internal constructor that takes the chain providers, so a test can run the decorator without the global
Composer.Related Issue
Fixes #10002
Motivation and Context
Each download of a canonical symbol through the chain provider loses 1 data point. The download exits with code 0 and logs no error. The contracts download in parallel, so 2 downloads of the same window can lose different data points.
Requires Documentation Change
No.
How Has This Been Tested?
This change adds 4 tests to
CanonicalDataDownloaderDecoratorTests:ReturnsEveryBarOfEveryContractForCanonicalFutureruns the decorator on a canonical future with a stubIDataDownloaderthat returns 3 minute bars for each of 2 contracts, then compares the returned bars with the bars the stub produced.ReturnsTheOnlyBarForCanonicalFuturechecks a download that produces 1 bar. The old logic returned 0 bars.ReturnsNullForCanonicalFutureWhenNoContractHasDataandReturnsNullForCanonicalFutureWithNoContractcheck the path with no data.Results on
masterat6f30bf499, with Windows 11, .NET SDK 10.0.403, and Python 3.11:GetContractsData: 2 failed (ReturnsEveryBarOfEveryContractForCanonicalFutureandReturnsTheOnlyBarForCanonicalFuture), 30 passed.TestCategory!=TravisExclude&TestCategory!=ResearchRegressionTests: 39344 passed, 0 failed, 100 skipped.Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>