Skip to main content

DefaultWrapper

Struct DefaultWrapper 

Source
pub struct DefaultWrapper {}
Expand description

Example implementation of the Wrapper callback trait. Just logs callback methods

Implementations§

Source§

impl DefaultWrapper

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Wrapper for DefaultWrapper

Source§

fn error(&mut self, req_id: i32, error_code: i32, error_string: &str)

This event is called when there is an error with the communication or when TWS wants to send a message to the core.
Source§

fn win_error(&mut self, text: &str, last_error: i32)

Source§

fn connect_ack(&mut self)

Source§

fn market_data_type(&mut self, req_id: i32, market_data_type: i32)

TWS sends a market_data_type(type) callback to the API, where type is set to Frozen or RealTime, to announce that market data has been switched between frozen and real-time. This notification occurs only when market data switches between real-time and frozen. The market_data_type() callback accepts a req_id parameter and is sent per every subscription because different contracts can generally trade on a different schedule.
Source§

fn tick_price( &mut self, req_id: i32, tick_type: TickType, price: f64, attrib: TickAttrib, )

Market data tick price callback. Handles all price related ticks.
Source§

fn tick_size(&mut self, req_id: i32, tick_type: TickType, size: i32)

Market data tick size callback. Handles all size-related ticks.
Source§

fn tick_snapshot_end(&mut self, req_id: i32)

When requesting market data snapshots, this market will indicate the snapshot reception is finished.
Source§

fn tick_generic(&mut self, req_id: i32, tick_type: TickType, value: f64)

Source§

fn tick_string(&mut self, req_id: i32, tick_type: TickType, value: &str)

Source§

fn tick_efp( &mut self, req_id: i32, tick_type: TickType, basis_points: f64, formatted_basis_points: &str, total_dividends: f64, hold_days: i32, future_last_trade_date: &str, dividend_impact: f64, dividends_to_last_trade_date: f64, )

market data call back for Exchange for Physical Read more
Source§

fn order_status( &mut self, order_id: i32, status: &str, filled: f64, remaining: f64, avg_fill_price: f64, perm_id: i32, parent_id: i32, last_fill_price: f64, client_id: i32, why_held: &str, mkt_cap_price: f64, )

This event is called whenever the status of an order changes. It is also fired after reconnecting to TWS if the core has any open orders. Read more
Source§

fn open_order( &mut self, order_id: i32, contract: Contract, order: Order, order_state: OrderState, )

This function is called to feed in open orders. Read more
Source§

fn open_order_end(&mut self)

This is called at the end of a given request for open orders.
Source§

fn connection_closed(&mut self)

This function is called when TWS closes the sockets connection with the ActiveX control, or when TWS is shut down.
Source§

fn update_account_value( &mut self, key: &str, val: &str, currency: &str, account_name: &str, )

This function is called only when req_account_updates on EClient object has been called.
Source§

fn update_portfolio( &mut self, contract: Contract, position: f64, market_price: f64, market_value: f64, average_cost: f64, unrealized_pnl: f64, realized_pnl: f64, account_name: &str, )

This function is called only when req_account_updates on EClient object has been called.
Source§

fn update_account_time(&mut self, time_stamp: &str)

Source§

fn account_download_end(&mut self, account_name: &str)

This is called after a batch update_account_value() and update_portfolio() is sent.
Source§

fn next_valid_id(&mut self, order_id: i32)

Receives next valid order id.
Source§

fn contract_details(&mut self, req_id: i32, contract_details: ContractDetails)

Receives the full contract’s definitions. This method will return all contracts matching the requested via req_contract_details. For example, one can obtain the whole option chain with it.
Source§

fn bond_contract_details( &mut self, req_id: i32, contract_details: ContractDetails, )

This function is called when req_contract_details function has been called for bonds.
Source§

fn contract_details_end(&mut self, req_id: i32)

This function is called once all contract details for a given request are received. This helps to define the end of an option chain.
Source§

fn exec_details( &mut self, req_id: i32, contract: Contract, execution: Execution, )

This event is fired when the req_executions() functions is invoked, or when an order is filled.
Source§

fn exec_details_end(&mut self, req_id: i32)

This function is called once all executions have been sent to a core in response to req_executions().
Source§

fn update_mkt_depth( &mut self, req_id: i32, position: i32, operation: i32, side: i32, price: f64, size: i32, )

Returns the order book. Read more
Source§

fn update_mkt_depth_l2( &mut self, req_id: i32, position: i32, market_maker: &str, operation: i32, side: i32, price: f64, size: i32, is_smart_depth: bool, )

Returns the order book. Read more
Source§

fn update_news_bulletin( &mut self, msg_id: i32, msg_type: i32, news_message: &str, origin_exch: &str, )

provides IB’s bulletins Read more
Source§

