Skip to main content

ib_contract_to_instrument_id_simplified

Function ib_contract_to_instrument_id_simplified 

Source
pub fn ib_contract_to_instrument_id_simplified(
    contract: &Contract,
    venue: Option<Venue>,
) -> Result<InstrumentId>
Expand description

Convert an IB Contract to an InstrumentId using simplified symbology.

This implements IB_SIMPLIFIED symbology: clean, readable symbols. For example:

  • STK: “AAPL” -> “AAPL.SMART”
  • CASH: “EUR.USD” -> “EUR/USD.IDEALPRO”
  • FUT: “ESM23” -> “ESM23.GLOBEX”
  • OPT: “AAPL230120C00150000” -> “AAPL230120C00150000.SMART”
  • IND: “SPX” -> “^SPX.SMART”

§Arguments

  • contract - The IB contract to convert
  • venue - Optional venue override (defaults based on security type)

§Errors

Returns an error if the instrument ID cannot be constructed.