[][src]Struct twsapi::core::client::EClient

pub struct EClient<T> where
    T: Wrapper
{ pub conn_state: Arc<Mutex<ConnStatus>>, // some fields omitted }

Struct for sending requests

Fields

conn_state: Arc<Mutex<ConnStatus>>

Implementations

impl<T> EClient<T> where
    T: Wrapper + Send + Sync + 'static, 
[src]

pub fn new(wrapper: Arc<Mutex<T>>) -> Self[src]

pub fn connect(
    &mut self,
    host: &str,
    port: u32,
    client_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Establishes a connection to TWS or IB Gateway

pub fn is_connected(&self) -> bool[src]

Checks connection status

pub fn server_version(&self) -> i32[src]

Get the server version (important for checking feature flags for different versions)

pub fn set_server_log_level(
    &mut self,
    log_evel: i32
) -> Result<(), IBKRApiLibError>
[src]

Sets server logging level

pub fn tws_connection_time(&mut self) -> String[src]

Gets the connection time

pub fn req_current_time(&mut self) -> Result<(), IBKRApiLibError>[src]

Request the current time according to TWS or IB Gateway

pub fn disconnect(&mut self) -> Result<(), IBKRApiLibError>[src]

Disconnect from TWS

pub fn req_mkt_data(
    &mut self,
    req_id: i32,
    contract: &Contract,
    generic_tick_list: &str,
    snapshot: bool,
    regulatory_snapshot: bool,
    mkt_data_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Call this function to request market data. The market data will be returned by the tick_price and tick_size wrapper events.

Arguments

  • req_id - The request id. Must be a unique value. When the market data returns, it will be identified by this tag. This is also used when canceling the market data.
  • contract - This structure contains a description of the Contract for which market data is being requested.
  • generic_tick_list - A commma delimited list of generic tick types. Tick types can be found in the Generic Tick Types page. Prefixing w/ 'mdoff' indicates that top mkt data shouldn't tick. You can specify the news source by postfixing w/ ':. Example: "mdoff, 292: FLY + BRF"
  • snapshot - Check to return a single snapshot of Market data and have the market data subscription cancel. Do not enter any generic_tick_list values if you use snapshots.
  • regulatory_snapshot - With the US Value Snapshot Bundle for stocks, regulatory snapshots are available for 0.01 USD each.
  • mkt_data_options - For internal use only. Use default value XYZ.

pub fn cancel_mkt_data(&mut self, req_id: i32) -> Result<(), IBKRApiLibError>[src]

After calling this function, market data for the specified id will stop flowing.

Arguments

  • req_id - The ID that was specified in the call to req_mkt_data()

pub fn req_market_data_type(
    &mut self,
    market_data_type: i32
) -> Result<(), IBKRApiLibError>
[src]

The API can receive frozen market data from Trader Workstation. Frozen market data is the last data recorded in our system. During normal trading hours, the API receives real-time market data. If you use this function, you are telling TWS to automatically switch to frozen market data after the close. Then, before the opening of the next trading day, market data will automatically switch back to real-time market data.

Arguments

  • market_data_type
  • 1 for real-time streaming market data
  • 2 for frozen market data

pub fn req_smart_components(
    &mut self,
    req_id: i32,
    bbo_exchange: &str
) -> Result<(), IBKRApiLibError>
[src]

Returns the mapping of single letter codes to exchange names given the mapping identifier.

Arguments

  • req_id - The request id. Must be a unique value. When the market data returns, it will be identified by this tag. This is also used when canceling the market data.
  • bbo_exchange - mapping identifier received from Wrapper::tick_req_params

pub fn req_market_rule(
    &mut self,
    market_rule_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Requests details about a given market rule The market rule for an instrument on a particular exchange provides details about how the minimum price increment changes with price

A list of market rule ids can be obtained by invoking req_contract_details on a particular contract. The returned market rule ID list will provide the market rule ID for the instrument in the correspond valid exchange list in contractDetails.

Arguments

  • market_rule_id - the id of market rule

pub fn req_tick_by_tick_data(
    &mut self,
    req_id: i32,
    contract: &Contract,
    tick_type: TickByTickType,
    number_of_ticks: i32,
    ignore_size: bool
) -> Result<(), IBKRApiLibError>
[src]

Request tick by tick data

Arguments

  • req_id - unique identifier of the request.
  • contract - the contract for which tick-by-tick data is requested.
  • tick_type - TickByTickType data type: "Last", "AllLast", "BidAsk" or "MidPoint".
  • number_of_ticks - number of ticks.
  • ignore_size - ignore size flag.

pub fn cancel_tick_by_tick_data(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Cancel tick by tick data

Arguments

  • req_id - The identifier of the original request.

pub fn calculate_implied_volatility(
    &mut self,
    req_id: i32,
    contract: &Contract,
    option_price: f64,
    under_price: f64,
    impl_vol_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Call this function to calculate volatility for a supplied option price and underlying price. Result will be delivered via Wrapper::tick_option_computation

Arguments

  • req_id - The request id.
  • contract - Describes the contract.
  • option_price - The price of the option.
  • under_price - Price of the underlying.
  • impl_vol_options - Implied volatility options.

pub fn calculate_option_price(
    &mut self,
    req_id: i32,
    contract: &Contract,
    volatility: f64,
    under_price: f64,
    opt_prc_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Call this function to calculate option price and greek values for a supplied volatility and underlying price.

Arguments

  • req_id - The request id.
  • contract - Describes the contract.
  • volatility - The volatility.
  • under_price - Price of the underlying.

pub fn cancel_calculate_option_price(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Call this function to cancel a request to calculate the option price and greek values for a supplied volatility and underlying price.

Arguments

  • req_id - The original request id.

pub fn cancel_calculate_implied_volatility(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Call this function to cancel a request to calculate the option implied volatility.

Arguments

  • req_id - The original request id.

pub fn exercise_options(
    &mut self,
    req_id: i32,
    contract: &Contract,
    exercise_action: i32,
    exercise_quantity: i32,
    account: &String,
    over_ride: i32
) -> Result<(), IBKRApiLibError>
[src]

Call this function to excercise options

Arguments

  • req_id - The ticker id. multipleust be a unique value.
  • contract - This structure contains a description of the contract to be exercised
  • exercise_action - Specifies whether you want the option to lapse or be exercised. Values are:
    • 1 = exercise
    • 2 = lapse.
  • exercise_quantity - The quantity you want to exercise.
  • account - destination account
  • override - Specifies whether your setting will override the system's natural action. For example, if your action is "exercise" and the option is not in-the-money, by natural action the option would not exercise. If you have override set to "yes" the natural action would be overridden and the out-of-the money option would be exercised. Values are:
    • 0 = no
    • 1 = yes.

pub fn place_order(
    &mut self,
    order_id: i32,
    contract: &Contract,
    order: &Order
) -> Result<(), IBKRApiLibError>
[src]

Call this function to place an order. The order status will be returned by the Wrapper::order_status event.

Arguments

  • order_id - The order id. You must specify a unique value. When the order status returns, it will be identified by this tag. This tag is also used when canceling the order.
  • contract - This structure contains a description of the contract which is being traded.
  • order - This structure contains the details of the order.

Note: Each client MUST connect with a unique client_id.

pub fn cancel_order(&mut self, order_id: i32) -> Result<(), IBKRApiLibError>[src]

Call this function to cancel an order.

Arguments

  • order_id - The order ID that was specified previously when placing the order

pub fn req_open_orders(&mut self) -> Result<(), IBKRApiLibError>[src]

Call this function to request the open orders that were placed from this client. Each open order will be fed back through the open_order() and order_status() functions on the Wrapper.

Note: The client with a client_id of 0 will also receive the TWS-owned open orders. These orders will be associated with the client and a new order_id will be generated. This association will persist over multiple API and TWS sessions

pub fn req_auto_open_orders(
    &mut self,
    b_auto_bind: bool
) -> Result<(), IBKRApiLibError>
[src]

Call this function to request that newly created TWS orders be implicitly associated with the client.When a new TWS order is created, the order will be associated with the client, and fed back through the openOrder() and orderStatus() functions on the EWrapper.

Note: This request can only be made from a client with client_id of 0.

Arguments

  • b_auto_bind - If set to TRUE, newly created TWS orders will be implicitly associated with the client.If set to FALSE, no association will be made.

pub fn req_all_open_orders(&mut self) -> Result<(), IBKRApiLibError>[src]

Call this function to request the open orders placed from all clients and also from TWS. Each open order will be fed back through the open_order() and order_status() functions on the EWrapper. Note: No association is made between the returned orders and the requesting client.

pub fn req_global_cancel(&mut self) -> Result<(), IBKRApiLibError>[src]

Use this function to cancel all open orders globally. It cancels both API and TWS open orders. If the order was created in TWS, it also gets canceled. If the order was initiated in the API client, it also gets canceled.

pub fn req_ids(&mut self, num_ids: i32) -> Result<(), IBKRApiLibError>[src]

Call this function to request from TWS the next valid ID that can be used when placing an order. After calling this function, the next_valid_id() Wrapper event will be triggered, and the id returned is the next valid ID. That ID will reflect any autobinding that has occurred (which generates new IDs and increments the next valid ID therein).

Arguments

  • num_ids - deprecated

pub fn req_account_updates(
    &mut self,
    subscribe: bool,
    acct_code: &str
) -> Result<(), IBKRApiLibError>
[src]

Call this function to start getting account values, portfolio, and last update time information via Wrapper.update_account_value()); Wrapper.update_portfolio() and Wrapper.update_account_time().

Arguments

  • subscribe - If set to TRUE, the client will start receiving account and Portfoliolio updates. If set to FALSE, the client will stop receiving this information.
  • acct_code - The account code for which to receive account and portfolio updates.

pub fn req_account_summary(
    &mut self,
    req_id: i32,
    group_name: &str,
    tags: &str
) -> Result<(), IBKRApiLibError>
[src]

Requests a specific account's summary. This method will subscribe to the account summary as presented in the TWS' Account Summary tab. The data is returned at Wrapper::account_summary https://www.interactivebrokers.com/en/software/tws/accountwindowtop.htm. Note: This request is designed for an FA managed account but can be used for any multi-account structure.

Arguments

  • req_id - The ID of the data request. Ensures that responses are matched to requests If several requests are in process.
  • group_name - Set to All to return account summary data for all accounts, or set to a specific Advisor Account Group name that has already been created in TWS Global Configuration.
  • tags- A comma-separated list of account tags. See the AccountSummaryTags enum for valid values

pub fn cancel_account_summary(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Cancels the request for Account Window Summary tab data.

Arguments

  • req_id - The ID of the data request being canceled.

pub fn req_positions(&mut self) -> Result<(), IBKRApiLibError>[src]

Requests real-time position data for all accounts.

pub fn cancel_positions(&mut self) -> Result<(), IBKRApiLibError>[src]

Cancels real-time position updates.

pub fn req_positions_multi(
    &mut self,
    req_id: i32,
    account: &str,
    model_code: &str
) -> Result<(), IBKRApiLibError>
[src]

Requests position subscription for account and/or model Initially all positions are returned, and then updates are returned for any position changes in real time.

Arguments

  • req_id - Request's identifier
  • account - If an account Id is provided, only the account's positions belonging to the specified model will be delivered
  • modelCode - The code of the model's positions we are interested in.

pub fn cancel_positions_multi(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Cancels positions request for account and/or model.

Arguments

  • req_id - The id of the original request

pub fn req_account_updates_multi(
    &mut self,
    req_id: i32,
    account: &str,
    model_code: &str,
    ledger_and_nlv: bool
) -> Result<(), IBKRApiLibError>
[src]

Requests account updates for account and/or model.

Arguments

  • req_id - identifier to tag the request
  • account - account values can be requested for a particular account
  • model_code - values can also be requested for a model
  • ledger_and_nvl - returns light-weight request; only currency positions as opposed to account values and currency positions

pub fn cancel_account_updates_multi(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Cancels account update request for account and/or model.

Arguments

  • req_id - The id of the original request

pub fn req_pnl(
    &mut self,
    req_id: i32,
    account: &str,
    model_code: &str
) -> Result<(), IBKRApiLibError>
[src]

Requests profit and loss for account and/or model.

Arguments

  • req_id - identifier to tag the request
  • account - account values can be requested for a particular account
  • model_code - values can also be requested for a model

pub fn cancel_pnl(&mut self, req_id: i32) -> Result<(), IBKRApiLibError>[src]

Cancels profit and loss update request for account and/or model.

Arguments

  • req_id - The id of the original request

pub fn req_pnl_single(
    &mut self,
    req_id: i32,
    account: &str,
    model_code: &str,
    con_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Requests profit and loss for account and/or model for a specific contract.

Arguments

  • req_id - identifier to tag the request
  • account - account values can be requested for a particular account
  • model_code - values can also be requested for a model
  • con_id - contract id of the specific contact of interest

pub fn cancel_pnl_single(&mut self, req_id: i32) -> Result<(), IBKRApiLibError>[src]

Cancels profit and loss update request for account and/or model.

Arguments

  • req_id - The id of the original request

pub fn req_executions(
    &mut self,
    req_id: i32,
    exec_filter: &ExecutionFilter
) -> Result<(), IBKRApiLibError>
[src]

When this function is called, the execution reports that meet the filter criteria are downloaded to the client via the execDetails() function. To view executions beyond the past 24 hours, open the Trade Log in TWS and, while the Trade Log is displayed, request the executions again from the API.

Arguments

  • req_id - The ID of the data request. Ensures that responses are matched to requests if several requests are in process.
  • exec_filter - This object contains attributes that describe the filter criteria used to determine which execution reports are returned.

NOTE: Time format must be 'yyyymmdd-hh:mm:ss' Eg: '20030702-14:55'

pub fn req_contract_details(
    &mut self,
    req_id: i32,
    contract: &Contract
) -> Result<(), IBKRApiLibError>
[src]

Call this function to download all details for a particular underlying. The contract details will be received via the contractDetails() function on the EWrapper.

Arguments

  • req_id - The ID of the data request. Ensures that responses are matched to requests if several requests are in process.
  • contract - The summary description of the contract being looked up.

pub fn req_mkt_depth_exchanges(&mut self) -> Result<(), IBKRApiLibError>[src]

Requests venues for which market data is returned to update_mkt_depth_l2 (those with market makers)

pub fn req_mkt_depth(
    &mut self,
    req_id: i32,
    contract: &Contract,
    num_rows: i32,
    is_smart_depth: bool,
    mkt_depth_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Call this function to request market depth for a specific contract. The market depth will be returned by the update_mkt_depth() and update_mkt_depth_l2() events.

Requests the contract's market depth (order book). Note this request must be direct-routed to an exchange and not smart-routed. The number of simultaneous market depth requests allowed in an account is calculated based on a formula that looks at an accounts equity, commissions, and quote booster packs.

Arguments

  • req_id - The request id. Must be a unique value. When the market depth data returns, it will be identified by this tag. This is also used when canceling the market depth
  • contract - This structure contains a description of the contract for which market depth data is being requested.
  • num_rows - Specifies the number of rows of market depth rows to display.
  • is_smart_depth - specifies SMART depth request NOTE: ALWAYS SET TO FALSE!!!!! THERE SEEMS TO BE A BUG ON IB's SIDE AND THEY WILL STOP STREAMING DATA IF THIS IS SET TO TRUE
  • mkt_depth_options - For internal use only. Use default value XYZ.

pub fn cancel_mkt_depth(
    &mut self,
    req_id: i32,
    is_smart_depth: bool
) -> Result<(), IBKRApiLibError>
[src]

After calling this function, market depth data for the specified id will stop flowing.

Arguments

  • req_id - The ID that was specified in the call to req_mkt_depth().

pub fn req_news_bulletins(
    &mut self,
    all_msgs: bool
) -> Result<(), IBKRApiLibError>
[src]

Call this function to start receiving news bulletins. Each bulletin will be returned by the update_news_bulletin() event.

Arguments

  • all_msgs - If set to TRUE, returns all the existing bulletins for

pub fn cancel_news_bulletins(&mut self) -> Result<(), IBKRApiLibError>[src]

Call this function to stop receiving news bulletins.

pub fn req_managed_accts(&mut self) -> Result<(), IBKRApiLibError>[src]

Call this function to request the list of managed accounts. The list will be returned by the managed_accounts() function on the Wrapper.

Note: This request can only be made when connected to a FA managed account.

pub fn request_fa(&mut self, fa_data: FaDataType) -> Result<(), IBKRApiLibError>[src]

Call this function to request FA configuration information from TWS. The data returns in an XML string via a "receiveFA" ActiveX event.

Arguments

  • fa_data - See the FaDataType enum. Specifies the type of Financial Advisor configuration data beingingg requested. Valid values include:
    • 1 = GROUPS
    • 2 = PROFILE
    • 3 = ACCOUNT ALIASES

pub fn replace_fa(
    &mut self,
    fa_data: FaDataType,
    cxml: &str
) -> Result<(), IBKRApiLibError>
[src]

Call this function to modify FA configuration information from the API. Note that this can also be done manually in TWS itself.

  • fa_data - See the FaDataType enum. Specifies the type of Financial Advisor configuration data beingingg requested. Valid values include:
    • 1 = GROUPS
    • 2 = PROFILE
    • 3 = ACCOUNT ALIASES *cxml - The XML string containing the new FA configuration information.

pub fn req_historical_data(
    &mut self,
    req_id: i32,
    contract: &Contract,
    end_date_time: &str,
    duration_str: &str,
    bar_size_setting: &str,
    what_to_show: &str,
    use_rth: i32,
    format_date: i32,
    keep_up_to_date: bool,
    chart_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Requests contracts' historical data. When requesting historical data, a finishing time and date is required along with a duration string. The resulting bars will be returned in EWrapper.historicalData()

Arguments

  • req_id - The id of the request. Must be a unique value. When the market data returns, it whatToShowill be identified by this tag. This is also used when canceling the market data.

  • contract - This object contains a description of the contract for which market data is being requested.

  • end_date_time - Defines a query end date and time at any point during the past 6 mos. Valid values include any date/time within the past six months in the format: yyyymmdd HH:mm:ss ttt where "ttt" is the optional time zone.

  • duration_str - Set the query duration up to one week, using a time unit of seconds, days or weeks. Valid values include any integer followed by a space and then S (seconds)); D (days) or W (week). If no unit is specified, seconds is used.

  • bar_size_setting - See the BarSize enum for valid values. Specifies the size of the bars that will be returned (within IB/TWS listimits). Valid values include:

    • 1 sec
    • 5 secs
    • 15 secs
    • 30 secs
    • 1 min
    • 2 mins
    • 3 mins
    • 5 mins
    • 15 mins
    • 30 mins
    • 1 hour
    • 1 day
  • what_to_show - See the WhatToShow enum for valid values. Determines the nature of data beinging extracted. Valid values include:

    • TRADES
    • MIDPOINT
    • BID
    • ASK
    • BID_ASK
    • HISTORICAL_VOLATILITY
    • OPTION_IMPLIED_VOLATILITY
  • use_rth - Determines whether to return all data available during the requested time span, or only data that falls within regular trading hours. Valid values include:

    • 0 - all data is returned even where the market in question was outside of its regular trading hours.
    • 1 - only data within the regular trading hours is returned, even if the requested time span falls partially or completely outside of the RTH.
  • format_date - Determines the date format applied to returned bars. validd values include:

    • 1 - dates applying to bars returned in the format: yyyymmdd{space}{space}hh:mm:dd
    • 2 - dates are returned as a long integer specifying the number of seconds since 1/1/1970 GMT. *chart_options: - For internal use only. Use default value XYZ.

pub fn cancel_historical_data(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Used if an internet disconnect has occurred or the results of a query are otherwise delayed and the client is no longer interested in receiving the data.

Arguments

  • req_id - the id of the original request

pub fn req_head_time_stamp(
    &mut self,
    req_id: i32,
    contract: &Contract,
    what_to_show: &str,
    use_rth: i32,
    format_date: i32
) -> Result<(), IBKRApiLibError>
[src]

Returns the timestamp of earliest available historical data for a contract and data type.

Arguments

  • req_id - an identifier for the request
  • contract - contract object for which head timestamp is being requested
  • what_to_show - type of data for head timestamp - "BID", "ASK", "TRADES", etc
  • use_rth - use regular trading hours only, 1 for yes or 0 for no
  • format_date set to 1 to obtain the bars' time as yyyyMMdd HH:mm:ss, set to 2 to obtain it like system time format in seconds

Note that formatData parameter affects intraday bars only 1-day bars always return with date in YYYYMMDD format

pub fn cancel_head_time_stamp(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Cancel the request

Arguments

  • req_id - the id of the original request

pub fn req_histogram_data(
    &mut self,
    ticker_id: i32,
    contract: &Contract,
    use_rth: bool,
    time_period: &str
) -> Result<(), IBKRApiLibError>
[src]

Returns data histogram of specified contract

Arguments

  • ticker_id - an identifier for the request
  • contract - Contract object for which histogram is being requested
  • use_rth - use regular trading hours only, 1 for yes or 0 for no
  • time_period - period of which data is being requested, e.g. "3 days"

pub fn cancel_histogram_data(
    &mut self,
    ticker_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Cancel the request

Arguments

  • req_id - the id of the original request

pub fn req_historical_ticks(
    &mut self,
    req_id: i32,
    contract: &Contract,
    start_date_time: &str,
    end_date_time: &str,
    number_of_ticks: i32,
    what_to_show: &str,
    use_rth: i32,
    ignore_size: bool,
    misc_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Requests historical Time&Sales data for an instrument.

Arguments

  • req_id - id of the request
  • contract - Contract object that is subject of query
  • start_date_time,i.e. "20170701 12:01:00". Uses TWS timezone specified at login.
  • end_date_time,i.e. "20170701 13:01:00". In TWS timezone. Exactly one of start time and end time has to be defined.
  • number_of_ticks - Number of distinct data points. Max currently 1000 per request.
  • what_to_show - (Bid_Ask, Midpoint, Trades) Type of data requested.
  • use_rth - Data from regular trading hours (1), or all available hours (0)
  • ignore_size - A filter only used when the source price is Bid_Ask
  • misc_options - should be defined as null, reserved for internal use

pub fn req_scanner_parameters(&mut self) -> Result<(), IBKRApiLibError>[src]

Requests an XML list of scanner parameters valid in TWS. Not all parameters are valid from API scanner.

pub fn req_scanner_subscription(
    &mut self,
    req_id: i32,
    subscription: ScannerSubscription,
    scanner_subscription_options: Vec<TagValue>,
    scanner_subscription_filter_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Starts a subscription to market scan results based on the provided parameters.

Arguments

  • req_id - The ticker ID. Must be a unique value.
  • subscription - This structure contains possible parameters used to filter results.
  • scanner_subscription_options - For internal use only. Use default value XYZ

pub fn cancel_scanner_subscription(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Cancel the request

Arguments

  • req_id - the id of the original request

pub fn req_real_time_bars(
    &mut self,
    req_id: i32,
    contract: &Contract,
    bar_size: i32,
    what_to_show: &str,
    use_rth: bool,
    real_time_bars_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Call the req_real_time_bars() function to start receiving real time bar results through the realtimeBar() EWrapper function.

Arguments

  • req_id - The Id for the request. Must be a unique value. When the data is received, it will be identified by this Id. This is also used when canceling the request.
  • contract - This object contains a description of the contract for which real time bars are being requested
  • bar_size - Currently only 5 second bars are supported, if any other value is used, an exception will be thrown.
  • what_to_show - Determines the nature of the data extracted. Valid values include: * TRADES * BID * ASK * MIDPOINT
  • use_rth:bool - Regular Trading Hours only. Valid values include: * 0 = all data available during the time span requested is returned, including time intervals when the market in question was outside of regular trading hours. * 1 = only data within the regular trading hours for the product requested is returned, even if the time time span falls partially or completely outside.
  • real_time_bars_options: - For internal use only. Use pub fnault value XYZ

pub fn cancel_real_time_bars(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Call this to stop receiving real time bars.

Arguments

  • req_id - The Id that was specified in the call to req_real_time_bars().

pub fn req_fundamental_data(
    &mut self,
    req_id: i32,
    contract: &Contract,
    report_type: &str,
    fundamental_data_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Call this function to receive fundamental data for stocks. The appropriate market data subscription must be set up in Account Management before you can receive this data. Fundamental data will be returned at EWrapper.fundamentalData().

req_fundamental_data() can handle conid specified in the Contract object, but not trading_class or multiplier. This is because req_fundamental_data() is used only for stocks and stocks do not have a multiplier and trading class.

Arguments

  • req_id - The ID of the data request. Ensures that responses are matched to requests if several requests are in process.
  • contract - This structure contains a description of the contract for which fundamental data is being requested.
  • report_type - One of the following XML reports:
    • ReportSnapshot (company overview)
    • ReportsFinSummary (financial summary)
    • ReportRatios (financial ratios)
    • ReportsFinStatements (financial statements)
    • RESC (analyst estimates)
    • CalendarReport (company calendar)

pub fn cancel_fundamental_data(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Call this function to stop receiving fundamental data.

Arguments

  • req_id - The ID of the data request

pub fn req_news_providers(&mut self) -> Result<(), IBKRApiLibError>[src]

Requests all open orders places by this specific API client (identified by the API client id). For client ID 0, this will bind previous manual TWS orders.

pub fn req_news_article(
    &mut self,
    req_id: i32,
    provider_code: &str,
    article_id: &str,
    news_article_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Requests news article body given articleId.

Arguments

  • req_id - id of the request
  • provider_code - short code indicating news provider, e.g. FLY
  • article_id - id of the specific article
  • news_article_options - reserved for internal use. Should be defined as null.

pub fn req_historical_news(
    &mut self,
    req_id: i32,
    con_id: i32,
    provider_codes: &str,
    start_date_time: &str,
    end_date_time: &str,
    total_results: i32,
    historical_news_options: Vec<TagValue>
) -> Result<(), IBKRApiLibError>
[src]

Requests historical news headlines.

Arguments

  • req_id - id of the request
  • con_id - contract id
  • provider_codes - a '+'-separated list of provider codes
  • start_date_time - marks the (exclusive) start of the date range. The format is yyyy-MM-dd HH:mm:ss.0
  • end_date_time - marks the (inclusive) end of the date range. The format is yyyy-MM-dd HH:mm:ss.0
  • total_results - the maximum number of headlines to fetch (1 - 300)
  • historical_news_options reserved for internal use. Should be defined as null.

pub fn query_display_groups(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Replaces Financial Advisor's settings A Financial Advisor can define three different configurations:

  1. Groups - offer traders a way to create a group of accounts and apply a single allocation method to all accounts in the group.
  2. Profiles - let you allocate shares on an account-by-account basis using a predefined calculation value.
  3. Account Aliases - let you easily identify the accounts by meaningful names rather than account numbers. More information at https://www.interactivebrokers.com/en/?f=%2Fen%2Fsoftware%2Fpdfhighlights%2FPDF-AdvisorAllocations.php%3Fib_entity%3Dllc

Arguments

  • req_id - The unique number that will be associated with the response

pub fn subscribe_to_group_events(
    &mut self,
    req_id: i32,
    group_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Integrates API client and TWS window grouping.

Arguments

  • req_id - The unique number that will be associated with the response
  • group_id - is the display group for integration

pub fn update_display_group(
    &mut self,
    req_id: i32,
    contract_info: &str
) -> Result<(), IBKRApiLibError>
[src]

Updates the contract displayed in a TWS Window Group.

Arguments

  • req_id - The requestId specified in subscribe_to_group_events().
  • contract_info is an encoded value designating a unique IB contract. Possible values include:
  1. none - empty selection
  2. contract_id - any non-combination contract. Examples 8314 for IBM SMART; 8314 for IBM ARCA
  3. combo - if any combo is selected Note: This request from the API does not get a TWS response unless an error occurs.

pub fn unsubscribe_from_group_events(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Cancel subscription

Arguments

  • req_id - The request Id specified in subscribe_to_group_events()

pub fn verify_request(
    &mut self,
    api_name: &str,
    api_version: &str
) -> Result<(), IBKRApiLibError>
[src]

For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs.

pub fn verify_message(
    &mut self,
    api_data: &'static str
) -> Result<(), IBKRApiLibError>
[src]

For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs.

pub fn verify_and_auth_request(
    &mut self,
    api_name: &str,
    api_version: &str,
    opaque_isv_key: &str
) -> Result<(), IBKRApiLibError>
[src]

For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs.

pub fn verify_and_auth_message(
    &mut self,
    api_data: &str,
    xyz_response: &str
) -> Result<(), IBKRApiLibError>
[src]

For IB's internal purpose. Allows to provide means of verification between the TWS and third party programs

pub fn req_sec_def_opt_params(
    &mut self,
    req_id: i32,
    underlying_symbol: &str,
    fut_fop_exchange: &str,
    underlying_sec_type: &str,
    underlying_con_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Requests security definition option parameters for viewing a contract's option chain.

Arguments

  • req_id - the ID chosen for the request
  • underlying_symbol
  • fut_fop_exchange - The exchange on which the returned options are trading. Can be set to the empty string "" for all exchanges.
  • underlying_sec_type - The type of the underlying security, i.e. STK
  • underlying_con_id - the contract ID of the underlying security

pub fn req_soft_dollar_tiers(
    &mut self,
    req_id: i32
) -> Result<(), IBKRApiLibError>
[src]

Requests pre-defined Soft Dollar Tiers. This is only supported for registered professional advisors and hedge and mutual funds who have configured Soft Dollar Tiers in Account Management. Refer to: https://www.interactivebrokers.com/en/software/am/am/manageaccount/requestsoftdollars.htm?Highlight=soft%20dollar%20tier.

Arguments

  • req_id - the identifier for this request

pub fn req_family_codes(&mut self) -> Result<(), IBKRApiLibError>[src]

Requests family codes for an account, for instance if it is a FA, IBroker, or associated account.

pub fn req_matching_symbols(
    &mut self,
    req_id: i32,
    pattern: &str
) -> Result<(), IBKRApiLibError>
[src]

Requests matching stock symbols.

Arguments

  • req_id - the identifier for this request
  • pattern - either start of ticker symbol or (for larger strings) company name

pub fn req_completed_orders(
    &mut self,
    api_only: bool
) -> Result<(), IBKRApiLibError>
[src]

Requests completed orders.

Arguments

  • api_only - If api_only parameter is true, then only completed orders placed from API are requested. Each completed order will be fed back through the completed_order() function on the Wrapper

Auto Trait Implementations

impl<T> !RefUnwindSafe for EClient<T>[src]

impl<T> Send for EClient<T>[src]

impl<T> Sync for EClient<T>[src]

impl<T> Unpin for EClient<T>[src]

impl<T> !UnwindSafe for EClient<T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> UnsafeAny for T where
    T: Any