pub fn option_contract(
symbol: &str,
last_trade_date: &str,
strike: f64,
right: &str,
exchange: &str,
currency: &str,
) -> Result<Contract, ContractConfigError>Expand description
Build an options contract.
ยงErrors
Returns ContractConfigError::UnrecognizedOptionRight if right is not
one of C/CALL/P/PUT (case-insensitive; leading and trailing
whitespace is ignored). An option contract is invalid without a valid right,
so this is surfaced at construction rather than as a later IBKR submission
rejection.
Only right is validated here. last_trade_date and strike are forwarded
to the IBKR contract as-is; an empty date or a 0.0 strike will build a
(quietly wrong) contract. Presence of those fields is checked one level up in
ContractConfig::to_contract, which is
the intended entry point for config-driven construction.