fix: accept expiration="0" wildcard + REST format parity with MCP#241
Merged
Conversation
Finding 1: Bulk option queries with expiration="0" (all expirations) were rejected by validate_date() which requires 8-digit YYYYMMDD. Add validate_expiration() that accepts "0" as a special wildcard, and required_expiration()/optional_expiration() accessors used by generated endpoint dispatch for Expiration-typed params. Finding 2: REST server format.rs was missing fields that MCP already serializes. Updated quote_ticks_to_json (added midpoint + contract IDs), trade_quote_ticks_to_json (added ext_condition1-4, condition_flags, price_flags, volume_type, records_back + contract IDs), and greeks_ticks_to_json (added contract IDs). Also added contract ID support to eod, ohlc, trade, open_interest, market_value, and iv tick serializers via insert_contract_id_fields helper matching MCP. Added 5 expiration validation tests and 4 REST format regression tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
Expiration wildcard "0": Added
validate_expiration(),required_expiration(), andoptional_expiration()to accept ThetaData'sexpiration="0"wildcard (all expirations) in bulk option queries. Previouslyvalidate_date()rejected anything except 8-digit YYYYMMDD. Updated build-time code generation to routeExpirationparam type through the new accessors instead ofrequired_date/optional_date.REST format.rs parity with MCP: Brought the REST server's JSON serializers up to parity with the MCP server:
quote_ticks_to_json: addedmidpointfield and conditional contract IDs (expiration,strike,right)trade_quote_ticks_to_json: addedext_condition1-4,condition_flags,price_flags,volume_type,records_back, and conditional contract IDsgreeks_ticks_to_json: added conditional contract IDseod,ohlc,trade,open_interest,market_value,iv): added conditional contract IDs via sharedinsert_contract_id_fieldshelper matching MCP behavior (omit whenexpiration == 0)Test plan
cargo fmt --all -- --checkcleancargo clippy --workspace --all-targets -- -D warningscleancargo test --workspaceall 149 tests passcargo test --manifest-path tools/server/Cargo.tomlall 7 tests passcargo test --manifest-path tools/mcp/Cargo.tomlall 13 tests pass🤖 Generated with Claude Code