Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yssoe opened this issue Sep 1, 2022 · 2 comments
Open

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

yssoe opened this issue Sep 1, 2022 · 2 comments

Comments

@yssoe
Copy link

yssoe commented Sep 1, 2022

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(())
}
@sparkstartconsulting
Copy link
Owner

sparkstartconsulting commented Sep 1, 2022 via email

@yssoe
Copy link
Author

yssoe commented Sep 1, 2022

No of course it was on paper account login, but please remove that test case from just importing your crate and runnig your sample code, this doesn't make any sense at all. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants