Skip to main content

WshEventDataBuilder

Struct WshEventDataBuilder 

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

Builder for Wall Street Horizon events on one contract.

Implementations§

Source§

impl<'a, C> WshEventDataBuilder<'a, C>

Source

pub fn starting(self, start_date: Date) -> Self

Return events on or after start_date.

Requires server_versions::WSH_EVENT_DATA_FILTERS_DATE.

Source

pub fn ending(self, end_date: Date) -> Self

Return events on or before end_date.

Requires server_versions::WSH_EVENT_DATA_FILTERS_DATE.

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.

Requires server_versions::WSH_EVENT_DATA_FILTERS.

Source§

impl<'a> WshEventDataBuilder<'a, Client>

Source

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

Submit the request and return the WshEventData.

§Examples
use ibapi::client::blocking::Client;
use time::macros::date;

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

// Everything WSH has for the contract:
let events = client.wsh_event_data_by_contract(76792991).fetch().expect("request failed");
println!("{events:?}");

// Narrowed to a date range:
let events = client
    .wsh_event_data_by_contract(76792991)
    .starting(date!(2024 - 01 - 01))
    .ending(date!(2024 - 03 - 31))
    .limit(50)
    .fetch()
    .expect("request failed");
println!("{events:?}");
Source§

impl<'a> WshEventDataBuilder<'a, Client>

Source

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

Submit the request and return the WshEventData.

§Examples
use ibapi::Client;
use time::macros::date;

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

    // Everything WSH has for the contract:
    let events = client.wsh_event_data_by_contract(76792991).fetch().await.expect("request failed");
    println!("{events:?}");

    // Narrowed to a date range:
    let events = client
        .wsh_event_data_by_contract(76792991)
        .starting(date!(2024 - 01 - 01))
        .ending(date!(2024 - 03 - 31))
        .limit(50)
        .fetch()
        .await
        .expect("request failed");
    println!("{events:?}");
}

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'a, C> UnwindSafe for WshEventDataBuilder<'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.