Add period / fd / td date-range overrides to download()#111
Merged
csingley merged 1 commit intoJun 11, 2026
Merged
Conversation
IBKR's v3 Flex Web Service can resolve a query's saved "Last N Calendar Days" period to a single day when SendRequest carries only v/t/q, silently returning a statement with no cash transactions or trades. The documented `p` (period) and `fd`/`td` (from/to date) SendRequest overrides address this, but the client had no way to pass them. Add optional `period` (`p`, lookback in days, max 365) and `fd`/`td` (`yyyymmdd`) kwargs to download() / request_statement / submit_request, applied only to the SendRequest step (not the GetStatement polls). `period` and `fd`/`td` are mutually exclusive, and `fd`/`td` must be given together; invalid combinations raise ValueError, surfaced as a clean argparse error in the flexget CLI. Matching --period/--fromdate/--todate flags added to flexget. Default behavior is unchanged. Addresses csingley#109.
Owner
|
LGTM |
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.
Addresses #109.
IBKR's v3 Flex Web Service may resolve a query's saved "Last N Calendar Days" period to a single day when
SendRequestcarries onlyv/t/q, silently returning a statement with noCashTransactionsorTrades(positions still come back, so it fails quietly). The documentedp(period) andfd/td(from/to date) SendRequest overrides fix this, butibflexhad no way to pass them.Changes
download()/request_statement()/submit_request()gain optionalperiod(p, lookback in days, max 365) andfd/td(yyyymmdd) kwargs, applied only to the SendRequest step — not the GetStatement polls.periodandfd/tdare mutually exclusive, andfd/tdmust be supplied together; invalid combinations raiseValueError. (Empirically, IBKR silently ignorespwhenfd/tdare also present, so the guard prevents a confusing no-op.)flexgetgains--period/-p,--fromdate/--fd,--todate/--td; invalid combinations surface as a clean argparse error (exit 2) rather than a traceback.Tests
New tests cover
pon SendRequest only,fd/td, the mutual-exclusion and pairing guards, and the no-override case.ruff/mypy/pytestall pass.Verified live against a v3 account: a query that returned a 1-day window via
download()returns the full window viadownload(..., period=90).