Use underlying tradable days for linked custom data bar count history#9602
Open
AlexCatarino wants to merge 1 commit into
Open
Use underlying tradable days for linked custom data bar count history#9602AlexCatarino wants to merge 1 commit into
AlexCatarino wants to merge 1 commit into
Conversation
Bar count history requests for custom data linked to an underlying security counted back calendar days, since the custom data market is always open, returning fewer data points than requested because the data only exists for days the underlying security trades. Count back the requested periods using the underlying exchange hours instead. Closes QuantConnect#9598 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Bar count history requests for custom data linked to an underlying security, e.g.
BrainSentimentIndicator7Dayon an equity, returned fewer data points than requested. Since the custom data market is always open, the request start time was computed by counting back calendar days, but the data only exists for days the underlying security trades, so weekends and holidays in the lookback window reduced the number of points returned.HistoryRequestFactory.GetStartTimeAlgoTznow counts back the requested periods using the underlying exchange hours when the symbol is custom data with an underlying and its market is always open. Behavior is unchanged when the custom data type has specific market hours defined or the underlying market is also always open. Since the fix is in the factory, all bar count paths benefit: bothHistoryoverloads from the issue, indicator warm up and algorithm warm up.Also adds an
IAlgorithm.GetExchangeHoursextension that gets the exchange hours from the security if available, since the user can override them, else from the market hours database.Related Issue
Closes #9598
Motivation and Context
Requesting N daily bars of linked custom data should return N data points.
Requires Documentation Change
No
How Has This Been Tested?
AlgorithmHistoryTests(334 tests) and warm up tests (105 tests) passTypes of changes
Checklist:
🤖 Generated with Claude Code