From 5df4b8c356f2a41ab1ab039afb0b96f0b9c4b332 Mon Sep 17 00:00:00 2001 From: Wilfred Boayue Date: Tue, 10 Dec 2024 12:01:53 -0800 Subject: [PATCH] next order id from server --- Cargo.toml | 2 +- src/client.rs | 2 +- src/transport.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0d784136..7f9c48be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ibapi" -version = "1.0.4" +version = "1.0.5" edition = "2021" authors = ["Wil Boayue "] description = "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." diff --git a/src/client.rs b/src/client.rs index ae79e88b..c1645c60 100644 --- a/src/client.rs +++ b/src/client.rs @@ -83,7 +83,7 @@ impl Client { message_bus, client_id: connection_metadata.client_id, next_request_id: AtomicI32::new(9000), - order_id: AtomicI32::new(1000), + order_id: AtomicI32::new(connection_metadata.next_order_id), }; Ok(client) diff --git a/src/transport.rs b/src/transport.rs index 2dacf19b..6adcd6ed 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -780,7 +780,7 @@ impl SubscriptionBuilder { #[derive(Default, Clone, Debug)] pub(crate) struct ConnectionMetadata { - next_order_id: i32, + pub(crate) next_order_id: i32, pub(crate) client_id: i32, pub(crate) server_version: i32, pub(crate) managed_accounts: String,