Add AggTrades (AGGTRADES) variant to WhatToShow enums#693
Open
bebop23 wants to merge 1 commit into
Open
Conversation
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>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
AggTrades(AGGTRADES) variant toWhatToShowenumsSummary
Adds an
AggTradesvariant to bothmarket_data::historical::WhatToShowandmarket_data::realtime::WhatToShow, serialized on the wire asAGGTRADES.IB requires
AGGTRADES(notTRADES) for crypto contracts: TWS rejectswhatToShow=TRADESfor crypto with error 10299 on bothreqHistoricalDataand
reqRealTimeBars. There was previously no way to express this through thetyped
WhatToShowenums (and no raw-string escape hatch), so crypto barrequests could not be made through the crate.
Changes
historical::WhatToShow: newAggTradesvariant +Display("AGGTRADES")FromStrmapping.realtime::WhatToShow: newAggTradesvariant +Display("AGGTRADES").WhatToShowunit tests (to_string/from_stringround-trips) to cover
AGGTRADES.Purely additive — no existing variant, wire value, or behavior changes.
Verification
Cross-checked against a direct TWS-API
reqRealTimeBarscall withsecType=CRYPTO, exchange=ZEROHASH, whatToShow=AGGTRADESon an IB paper gateway:bars flow (including zero-volume bars), whereas
TRADESreturns error 10299.cargo test --lib what_to_showpasses (historicalto_string/from_string+realtime
display, all including the newAGGTRADEScases).Downstream context
This unblocks crypto market data in the
nautilus_traderInteractive Brokersadapter, which currently has no way to request
AGGTRADESthrough the typedenums: nautechsystems/nautilus_trader#4389. That adapter pins ibapi
3.0.1, sothis change applies cleanly to the
v3.0.1line as well asmain(the twoedited files are identical between them).