Repository navigation
Conversation
TWS rejects any end date on a CONTFUT historical bars request (error 10339), and between() always sent one, so every such request failed. For a continuous future, between() now sends no end date and a duration covering [start, now), and the existing trim drops the bars after end. A start that is not before now is InvalidArgument. Verified live on paper TWS (server 223): ES CONTFUT 1-hour bars between 2026-11-12 14:00 and 2026-11-13 21:00 UTC returned 15 bars, where the request had failed with 10339.
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.
Why
TWS rejects any end date on a historical bars request for a continuous future with error 10339 ("Setting end date/time for continuous future security type is not allowed").
between(start, end)always resolves to an end date plus a covering duration, so it could never be used for aCONTFUTcontract; callers had to compute a duration themselves and trim the bars.What
SecurityType::ContinuousFuture,between(start, end)sends no end date and a duration covering[start, now). The existing trim to[start, end)drops the bars afterend, so the result is the same as for any other contract.startthat is not before now isError::InvalidArgument, with nothing sent.ending()andbetween()rustdoc say what TWS does for a continuous future.Verified
CONTFUT1-hour TRADES bars: a duration with no end date returns 16 bars (2026-11-12 14:30 to 2026-11-13 21:00 UTC), the same with an end date returns 10339, andbetween(2026-11-12 14:00, 2026-11-13 21:00)on this branch returns 15 bars (the 21:00 bar is pastend).startis not before now, and the sync and async request wiring (no end date,11 Dfor a start 10 days less an hour back).cargo fmt; clippy, rustdoc, and examples on the default, sync-only, and all-features legs;cargo teston all three legs;tools/check-rules-graph.sh. The sync-only test leg failed once without a reported test and passed on rerun.