Skip to content

Commit

Permalink
labeled release. added validation (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
wboayue authored Nov 16, 2024
1 parent 8dc6fd6 commit ce1680e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 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.2"
version = "1.0.3"
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
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,7 @@ The [Client documentation](https://docs.rs/ibapi/latest/ibapi/struct.Client.html

## Install

Run the following Cargo command in your project directory:

```bash
cargo add ibapi
```

Or add the following line to your `Cargo.toml`:

```toml
ibapi = "1.0.0"
```
> **Note**: Check [crates.io/crates/ibapi](https://crates.io/crates/ibapi) for the latest available version.
Check [crates.io/crates/ibapi](https://crates.io/crates/ibapi) for the latest available version and installation instructions.

## Examples

Expand Down Expand Up @@ -245,7 +234,7 @@ fn main() {
});
handles.push(handle);
}

handles.into_iter().for_each(|handle| handle.join().unwrap());
}
```
Expand Down
2 changes: 2 additions & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub enum Error {
Parse(usize, String, String),
ServerVersion(i32, i32, String),
Simple(String),
InvalidArgument(String),
ConnectionFailed,
ConnectionReset,
Cancelled,
Expand Down Expand Up @@ -49,6 +50,7 @@ impl std::fmt::Display for Error {
Error::UnexpectedEndOfStream => write!(f, "UnexpectedEndOfStream"),

Error::Simple(ref err) => write!(f, "error occurred: {err}"),
Error::InvalidArgument(ref err) => write!(f, "InvalidArgument: {err}"),
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/market_data/historical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ pub(crate) fn historical_data(
)?;
}

if end_date.is_some() && what_to_show == Some(WhatToShow::AdjustedLast) {
return Err(Error::InvalidArgument("end_date must be None when requesting WhatToShow::AdjustedLast. You might have called Client::historical_data with WhatToShow::AdjustedLast".into()));
}

loop {
let request_id = client.next_request_id();
let request = encoders::encode_request_historical_data(
Expand Down

0 comments on commit ce1680e

Please sign in to comment.