Skip to main content

Download IBKR Flex reports using the Interactive Brokers flex web service

Project description

PyFlexWeb

CLI for downloading IBKR Flex reports.

CI PyPI version

Install

uv tool install pyflexweb

Setup

  1. Create a Flex Query and generate a token in your IBKR Account Management portal.

  2. 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:

  1. Look up the account associated with the query
  2. Use that account's token
  3. 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

pyflexweb-0.4.0.tar.gz (39.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyflexweb-0.4.0-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file pyflexweb-0.4.0.tar.gz.

File metadata

  • Download URL: pyflexweb-0.4.0.tar.gz
  • Upload date:
  • Size: 39.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyflexweb-0.4.0.tar.gz
Algorithm Hash digest
SHA256 59f72286ef9027c2df7cd8081c047313a33f68f94e57bb4bbef21c7595fe0af8
MD5 c15cefa2a6437855ef3560f7cf96aa63
BLAKE2b-256 1b66a4e283920c902421b9063b94ca9768f0ad0f200661f3691dd8d401e6247c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyflexweb-0.4.0.tar.gz:

Publisher: publish.yml on Grynn/pyflexweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyflexweb-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pyflexweb-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyflexweb-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4165c09497873d3a51875be218ae8e312f3737a5fa806d3a6dd8987d433c0ed8
MD5 d74a4052dbf5f3ce420ef7eb2a8cc369
BLAKE2b-256 ee8708e35a093875bc7185725f3691d70e10c05e83b98e46985ed05b1e12ae0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyflexweb-0.4.0-py3-none-any.whl:

Publisher: publish.yml on Grynn/pyflexweb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page