ETF research and portfolio analytics terminal
Project description
etfray
A terminal-based ETF research and portfolio analytics application built with Textual.
etfray converts SEC fund filings and IBKR portfolio data into holdings, exposure, concentration, margin, and risk workflows — all from your terminal.
Why etfray?
- No cloud accounts — No sign-ups, no API keys to manage, no third-party dashboards. Your data stays on your machine.
- No subscriptions — ETF holdings data comes directly from SEC EDGAR filings. Free, authoritative, and always available.
- Offline-capable — All data is cached locally in SQLite. After the first fetch, everything works without a network connection.
- Keyboard-first — Designed for speed. Command palette, tree navigation, and keybindings — no mouse required.
Features
- ETF Research — Search ETFs, view holdings, sector/geographic exposure, concentration, fees, risk metrics, and SEC documents via EDGAR
- Portfolio Analytics — Connect to IBKR TWS/Gateway for live positions, lookthrough exposure, concentration analysis, and margin/leverage monitoring
- Side-by-side Compare — Compare multiple ETFs across holdings, exposure, and fees in a single view
- Export — Save any view to CSV or JSON for further analysis
- Keyboard-first — Full TUI with command palette, tree navigation, and keybindings
- Local & private — All data cached locally in SQLite; no cloud accounts required
Key Capabilities
| Capability | Details |
|---|---|
| ETF coverage | 10,000+ ETFs via SEC EDGAR N-PORT filings |
| Data sources | EDGAR (official), alternative web scraper, IBKR TWS |
| Holdings analysis | Full position-level breakdown with weight, value, shares |
| Exposure | Sector and geographic exposure from underlying holdings |
| Concentration | Top-N analysis (top 10, 25, 50) with cumulative weight |
| Portfolio | Real-time positions, lookthrough exposure, margin & leverage |
| Storage | Local SQLite — no cloud, no external databases |
| Freshness | Configurable staleness thresholds (default: 30 days fresh, 90 days acceptable) |
Usage Examples
Research an ETF
- Launch
etfrayand navigate to Research → Search in the sidebar - Press
ctrl+pto open the command palette, type a ticker (e.g.,VTI) - Browse tabs: Holdings → Exposure → Concentration → Risk
- Click the Export button to save the current view to CSV
Monitor your portfolio
- Ensure IBKR TWS/Gateway is running with API enabled on port 7497
- Navigate to Portfolio → Positions in the sidebar
- etfray connects lazily — positions load automatically on first access
- Switch to Lookthrough to see aggregated exposure across all your ETF holdings
- Check Margin for leverage ratio and margin cushion warnings
Architecture
graph LR
A[SEC EDGAR API] --> C[Data Services]
B[Web Scraper] --> C
D[IBKR TWS API] --> C
C --> E[(SQLite Cache)]
E --> F[Domain Analytics]
F --> G[Textual TUI]
Design principles:
- Local-first — All data cached in SQLite. Works offline after initial fetch.
- Source provenance — Every data point tracks its origin and fetch date so you know how fresh it is.
- Lazy connection — IBKR connects only when portfolio views are accessed, not at startup.
- Separation of concerns —
data/handles I/O,domain/handles computation,ui/handles presentation.
Configuration
All settings are managed via Workspace → Settings in the sidebar and stored in ~/.etfray/data.db.
| Setting | Default | Description |
|---|---|---|
ibkr_port |
7497 |
IBKR TWS/Gateway API port |
edgar_identity |
(empty) | Your email — required by SEC fair use policy |
data_source |
auto |
Holdings source: auto, edgar, or web |
freshness_days_fresh |
30 |
Days before cached data is considered stale |
margin_warning_cushion |
0.15 |
Margin cushion threshold for warnings |
See the full configuration reference for all options.
Installation
pip install etfray
Requires Python 3.11+.
Quick Start
etfray
Use the sidebar tree to navigate between Research and Portfolio workspaces. Press ctrl+p to open the command palette.
IBKR Connection
To use portfolio analytics, you need IBKR TWS or IB Gateway running with API connections enabled (default port 7497).
Configure the connection in Workspace → Settings in the sidebar.
Documentation
Full documentation at etfray.readthedocs.io:
Development
git clone https://github.com/alwank/etfray.git
cd etfray
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev,docs]"
pytest
License
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 etfray-0.1.0.tar.gz.
File metadata
- Download URL: etfray-0.1.0.tar.gz
- Upload date:
- Size: 129.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
037116b7c1f4f18337e71acd20d13e0d116de190b71a4d7e3e3a3d65c207065a
|
|
| MD5 |
7143392d8b9427ce1193ab33cab15f61
|
|
| BLAKE2b-256 |
1125d2c11163ad90c8285d7ff223ddd4e7af7e768d0c21caa7f5601712273047
|
Provenance
The following attestation bundles were made for etfray-0.1.0.tar.gz:
Publisher:
publish.yml on alwank/etfray
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
etfray-0.1.0.tar.gz -
Subject digest:
037116b7c1f4f18337e71acd20d13e0d116de190b71a4d7e3e3a3d65c207065a - Sigstore transparency entry: 1579688522
- Sigstore integration time:
-
Permalink:
alwank/etfray@0276418bbeb38d8c50f4c36489c6fbc9bb1a0d13 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alwank
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0276418bbeb38d8c50f4c36489c6fbc9bb1a0d13 -
Trigger Event:
release
-
Statement type:
File details
Details for the file etfray-0.1.0-py3-none-any.whl.
File metadata
- Download URL: etfray-0.1.0-py3-none-any.whl
- Upload date:
- Size: 57.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48a687af921ad9b90347c0d08a767234757f627bdb5a5847327016a2edc8910d
|
|
| MD5 |
7356ffeff107364a15d2aa8300ec84a1
|
|
| BLAKE2b-256 |
e3145118d8176ee4f856122af3eccf2e5277ef9dbae434f18dfafe20bafb57c5
|
Provenance
The following attestation bundles were made for etfray-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on alwank/etfray
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
etfray-0.1.0-py3-none-any.whl -
Subject digest:
48a687af921ad9b90347c0d08a767234757f627bdb5a5847327016a2edc8910d - Sigstore transparency entry: 1579688770
- Sigstore integration time:
-
Permalink:
alwank/etfray@0276418bbeb38d8c50f4c36489c6fbc9bb1a0d13 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alwank
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0276418bbeb38d8c50f4c36489c6fbc9bb1a0d13 -
Trigger Event:
release
-
Statement type: