You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the MPE below, when calling subscription.cancel() TWS returns "4\02\09000\0300\0Can't find EId with tickerId:9000\0". This is true if cancel is called directly or if the subscription is passed to drop.
use std::time::Duration;use std::thread::sleep;use ibapi::Client;fnmain(){
env_logger::init();let connection_url = "127.0.0.1:4001";let client = Client::connect(connection_url,105).expect("connection to TWS failed!");println!("Successfully connected to TWS at {connection_url}");let contract = ibapi::contracts::Contract::stock("TSLA");let subscription = client.market_depth(&contract,5,true).expect("error requesting market depth");ifletSome(row) = subscription.try_next(){println!("row: {row:?}");}println!("sleeping...");sleep(Duration::from_secs(5));ifletSome(error) = subscription.error(){println!("error: {:?}", error);}
subscription.cancel();sleep(Duration::from_secs(1));}
I'm not sure where things are going wrong and the IBKR docs on this are sparse to say the least.
The text was updated successfully, but these errors were encountered:
Figured it out. The impl for MarketDepths calls encoders::encode_cancel_tick_by_tick(request_id). This sends the message ID 98 which is wrong. Changing this to a new method cancel_market_depth(request_id) with the provided implementation works. This isn't a perfect solution since I'm hard coding the final 1 -- I believe this is to denote that I'm requesting a "smart" market depth.
I validated the expected message by using the python ib_sync library. I don't have access to the TWS api repo so I'm guessing on the message structure.
Using the MPE below, when calling
subscription.cancel()
TWS returns"4\02\09000\0300\0Can't find EId with tickerId:9000\0"
. This is true ifcancel
is called directly or if the subscription is passed todrop
.I'm not sure where things are going wrong and the IBKR docs on this are sparse to say the least.
The text was updated successfully, but these errors were encountered: