Skip to content

Add AggTrades (AGGTRADES) variant to WhatToShow enums#693

Open
bebop23 wants to merge 1 commit into
wboayue:mainfrom
bebop23:feat/aggtrades-whattoshow
Open

Add AggTrades (AGGTRADES) variant to WhatToShow enums#693
bebop23 wants to merge 1 commit into
wboayue:mainfrom
bebop23:feat/aggtrades-whattoshow

Conversation

@bebop23

@bebop23 bebop23 commented Jul 5, 2026

Copy link
Copy Markdown

Add AggTrades (AGGTRADES) variant to WhatToShow enums

Summary

Adds an AggTrades variant to both market_data::historical::WhatToShow and
market_data::realtime::WhatToShow, serialized on the wire as AGGTRADES.

IB requires AGGTRADES (not TRADES) for crypto contracts: TWS rejects
whatToShow=TRADES for crypto with error 10299 on both reqHistoricalData
and reqRealTimeBars. There was previously no way to express this through the
typed WhatToShow enums (and no raw-string escape hatch), so crypto bar
requests could not be made through the crate.

Changes

  • historical::WhatToShow: new AggTrades variant + Display ("AGGTRADES")
    • FromStr mapping.
  • realtime::WhatToShow: new AggTrades variant + Display ("AGGTRADES").
  • Extended the existing WhatToShow unit tests (to_string / from_string
    round-trips) to cover AGGTRADES.

Purely additive — no existing variant, wire value, or behavior changes.

Verification

Cross-checked against a direct TWS-API reqRealTimeBars call with
secType=CRYPTO, exchange=ZEROHASH, whatToShow=AGGTRADES on an IB paper gateway:
bars flow (including zero-volume bars), whereas TRADES returns error 10299.
cargo test --lib what_to_show passes (historical to_string/from_string +
realtime display, all including the new AGGTRADES cases).

Downstream context

This unblocks crypto market data in the nautilus_trader Interactive Brokers
adapter, which currently has no way to request AGGTRADES through the typed
enums: nautechsystems/nautilus_trader#4389. That adapter pins ibapi 3.0.1, so
this change applies cleanly to the v3.0.1 line as well as main (the two
edited files are identical between them).

Adds an AggTrades variant to both the historical and realtime WhatToShow
enums, serialized on the wire as AGGTRADES.

IB requires AGGTRADES (not TRADES) for crypto contracts: TWS rejects
whatToShow=TRADES for crypto with error 10299 on both reqHistoricalData and
reqRealTimeBars. There was previously no way to express this via the typed
enums. Includes Display + FromStr (historical) and Display (realtime) plus
unit-test coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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