ibapi 5.4.0

An unofficial Rust client for the Interactive Brokers TWS API: market data, orders, and account data, with async (Tokio) and blocking clients for TWS and IB Gateway.
Documentation
pub(super) mod decoders;
pub(super) mod encoders;
pub(crate) mod tick;

use time::OffsetDateTime;

use crate::market_data::historical::WhatToShow;
use crate::Error;

/// Validate preconditions for historical_data requests.
pub(crate) fn validate_historical_data(end_date: Option<OffsetDateTime>, what_to_show: WhatToShow) -> Result<(), Error> {
    if end_date.is_some() && what_to_show == WhatToShow::AdjustedLast {
        return Err(Error::InvalidArgument(
            "end_date must be None when requesting WhatToShow::AdjustedLast.".into(),
        ));
    }

    Ok(())
}