Struct Contract

Source
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

Source

pub fn stock(symbol: &str) -> Contract

Creates stock contract from specified symbol currency defaults to USD and SMART exchange.

Source

pub fn futures(symbol: &str) -> Contract

Creates futures contract from specified symbol

Source

pub fn crypto(symbol: &str) -> Contract

Creates Crypto contract from specified symbol

Source

pub fn news(provider_code: &str) -> Contract

Creates News contract from specified provider code.

Source

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
Source

pub fn is_bag(&self) -> bool

Is Bag request

Trait Implementations§

Source§

impl Clone for Contract

Source§

fn clone(&self) -> Contract

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Contract

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Contract

Source§

fn default() -> Contract

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Contract

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Contract

Source§

fn eq(&self, other: &Contract) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Contract

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Contract

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,