Skip to content

6.0: one set of tick types for tick_by_tick and historical_ticks - #1244

Open
tradatious wants to merge 1 commit into
wboayue:mainfrom
tradatious:api_b_tick-types
Open

tradatious wants to merge 1 commit into
wboayue:mainfrom
tradatious:api_b_tick-types

Conversation

@tradatious

@tradatious tradatious commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

A tick-by-tick frame carries the same proto messages as a historical ticks reply (HistoricalTickLast, HistoricalTickBidAsk, HistoricalTick), but the crate decoded them into two unrelated struct families with different names and field names. Both requests now yield TickLast, TickBidAsk and TickMidpoint, defined once in market_data (new ticks.rs, re-exported from realtime and historical) and decoded by one converter per proto message in market_data/common/decoders.rs. realtime::{Trade, BidAsk, MidPoint, TradeAttribute, BidAskAttribute} are removed; field names follow the proto; HistoricalTicksBuilder::trade() becomes last(), the name TickByTickBuilder uses.

Sizes follow the always-sent finding in #1240: trade and bid/ask sizes are f64 on both paths, so historical sizes move from Option<f64> (#718) to f64. A BTC/PAXOS tick-by-tick run and an AAPL historical-ticks run (paper Gateway, server 226) found every trade and bid/ask tick carrying its sizes; recorded in docs/wire-facts/market-data.md. Keeping Option across the family instead would be a small change if you prefer it. TickMidpoint::size stays Option<f64>: live midpoint frames carried no size, and historical ones carried 0.

Those runs and a historical bid_ask(IgnoreSize::Yes) run contradict the IgnoreSize::Yes rustdoc ("Tick sizes are omitted from the response"): on both tick-by-tick (BTC) and historical (AAPL) bid/ask ticks, Yes still sent both sizes on every update and left out the updates that changed only a size. The IgnoreSize and bid_ask terminal docs now say that.

The parse_decimal_or_zero rustdoc's list of Option fields now names TickMidpoint::size rather than the historical tick sizes.

The market-data test builders keep Option size fields although TickLast::size and TickBidAsk::size_bid / size_ask are f64: they model whether the frame carries the field, which the absent-size test cases need.

Migration §39.

Testing

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo clippy --all-targets --no-default-features --features sync -- -D warnings
  • cargo clippy --all-targets --all-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps (default, sync-only and all-features)
  • cargo test (default, sync-only and all-features)
  • cargo build --examples (default, sync-only and all-features)
  • cargo build -p ibapi-integration-sync --tests and -p ibapi-integration-async --tests
  • cargo clippy -p ibapi-integration-sync --tests -- -D warnings and -p ibapi-integration-async
  • tools/check-rules-graph.sh

Breaking changes

Yes. Rename the types, fields and trade() as in the migration table; historical trade and bid/ask sizes are f64; serialized keys change. Migration §39.

@tradatious
tradatious force-pushed the api_b_tick-types branch 3 times, most recently from 11e12bf to fef37a1 Compare November 16, 2026 05:08
@tradatious

Copy link
Copy Markdown
Contributor Author

Pushed an update: historical decoder tests for absent, sentinel and malformed sizes, trade and bid/ask test builders that send a size by default, and a historical bid_ask(IgnoreSize::Yes) probe (AAPL, paper, server 226): both sizes on every tick, and only updates that change a price, so the IgnoreSize docs now cover both paths.

Two questions on the shape:

  • TickMidpoint::size carries no information in what was probed: live midpoint frames never send it (None), and historical midpoint ticks always send 0. It could be dropped, which breaks the 5.x historical field, or kept with that said in its rustdoc. I kept it; happy to drop it.
  • HistoricalTicksBuilder::trade() becomes last() to match TickByTickBuilder::last() and the TickLast type it yields. The unification does not need the rename, so I can restore trade() if you'd rather not break it.

tick_by_tick and historical_ticks both yield market_data::TickLast,
TickBidAsk and TickMidpoint, with proto field names; realtime::{Trade,
BidAsk, MidPoint, TradeAttribute, BidAskAttribute} are removed,
HistoricalTicksBuilder::trade() becomes last(), and historical trade and
bid/ask sizes become f64. The two families decoded the same proto
messages. Corrects the IgnoreSize rustdoc. Updates examples, integration
tests, the parse_decimal_or_zero rustdoc, CHANGELOG, the 6.0 migration
guide, the market-data wire facts and the domain-module-layout rule node.

Migration §39.
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.

1 participant