fn managed_accounts(&mut self, accounts_list: &str)

Receives a comma-separated string with the managed account ids.
Source§

fn receive_fa(&mut self, fa_data: FaDataType, cxml: &str)

receives the Financial Advisor’s configuration available in the TWS Read more
Source§

fn historical_data(&mut self, req_id: i32, bar: BarData)

returns the requested historical data bars Read more
Source§

fn historical_data_end(&mut self, req_id: i32, start: &str, end: &str)

Marks the ending of the historical bars reception.
Source§

fn scanner_parameters(&mut self, xml: &str)

Provides the xml-formatted parameters available to create a market scanner. Read more
Source§

fn scanner_data( &mut self, req_id: i32, rank: i32, contract_details: ContractDetails, distance: &str, benchmark: &str, projection: &str, legs_str: &str, )

Provides the data resulting from the market scanner request. Read more
Source§

fn scanner_data_end(&mut self, req_id: i32)

Indicates the scanner data reception has terminated.
Source§

fn realtime_bar(&mut self, req_id: i32, bar: RealTimeBar)

Updates the real time 5 seconds bars Read more
Source§

fn current_time(&mut self, time: i64)

Server’s current time. This method will receive IB server’s system time resulting after the invokation of req_current_time.
Source§

fn fundamental_data(&mut self, req_id: i32, data: &str)

This function is called to receive fundamental market data. The appropriate market data subscription must be set up in Account Management before you can receive this data.
Source§

fn delta_neutral_validation( &mut self, req_id: i32, delta_neutral_contract: DeltaNeutralContract, )

Upon accepting a Delta-Neutral RFQ(request for quote), the server sends a delta_neutral_validation() message with the DeltaNeutralContract structure. If the delta and price fields are empty in the original request, the confirmation will contain the current values from the server. These values are locked when the RFQ is processed and remain locked until the RFQ is canceled.
Source§

fn commission_report(&mut self, commission_report: CommissionReport)

The commission_report() callback is triggered as follows: immediately after a trade execution by calling req_executions().
Source§

fn position( &mut self, account: &str, contract: Contract, position: f64, avg_cost: f64, )

This event returns real-time positions for all accounts in response to the reqPositions() method.
Source§

fn position_end(&mut self)

This is called once all position data for a given request are received and functions as an end marker for the position data.
Source§

fn account_summary( &mut self, req_id: i32, account: &str, tag: &str, value: &str, currency: &str, )

Returns the data from the TWS Account Window Summary tab in response to req_account_summary().
Source§

fn account_summary_end(&mut self, req_id: i32)

This method is called once all account summary data for a given request are received.
Source§

fn verify_message_api(&mut self, api_data: &str)

Deprecated Function
Source§

fn verify_completed(&mut self, is_successful: bool, error_text: &str)

Deprecated Function
Source§

fn verify_and_auth_message_api(&mut self, api_data: &str, xyz_challange: &str)

Deprecated Function
Source§

fn verify_and_auth_completed(&mut self, is_successful: bool, error_text: &str)

Deprecated Function
Source§

fn display_group_list(&mut self, req_id: i32, groups: &str)

This callback is a one-time response to query_display_groups(). Read more
Source§

fn display_group_updated(&mut self, req_id: i32, contract_info: &str)

This is sent by TWS to the API core once after receiving the subscription request subscribe_to_group_events(), and will be sent again if the selected contract in the subscribed display group has changed. Read more
Source§

fn position_multi( &mut self, req_id: i32, account: &str, model_code: &str, contract: Contract, pos: f64, avg_cost: f64, )

same as position() except it can be for a certain account/model
Source§

fn position_multi_end(&mut self, req_id: i32)

same as position_end() except it can be for a certain account/model
Source§

fn account_update_multi( &mut self, req_id: i32, account: &str, model_code: &str, key: &str, value: &str, currency: &str, )

same as update_account_value() except it can be for a certain account/model
Source§

fn account_update_multi_end(&mut self, req_id: i32)

same as account_download_end() except it can be for a certain account/model
Source§

fn tick_option_computation( &mut self, req_id: i32, tick_type: TickType, implied_vol: f64, delta: f64, opt_price: f64, pv_dividend: f64, gamma: f64, vega: f64, theta: f64, und_price: f64, )

This function is called when the market in an option or its underlier moves. TWS’s option model volatilities, prices, and deltas, along with the present value of dividends expected on that options underlier are received.
Source§

fn security_definition_option_parameter( &mut self, req_id: i32, exchange: &str, underlying_con_id: i32, trading_class: &str, multiplier: &str, expirations: HashSet<String>, strikes: HashSet<BigDecimal>, )

Returns the option chain for an underlying on an exchange specified in req_sec_def_opt_params There will be multiple callbacks to security_definition_option_parameter if multiple exchanges are specified in req_sec_def_opt_params Read more
Source§

