ibapi 1.2.2

A Rust implementation of the Interactive Brokers TWS API, providing a reliable and user friendly interface for TWS and IB Gateway. Designed with a focus on simplicity and performance.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::env;

use ibapi::Client;

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

    let account = env::var("IBKR_ACCOUNT").expect("Please set IBKR_ACCOUNT environment variable to an account ID");

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

    let subscription = client.positions_multi(Some(&account), None).expect("error requesting positions by model");
    for position in subscription.iter() {
        println!("{position:?}")
    }
}