Repository navigation
v3.2.0
What's New
Data-farm connectivity sub-states (#684)
New ConnectivityStatus enum plus Notice::connectivity_status() / ConnectivityStatus::from_code() expose the farm-level connectivity granularity (Ok / Broken / Inactive / Connecting) hidden inside the 2100–2169 warning band, so reconnect and health logic can tell "farm came back online" from "farm went inactive" without re-parsing codes.
use ibapi::{Notice, ConnectivityStatus};
// Branch on a data-farm notice's sub-state:
if notice.connectivity_status() == Some(ConnectivityStatus::Broken) {
// a data-farm link went down — pause dependent work
}
// Or classify a raw wire code directly:
assert_eq!(ConnectivityStatus::from_code(2104), Some(ConnectivityStatus::Ok));
assert_eq!(ConnectivityStatus::from_code(2105), Some(ConnectivityStatus::Broken));Snapshot terminals: collect_for, collect_until, snapshot_once (#686)
Subscription::collect_for(timeout) / collect_until(timeout, predicate) and MarketDataBuilder::snapshot_once(timeout) collect a one-shot snapshot into a Vec without hand-writing a collect-with-timeout loop.
use std::time::Duration;
// Collect everything a subscription yields within a fixed window:
let bars = subscription.collect_for(Duration::from_secs(5));
// Or take a single market-data snapshot in one call:
let snapshot = client
.market_data(&contract)
.snapshot_once(Duration::from_secs(2))?;Error::is_connection_lost() predicate (#690)
Reconnect loops can now branch on connection loss without matching internal Error variants.
match client.next_valid_order_id() {
Ok(id) => use_id(id),
Err(e) if e.is_connection_lost() => reconnect_and_retry(),
Err(e) => return Err(e),
}AggTrades WhatToShow variant (#693)
Adds the AggTrades variant (wire value AGGTRADES) to the historical and realtime WhatToShow enums, required to request trade bars for crypto contracts — TWS rejects TRADES for crypto with error 10299. Thanks to @bebop23 for the contribution.
use ibapi::market_data::historical::WhatToShow;
// Aggregated trade bars — the crypto-compatible alternative to WhatToShow::Trades.
let what_to_show = WhatToShow::AggTrades;Bug Fixes
Connectivity-restored notices no longer log at ERROR (#695)
Code 1102 ("connectivity restored — data maintained") now logs at info and code 1101 ("restored — data lost, resubscribe") at warn, instead of both landing at error. Routine overnight reconnect cycles no longer trip error-level alerting. Thanks to @thimo-seidel for the report.
# Before: every overnight reconnect logged at ERROR
ERROR ibapi::transport::common: error: [1102] Connectivity ... has been restored - data maintained.
# After:
INFO ibapi::transport::common: connectivity: [1102] Connectivity ... has been restored - data maintained.
Async snapshot market-data no longer sends a redundant cancel (#686)
Async snapshot subscriptions stopped emitting a redundant cancel after the snapshot completes, matching the sync client's behavior.
use std::time::Duration;
// Completes cleanly without a trailing cancel on the async client.
let snapshot = client
.market_data(&contract)
.snapshot_once(Duration::from_secs(2))
.await?;