pub struct Contract {Show 20 fields
pub contract_id: i32,
pub symbol: String,
pub security_type: SecurityType,
pub last_trade_date_or_contract_month: String,
pub strike: f64,
pub right: String,
pub multiplier: String,
pub exchange: String,
pub currency: String,
pub local_symbol: String,
pub primary_exchange: String,
pub trading_class: String,
pub include_expired: bool,
pub security_id_type: String,
pub security_id: String,
pub combo_legs_description: String,
pub combo_legs: Vec<ComboLeg>,
pub delta_neutral_contract: Option<DeltaNeutralContract>,
pub issuer_id: String,
pub description: String,
}
Expand description
Contract describes an instrument’s definition
Fields§
§contract_id: i32
The unique IB contract identifier.
symbol: String
The underlying’s asset symbol.
security_type: SecurityType
§last_trade_date_or_contract_month: String
The contract’s last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day.
strike: f64
The option’s strike price.
right: String
Either Put or Call (i.e. Options). Valid values are P, PUT, C, CALL.
multiplier: String
The instrument’s multiplier (i.e. options, futures).
exchange: String
The destination exchange.
currency: String
The underlying’s currency.
local_symbol: String
The contract’s symbol within its primary exchange For options, this will be the OCC symbol.
primary_exchange: String
The contract’s primary exchange. For smart routed contracts, used to define contract in case of ambiguity. Should be defined as native exchange of contract, e.g. ISLAND for MSFT For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE.
trading_class: String
The trading class name for this contract. Available in TWS contract description window as well. For example, GBL Dec ’13 future’s trading class is “FGBL”.
include_expired: bool
If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts. Expired options or other instrument types are not available.
security_id_type: String
Security’s identifier when querying contract’s details or placing orders ISIN - Example: Apple: US0378331005 CUSIP - Example: Apple: 037833100.
security_id: String
Identifier of the security type.
combo_legs_description: String
Description of the combo legs.
combo_legs: Vec<ComboLeg>
§delta_neutral_contract: Option<DeltaNeutralContract>
Delta and underlying price for Delta-Neutral combo orders. Underlying (STK or FUT), delta and underlying price goes into this attribute.
issuer_id: String
§description: String
Implementations§
Source§impl Contract
impl Contract
Sourcepub fn stock(symbol: &str) -> Contract
pub fn stock(symbol: &str) -> Contract
Creates stock contract from specified symbol currency defaults to USD and SMART exchange.
Sourcepub fn news(provider_code: &str) -> Contract
pub fn news(provider_code: &str) -> Contract
Creates News contract from specified provider code.
Sourcepub fn option(
symbol: &str,
expiration_date: &str,
strike: f64,
right: &str,
) -> Contract
pub fn option( symbol: &str, expiration_date: &str, strike: f64, right: &str, ) -> Contract
Creates option contract from specified symbol, expiry date, strike price and option type. Defaults currency to USD and exchange to SMART.
§Arguments
symbol
- Symbols of the underlying asset.expiration_date
- Expiration date of option contract (YYYYMMDD)strike
- Strike price of the option contract.right
- Option type: “C” for Call, “P” for Put