Validate option underlying subscription resolution - #9751
Closed
pengpengyi92 wants to merge 1 commit into
Closed
Conversation
Member
|
Thanks @pengpengyi92 not a bad idea -- can you please reopen as a warning instead of fatal exception, shown once. You'll find similar patterns of "show once" errors in LEAN. Minute resolution might be the best people have, especially for indexes which don't update that frequently. |
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
Validate an option contract's effective resolution before adding its subscription. If the finest existing underlying subscription is coarser than the option contract resolution,
AddOptionContractnow throws anArgumentExceptionwith guidance to add the underlying at the same or a finer resolution.The validation uses the finest available underlying subscription, so algorithms with multiple underlying subscriptions continue to work when any subscription is sufficiently fine. It also uses
UniverseSettings.Resolutionwhen the option resolution argument is omitted.Related Issue
Closes #9732.
Motivation and Context
LEAN computes option implied volatility and Greeks from the underlying's latest price. Previously, a minute option subscription could silently use a stale daily underlying price for the entire session. Failing fast prevents silently incorrect analytics without introducing a hidden subscription or changing data costs.
Requires Documentation Change
No. The exception explains the required subscription relationship.
How Has This Been Tested?
Tests/QuantConnect.Tests.csprojin Release mode with .NET 10: 0 errors.AlgorithmAddDataTestsfixture in the same minimal container: 54 passed. The only two failures were existing Python/Pandas tests because the minimal container intentionally does not include pandas; neither test exercises this change. Upstream CI uses the fullquantconnect/lean:foundationenvironment.git diff --checksuccessfully.Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>