Skip to content

Using the test code places order with 200 BMW shares #36

Description

@yssoe

Thank you for your work,

I just simply imported your crate and used this demo code you provided:

It placed an order of 200 shares of BMW, now I know you like the cars but I can't find in this code where this is the case, I am running TWS version Build 10.17 why is this sending orders out of the blue? When just running the below? Thanks!

use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
use twsapi::core::client::EClient;
use twsapi::core::errors::IBKRApiLibError;
use twsapi::core::streamer::{Streamer, TcpStreamer};
use twsapi::examples::test_helpers::TestWrapper;

fn main() -> Result<(), IBKRApiLibError> {
    let wrapper = Arc::new(Mutex::new(TestWrapper::<TcpStreamer>::new()));
    let app = Arc::new(Mutex::new(EClient::new(wrapper.clone())));

    println!("getting connection...");

    wrapper.lock().expect("Wrapper mutex was poisoned").client = Option::from(app.clone());

    //use port 7497 for TWS or 4002 for IB Gateway, depending on the port you have set
    app.lock()
        .expect("EClient mutex was poisoned")
        .connect("127.0.0.1", 7496, 0)?;

    //4002
    thread::sleep(Duration::new(18600, 0));

    Ok(())
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions