You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CanonicalDataDownloaderDecorator drops the first data point of a canonical download #10002
CanonicalDataDownloaderDecorator.GetContractsData returns every data point that the contract downloads produce.
Actual Behavior
It drops 1 data point: the first one that any contract adds. 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.
Potential Solution
GetContractsData calls .Any() on blockingCollection.GetConsumingEnumerable(). A consuming enumerable removes each item that it reads, so .Any() removes the first item, and the method then returns the rest.
The fix takes the first item with TryTake, and returns it before the rest. I have this fix with tests, and I can open a pull request.
Reproducing the Problem
Run the decorator on a canonical future, with a stub IDataDownloader that returns the same 3 minute bars for each of 2 contracts, then compare the returned bars with the bars the stub produced.
On master at 6f30bf499, this test fails. The first bar of 1 contract is missing:
With the fix, all 31 tests in CanonicalDataDownloaderDecoratorTests pass. I also saw the loss in real downloads: each lean data download of a future root through the DataBento module lost 1 bar.
System Information
Windows 11, .NET SDK 10.0.403, master at 6f30bf499.
Checklist
I have completely filled out this template
I have confirmed that this issue exists on the current master branch
I have confirmed that this is not a duplicate issue by searching issues
I have provided detailed steps to reproduce the issue
Activity