Skip to content

Commit

Permalink
fix regression (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
wboayue authored Dec 26, 2024
1 parent bbe2652 commit 5a78abd
Show file tree
Hide file tree
Showing 2 changed files with 11 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.9"
version = "1.0.10"
edition = "2021"
authors = ["Wil Boayue <wil@wsbsolutions.com>"]
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
12 changes: 10 additions & 2 deletions src/market_data/realtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use time::OffsetDateTime;
use crate::client::{DataStream, ResponseContext, Subscription};
use crate::contracts::tick_types::TickType;
use crate::contracts::{Contract, OptionComputation};
use crate::messages::{IncomingMessages, Notice, OutgoingMessages, RequestMessage, ResponseMessage};
use crate::messages::{self, IncomingMessages, Notice, OutgoingMessages, RequestMessage, ResponseMessage};
use crate::orders::TagValue;
use crate::server_versions;
use crate::ToField;
Expand Down Expand Up @@ -205,6 +205,7 @@ impl ToField for WhatToShow {
pub enum MarketDepths {
MarketDepth(MarketDepth),
MarketDepthL2(MarketDepthL2),
Notice(Notice),
}

#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
Expand Down Expand Up @@ -251,7 +252,14 @@ impl DataStream<MarketDepths> for MarketDepths {
client.server_version,
message,
)?)),
IncomingMessages::Error => Err(Error::from(message.clone())),
IncomingMessages::Error => {
let code = message.peek_int(messages::CODE_INDEX).unwrap();
if code >= 2100 && code < 2200 {
Ok(MarketDepths::Notice(Notice::from(message)))
} else {
Err(Error::from(message.clone()))
}
}
_ => Err(Error::UnexpectedResponse(message.clone())),
}
}
Expand Down

0 comments on commit 5a78abd

Please sign in to comment.