fn security_definition_option_parameter_end(&mut self, req_id: i32)

Called when all callbacks to security_definition_option_parameter are complete Read more
Source§

fn soft_dollar_tiers(&mut self, req_id: i32, tiers: Vec<SoftDollarTier>)

Called when receives Soft Dollar Tier configuration information Read more
Source§

fn family_codes(&mut self, family_codes: Vec<FamilyCode>)

returns array of family codes
Source§

fn symbol_samples( &mut self, req_id: i32, contract_descriptions: Vec<ContractDescription>, )

returns array of sample contract descriptions
Source§

fn mkt_depth_exchanges( &mut self, depth_mkt_data_descriptions: Vec<DepthMktDataDescription>, )

returns array of exchanges which return depth to UpdateMktDepthL2
Source§

fn tick_news( &mut self, ticker_id: i32, time_stamp: i32, provider_code: &str, article_id: &str, headline: &str, extra_data: &str, )

returns news headlines
Source§

fn smart_components( &mut self, req_id: i32, smart_components: Vec<SmartComponent>, )

returns exchange component mapping
Source§

fn tick_req_params( &mut self, ticker_id: i32, min_tick: f64, bbo_exchange: &str, snapshot_permissions: i32, )

returns exchange map of a particular contract
Source§

fn news_providers(&mut self, news_providers: Vec<NewsProvider>)

returns available, subscribed API news providers
Source§

fn news_article( &mut self, request_id: i32, article_type: i32, article_text: &str, )

returns body of news article
Source§

fn historical_news( &mut self, request_id: i32, time: &str, provider_code: &str, article_id: &str, headline: &str, )

returns historical news headlines
Source§

fn historical_news_end(&mut self, request_id: i32, has_more: bool)

signals end of historical news
Source§

fn head_timestamp(&mut self, req_id: i32, head_timestamp: &str)

returns earliest available data of a type of data for a particular contract
Source§

fn histogram_data(&mut self, req_id: i32, items: Vec<HistogramData>)

returns histogram data for a contract
Source§

fn historical_data_update(&mut self, req_id: i32, bar: BarData)

returns updates in real time when keepUpToDate is set to True
Source§

fn reroute_mkt_data_req(&mut self, req_id: i32, con_id: i32, exchange: &str)

returns reroute cfd contract information for market data request
Source§

fn reroute_mkt_depth_req(&mut self, req_id: i32, con_id: i32, exchange: &str)

returns reroute cfd contract information for market depth request
Source§

fn market_rule( &mut self, market_rule_id: i32, price_increments: Vec<PriceIncrement>, )

returns minimum price increment structure for a particular market rule ID
Source§

fn pnl( &mut self, req_id: i32, daily_pn_l: f64, unrealized_pn_l: f64, realized_pn_l: f64, )

returns the daily PnL for the account
Source§

fn pnl_single( &mut self, req_id: i32, pos: i32, daily_pn_l: f64, unrealized_pn_l: f64, realized_pn_l: f64, value: f64, )

returns the daily PnL for a single position in the account
Source§

fn historical_ticks( &mut self, req_id: i32, ticks: Vec<HistoricalTick>, done: bool, )

returns historical tick data when what_to_how=MIDPOINT
Source§

fn historical_ticks_bid_ask( &mut self, req_id: i32, ticks: Vec<HistoricalTickBidAsk>, done: bool, )

returns historical tick data when what_to_how=BID_ASK
Source§

fn historical_ticks_last( &mut self, req_id: i32, ticks: Vec<HistoricalTickLast>, done: bool, )

returns historical tick data when what_to_how=TRADES
Source§

fn tick_by_tick_all_last( &mut self, req_id: i32, tick_type: TickByTickType, time: i64, price: f64, size: i32, tick_attrib_last: TickAttribLast, exchange: &str, special_conditions: &str, )

returns tick-by-tick data for tickType = “Last” or “AllLast”
Source§

fn tick_by_tick_bid_ask( &mut self, req_id: i32, time: i64, bid_price: f64, ask_price: f64, bid_size: i32, ask_size: i32, tick_attrib_bid_ask: TickAttribBidAsk, )

returns tick-by-tick data for TickAttribBidAsk
Source§

fn tick_by_tick_mid_point(&mut self, req_id: i32, time: i64, mid_point: f64)

returns tick-by-tick data for tickType = “MidPoint”
Source§

fn order_bound(&mut self, req_id: i32, api_client_id: i32, api_order_id: i32)

returns order_bound notification
Source§

fn completed_order( &mut self, contract: Contract, order: Order, order_state: OrderState, )

This function is called to feed in completed orders. Read more
Source§

fn completed_orders_end(&mut self)

This is called at the end of a given request for completed orders.

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> 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, 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.