IBFlex: Import Flex Queries via HTTP API#5352
Open
lmb wants to merge 2 commits intoportfolio-performance:masterfrom
Open
IBFlex: Import Flex Queries via HTTP API#5352lmb wants to merge 2 commits intoportfolio-performance:masterfrom
lmb wants to merge 2 commits intoportfolio-performance:masterfrom
Conversation
IBKR allows retrieving preconfigured Flex Queries via a rudimentary HTTP interface. Doing so requires a query ID which identifies the Flex Query, and a secret token. The secret token can be obtained from the web interface an expires after a while. Add a new menu item which allows importing from such a Flex Web Service. This saves users from logging in, manually selecting the query, executing it, etc. Credentials like query ID and the secret token are stored in the .portfolio file. This means that copying the file elsewhere will retain that information. The user is warned about this on the settings screen.
The Flex Web Service always runs a Flex Query with a fixed date range configured when creating the query. This means that we can't choose what date range to fetch. The easiest thing for the user is to configure the query with the maximum duration (currently 365 days). The downside of this is that it populates the import wizard with a lot of duplicate items after the first import. Filter extracted items to exclude ones we've likely already imported based on the transaction date. The user can clear the date we're using for this via the settings dialog.
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.
This is an implementation of the Flex Web Service API to automatically fetch Flex Queries. Please see the individual commit descriptions for details.
Disclosure: I used Claude Code to draft this PR and have done manual code review on it. I think the code is OK, maybe a bit verbose. Please let me know if I've missed something or if I can somehow remove some code.
Fixes: #5246