Skip to content

Commit

Permalink
Fix completed orders regression (#195)
Browse files Browse the repository at this point in the history
Fix completed order message mapping
  • Loading branch information
wboayue authored Dec 15, 2024
1 parent b3fafa7 commit d6e12a1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ibapi"
version = "1.0.5"
version = "1.0.6"
edition = "2021"
authors = ["Wil Boayue <[email protected]>"]
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."
Expand Down
14 changes: 14 additions & 0 deletions examples/completed_orders.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use ibapi::Client;

// This example demonstrates how to request completed orders.

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

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

let subscription = client.completed_orders(false).expect("get completed orders failed");
for order in subscription {
println!("{:?}", order);
}
}
2 changes: 1 addition & 1 deletion examples/place_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn main() {

println!("connection_string: {connection_string}, stock_symbol: {stock_symbol}");

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

info!("Connected {client:?}");

Expand Down
2 changes: 1 addition & 1 deletion src/messages/shared_channel_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub(crate) const CHANNEL_MAPPINGS: &[ChannelMapping] = &[
},
ChannelMapping {
request: OutgoingMessages::RequestCompletedOrders,
responses: &[IncomingMessages::OpenOrder, IncomingMessages::OrderStatus, IncomingMessages::OpenOrderEnd],
responses: &[IncomingMessages::CompletedOrder, IncomingMessages::CompletedOrdersEnd],
},
ChannelMapping {
request: OutgoingMessages::RequestManagedAccounts,
Expand Down

0 comments on commit d6e12a1

Please sign in to comment.