ibapi 5.2.0

An unofficial Rust client for the Interactive Brokers TWS API. Async (Tokio) and blocking clients for TWS and IB Gateway.
Documentation
//! Completed Orders example
//!
//! # Usage
//!
//! ```bash
//! cargo run --no-default-features --features sync --example completed_orders
//! ```

use ibapi::client::blocking::Client;

// This example demonstrates how to request completed orders.

fn main() {
    env_logger::init();

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

    let subscription = client.completed_orders(false).expect("get completed orders failed");
    for order in subscription.iter_data() {
        match order {
            Ok(order) => println!("{order:?}"),
            Err(e) => {
                eprintln!("error: {e:?}");
                break;
            }
        }
    }
}