Skip to main content

WshEventFilterBuilder

Struct WshEventFilterBuilder 

Source
pub struct WshEventFilterBuilder<'a, C> { /* private fields */ }
Expand description

Builder for Wall Street Horizon events matching a JSON filter.

Implementations§

Source§

impl<'a, C> WshEventFilterBuilder<'a, C>

Source

pub fn limit(self, limit: i32) -> Self

Cap the number of events returned. TWS allows at most 100.

Requires server_versions::WSH_EVENT_DATA_FILTERS_DATE.

Source

pub fn auto_fill(self, auto_fill: AutoFill) -> Self

Ask TWS to fill event data for related contracts. See AutoFill.

Source§

impl<'a> WshEventFilterBuilder<'a, Client>

Source

pub fn subscribe(self) -> Result<Subscription<WshEventData>, Error>

Submit the request and return a subscription of matching events.

§Examples
use ibapi::client::blocking::Client;

let client = Client::connect("127.0.0.1:4002", 100).expect("connection failed");

// See https://www.interactivebrokers.com/campus/ibkr-api-page/twsapi-doc/#wsheventdata-object
let subscription = client.wsh_event_data_by_filter("{}").limit(10).subscribe().expect("request failed");

for event in subscription.iter_data() {
    println!("{:?}", event.expect("decode error"));
}
Source§

impl<'a> WshEventFilterBuilder<'a, Client>

Source

pub async fn subscribe(self) -> Result<Subscription<WshEventData>, Error>

Submit the request and return a subscription of matching events.

§Examples
use ibapi::Client;
use ibapi::subscriptions::r#async::SubscriptionItemStreamExt;
use futures::StreamExt;

#[tokio::main]
async fn main() {
    let client = Client::connect("127.0.0.1:4002", 100).await.expect("connection failed");

    // See https://www.interactivebrokers.com/campus/ibkr-api-page/twsapi-doc/#wsheventdata-object
    let mut subscription = client.wsh_event_data_by_filter("{}").limit(10).subscribe().await.expect("request failed");

    let mut events = subscription.filter_data();
    while let Some(event) = events.next().await {
        println!("{:?}", event.expect("decode error"));
    }
}

Auto Trait Implementations§

§

impl<'a, C> Freeze for WshEventFilterBuilder<'a, C>
where &'a C: Freeze,

§

impl<'a, C> RefUnwindSafe for WshEventFilterBuilder<'a, C>

§

impl<'a, C> Send for WshEventFilterBuilder<'a, C>
where &'a C: Send,

§

impl<'a, C> Sync for WshEventFilterBuilder<'a, C>
where &'a C: Sync,

§

impl<'a, C> Unpin for WshEventFilterBuilder<'a, C>
where &'a C: Unpin,

§

impl<'a, C> UnsafeUnpin for WshEventFilterBuilder<'a, C>

§

impl<'a, C> UnwindSafe for WshEventFilterBuilder<'a, C>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.