Skip to content

6.0: historical_news takes total_results: u16, not u8 - #1190

Merged
wboayue merged 3 commits into
wboayue:mainfrom
tradatious:api_b_news-total-results-u16
Nov 6, 2026
Merged

wboayue merged 3 commits into
wboayue:mainfrom
tradatious:api_b_news-total-results-u16

Conversation

@tradatious

@tradatious tradatious commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Client::historical_news (async and blocking) took total_results: u8, so a caller could request at most 255 headlines. IB documents the parameter as "int. The maximum number of headlines to fetch (1 – 300)" (interactivebrokers.com/docs/tws-api/doc/news/historical-news-headlines/requesting-historical-news), and the blocking method's rustdoc says the same. The parameter is now u16. No range check. A live probe (paper, server 226, 2026-11-05) settled the range: TWS returns at most 300 headlines for any larger value (301, 500, 1000, 65535), with no notice, and rejects 0 with error 321 "Total results must be > 0". The async and blocking rustdoc, migration §21 and docs/wire-facts/news.md record this. The encoder converts with i32::from, so the compiler checks that the widening is lossless.

Testing

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings (default, --no-default-features --features sync, --all-features)
  • cargo doc --no-deps with RUSTDOCFLAGS="-D warnings" (same three configurations)
  • cargo test (same three configurations)
  • cargo build --examples (same three configurations)
  • cargo build -p ibapi-integration-sync --tests, cargo build -p ibapi-integration-async --tests
  • cargo clippy -p ibapi-integration-sync --tests -- -D warnings, cargo clippy -p ibapi-integration-async --tests -- -D warnings

All pass on the change; after the rebase onto current main, cargo clippy --all-targets --all-features -- -D warnings and cargo test --all-features again.

Breaking changes

Yes. A caller passing a typed u8 for total_results must pass a u16 instead (n.into() converts a u8); integer literals and untyped let bindings compile unchanged. Migration §21.

`Client::historical_news` (async and blocking) takes `total_results:
u16`. Previously `u8` capped a request at 255, below the 300 that IB
documents as the maximum. CHANGELOG and migration guide.
@tradatious
tradatious force-pushed the api_b_news-total-results-u16 branch from 279a92e to 7e956fc Compare November 5, 2026 22:42
Async historical_news gets the sync Arguments block. Both note TWS caps
at 300 silently and rejects 0 with 321 (live 2026-11-05, server 226).
Wire fact in docs/wire-facts/news.md; migration §21 cites it.
# Conflicts:
#	CHANGELOG.md
#	docs/migration-6.0.md
@wboayue
wboayue merged commit 39b0391 into wboayue:main Nov 6, 2026
7 checks passed
@tradatious
tradatious deleted the api_b_news-total-results-u16 branch November 6, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants