Validate option series contract fields#2
Open
JustinMShea wants to merge 9 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds internal validation and parsing for option-series contract fields so option_series() can infer exact expiration dates (including day), normalize option rights, validate strikes, and enforce trading date constraints while maintaining backward compatibility via warnings when explicit fields disagree with the identifier.
Changes:
- Introduces internal helpers to parse option suffixes and validate/normalize
expires,callput,strike, andfirst_traded. - Updates
option_series()to construct and validate identifiers consistently, emitting targeted warnings for mismatches. - Adds focused
tinytestcoverage for exact-date parsing, normalization, warnings, and error cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| R/option_series_validation.R | Adds internal parsing/validation helpers for option-series expiration dates, rights, and strikes. |
| R/instrument.R | Switches option_series() to use the new helpers for construction/validation and to infer exact expiration dates. |
| inst/tinytest/test_option_series.R | Adds tests covering exact-date parsing, OSI-style strikes, normalization, warnings, and invalid inputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
Adds validation for option-series expiration dates, option rights, strikes, and trading dates. Exact expiration dates are inferred from option identifiers, inconsistent explicit fields produce clear conditions, and focused tinytest coverage is added without changing the exported API.