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.1.tar.gz (39.8 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.1-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

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

Hashes for pyflexweb-0.4.1.tar.gz
Algorithm Hash digest
SHA256 a11716a908fe147b395e0557e6da7d8f0a7a0efa8380d750b56f0896cd288928
MD5 6cc0adf2623a8ea8e5126ba0629eb02d
BLAKE2b-256 b3c1adeaf6c1f16897391855f72acae8f27c855e3227ea82776fd6751308e3b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyflexweb-0.4.1.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.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

Hashes for pyflexweb-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ee5becdba9d17b9d6108195bc3e681978cbded367da2769399015de96bc5e7b
MD5 1f606d1967eb25406281560f39a230c6
BLAKE2b-256 d6e1e5fe3af0a8a5b5b8276b8ac98c0af358d0c624e12bba2ba325a128e71019

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyflexweb-0.4.1-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