Repository navigation
Conversation
TWS sends every option chain expiration as a YYYYMMDD date (live on paper TWS for stock, index and futures option chains). The field was Vec<String>, so finding the nearest expiration meant parsing text. Each date now decodes to Expiry::Date(ExpirationDate), which orders by date and goes straight into Contract::option. Text in another form is kept as Expiry::Unknown, so an unexpected value never fails the request. Migration section 39.
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.
Why
OptionChain::expirationswasVec<String>. Every caller that wants the nearest expiration, or an expiration to put in an option contract, sorts and parses the text itself; the crate's ownoptions_exerciseexamples didexpirations.sort()and thenexpiration.parse()?.What
OptionChain::expirationsisVec<Expiry>. TWS sends each entry as aYYYYMMDDdate, which decodes toExpiry::Date(ExpirationDate): it orders by date and goes straight intoContract::option.Expiry::Unknown, through the existing lenientExpiry::from_wire, so an unexpected value never fails the request (the enum-typing rule for one-shot fields).spreadsintegration tests use the typed values; the integration tests compare the dates' text as before.Verified
reqSecDefOptParamsfor AAPL (22 chains), SPX (9 chains) and ES futures options onCME(21 chains, weeklies and dailies included) sent only 8-digitYYYYMMDDexpirations.Expiry::Unknown.cargo fmt; clippy, rustdoc, examples andcargo teston the default, sync-only and all-features legs;tools/check-rules-graph.sh; clippy onibapi-integration-syncandibapi-integration-async.