Skip to content

6.0: ContractDetails::under_security_type is Option<SecurityType> - #1254

Open
faysou wants to merge 2 commits into
wboayue:mainfrom
faysou:contracts/under-security-type
Open

faysou wants to merge 2 commits into
wboayue:mainfrom
faysou:contracts/under-security-type

Conversation

@faysou

@faysou faysou commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Why

ContractDetails::under_security_type was a String holding a TWS security type code, or "". A caller checking whether a contract is a futures option compared against "FUT", while Contract::security_type is already a SecurityType.

What

  • under_security_type is Option<SecurityType>, decoded with the existing parse_optional: None when TWS sends nothing, SecurityType::Other for a code the crate doesn't model, so a new code never fails the request.
  • Migration guide §40 (numbered after 6.0: OptionChain::expirations is Vec<Expiry> #1253's §39), changelog entry under Changed, wire-facts entry under contracts.
  • The serialized form changes to match Contract::security_type (the variant name, or null); the migration section says so.

Verified

  • Live, paper TWS server 223: AAPL stock and SPX index send no underSecType; the ES future sends IND; all 680 AAPL options for 202612 send STK; all 7582 ES futures options for 202612 send FUT.
  • Decoder test: STK, FUT, IND, an unmodeled code, empty, and absent.
  • Gates: cargo fmt; clippy, rustdoc, examples and cargo test on the default, sync-only and all-features legs; tools/check-rules-graph.sh; clippy on ibapi-integration-sync and ibapi-integration-async.

TWS sends the underlying's security type as one of its codes (STK for a
stock option, FUT for a futures option, IND for a future on an index)
and nothing for a stock or an index, live on paper TWS. The field was a
String, empty when TWS sent nothing. It now decodes with the existing
SecurityType parser, None when absent and SecurityType::Other for a code
the crate doesn't model. Migration section 40.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant