Download IBKR Flex reports using the Interactive Brokers flex web service
Project description
PyFlexWeb
CLI for downloading IBKR Flex reports.
Install
uv tool install pyflexweb
Setup
-
Create a Flex Query and generate a token in your IBKR Account Management portal.
-
Store your token and add queries:
pyflexweb token set YOUR_TOKEN
# Add an activity query (default type, 6h download interval)
pyflexweb query add 123456 --name "Daily activity"
# Add a trade confirmation query (1h download interval)
pyflexweb query add 789012 --name "Trade confirmations" --type trade-confirmation
Multi-Account Support
If you have multiple IBKR accounts, each with its own Flex token, you can configure per-account tokens and associate queries with specific accounts:
# Add accounts
pyflexweb account add U1317359 --name "Cerabella" --token YOUR_TOKEN_1
pyflexweb account add U11049821 --name "CCUK" --token YOUR_TOKEN_2
# List configured accounts
pyflexweb account list
# Add queries tied to specific accounts
pyflexweb query add 111111 --name "Cerabella Activity" --account U1317359
pyflexweb query add 222222 --name "CCUK Activity" --account U11049821
# Rename or remove accounts
pyflexweb account rename U1317359 "Main Account"
pyflexweb account remove U11049821
Token Resolution
When downloading, pyflexweb resolves the token for each query:
- Look up the account associated with the query
- Use that account's token
- If the account has no token configured, the query is skipped with a clear error
Every query must be associated with an account (--account is required when adding queries).
Legacy global tokens are automatically migrated to a placeholder account on first run.
Usage
# Download all queries that are due
pyflexweb download
# Download a specific query
pyflexweb download --query 123456
# Force download regardless of interval
pyflexweb download --force
# Check status of all queries
pyflexweb status
Commands
token set|get|unset Manage IBKR token (global fallback)
account add <id> --token T Add account (--name optional)
account list List configured accounts
account remove|rename <id> Remove or rename an account
query add <id> --name "..." Add query (--type, --min-interval, --account)
query remove|rename <id> Remove or rename a query
query interval <id> [hours] Set per-query download interval (--unset to revert)
query list [--json] List queries with status
download Download reports (--query ID, --force, --output, --output-dir)
status Alias for query list
config set|get|unset|list Manage defaults (output_dir, poll_interval, max_attempts)
Query Types
| Type | Default Interval |
|---|---|
activity |
6 hours |
trade-confirmation |
1 hour |
Per-query overrides: pyflexweb query interval 123456 12 (set to 12h)
Publishing
make version bumps the patch version, commits, tags, and pushes. GitHub Actions publishes to PyPI on any v* tag.
License
GPL-3.0-or-later
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyflexweb-0.4.1.tar.gz.
File metadata
- Download URL: pyflexweb-0.4.1.tar.gz
- Upload date:
- Size: 39.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a11716a908fe147b395e0557e6da7d8f0a7a0efa8380d750b56f0896cd288928
|
|
| MD5 |
6cc0adf2623a8ea8e5126ba0629eb02d
|
|
| BLAKE2b-256 |
b3c1adeaf6c1f16897391855f72acae8f27c855e3227ea82776fd6751308e3b6
|
Provenance
The following attestation bundles were made for pyflexweb-0.4.1.tar.gz:
Publisher:
publish.yml on Grynn/pyflexweb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflexweb-0.4.1.tar.gz -
Subject digest:
a11716a908fe147b395e0557e6da7d8f0a7a0efa8380d750b56f0896cd288928 - Sigstore transparency entry: 1203306363
- Sigstore integration time:
-
Permalink:
Grynn/pyflexweb@b576a0a840cd2f9b574fe861123699fdbdd3a869 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/Grynn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b576a0a840cd2f9b574fe861123699fdbdd3a869 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyflexweb-0.4.1-py3-none-any.whl.
File metadata
- Download URL: pyflexweb-0.4.1-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ee5becdba9d17b9d6108195bc3e681978cbded367da2769399015de96bc5e7b
|
|
| MD5 |
1f606d1967eb25406281560f39a230c6
|
|
| BLAKE2b-256 |
d6e1e5fe3af0a8a5b5b8276b8ac98c0af358d0c624e12bba2ba325a128e71019
|
Provenance
The following attestation bundles were made for pyflexweb-0.4.1-py3-none-any.whl:
Publisher:
publish.yml on Grynn/pyflexweb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflexweb-0.4.1-py3-none-any.whl -
Subject digest:
6ee5becdba9d17b9d6108195bc3e681978cbded367da2769399015de96bc5e7b - Sigstore transparency entry: 1203306375
- Sigstore integration time:
-
Permalink:
Grynn/pyflexweb@b576a0a840cd2f9b574fe861123699fdbdd3a869 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/Grynn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b576a0a840cd2f9b574fe861123699fdbdd3a869 -
Trigger Event:
push
-
Statement type: