Visualize and compare the performance of stocks in your portfolio β by ticker, by sector, against benchmarks, and against your own realized P&L.
compare-my-stocks is a desktop app (PySide6/Qt + matplotlib + pandas) with
deep Interactive Brokers and Polygon integration, plus an embedded Jupyter
notebook for adβhoc analysis. BYOK (Bring Your Own Keys): you keep your
data, the app just visualizes it.
π Docs: GitHub Pages Β· Quick start Β· Configuration reference Β· Wiki
Profit per sector vs the entire portfolio, since a chosen date:
(You won't see your portfolio until you upload your transactions.)
A specific airline, the airlines as a group, and Nasdaq:
ESYJY here is ~48% behind the Nasdaq since 04/01/2021 β and significantly behind airlines as a group. That kind of cross-cut is the point of the app.
- Cross-sectional comparison. Group your tickers (e.g. "Airlines", "Cloud") and compare a group's average against any other ticker, group, or your portfolio.
- Real P&L. Pull realized + unrealized profit, automatically synced with IB, split-adjusted, currency-normalized.
- No vendor lock-in. Works offline once data is cached. Export to CSV. Load your own Jupyter notebook for custom analysis.
- Free and open source. No subscription, no telemetry.
β Working Β Β βͺ Present but not finished Β Β βοΈ Planned
- β
Price history from Interactive Brokers (via the
ibsrvsidecar) - β Price history from Polygon
- β Crypto and ETFs
- β Stocks from any exchange IB supports
- β Import transactions from My Stocks Portfolio CSV β works with any broker
- β Pull transactions from IB Flex
- β Realized + unrealized P&L
- β Currency normalization (set a base currency; everything converts)
- β Holdings auto-adjusted for stock splits
- β Many graph types: Total Profit, Price, Realized Profit, Compare, β¦
- β Compare vs another ticker, vs a group, vs your portfolio
- β Show % change / % diff from a chosen point, max, or min
- β Pick top-N stocks or filter by value range
- β Unite a group by avg price or avg performance
- β
Save and reload graph parameter presets (
graphs.json) - βͺ Compare your actual P&L against a hypothetical "what if I'd bought the index instead" portfolio
- β Embedded notebook with the current graph's data preloaded
- β Edit & reload notebook directly from the app
- β
One-line correlations:
mydata.act.df.corr(method='pearson') - β
Generate graphs from code:
gen_graph(Parameters(type=Types.PRICE | Types.COMPARE, compare_with='QQQ', groups=["FANG"]))
- βͺ Inline graphs in Jupyter
- β Define & edit categories / groups in the GUI
- β Completely free and open source
- βοΈ P/E and price-to-sales overlays
- βοΈ Bar graphs
- βοΈ Inflation-adjusted performance
- βοΈ Web frontend
- π΄ Not planned: technical-analysis indicators
End users should grab the Windows installer from Releases.
This is actually recommended to everyone if not want to mess with Python and dependencies β the installer bundles everything.
For developers, the easiest path is the bundled PowerShell installer
install/installdev.ps1 (Python 3.11) β it runs
pip install "compare-my-stocks[full]" and copies the bundled defaults into
~/.compare_my_stocks/. Pass -currentbranch to install from the current
checkout instead of PyPI:
./install/installdev.ps1 # install from PyPI
./install/installdev.ps1 -currentbranch # install from this checkoutThe pip-based developer install should also work on macOS and Linux, but
those platforms are untested β installdev.ps1 itself requires PowerShell,
so on non-Windows you'll need to run its pip install and data-copy steps
by hand.
Full instructions, IB / Polygon configuration, and your first graph are in docs/QUICKSTART.md.
All behavior is controlled by ~/.compare_my_stocks/data/myconfig.yaml.
Every option is documented in docs/CONFIGURATION.md,
along with the most common tweaks (longer history, different data source,
display scaling, β¦).
Highly configurable.
python -m compare_my_stocks # normal launch (developer)
compare-my-stocks.exe # normal launch (installed)
python -m compare_my_stocks --console # keep the console attached
python -m compare_my_stocks --debug # DEBUG-level logging
python -m compare_my_stocks --nogui # headless mode
python -m compare_my_stocks --config-file D:\alt.yamlIf something looks wrong, always start with --console to see logs.
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββββ
β gui (Qt) ββββββΆβ CompareEngineββββββΆβ GraphGenerator β
β mainwindow β β orchestratorβ β (matplotlib) β
ββββββββββββββββ ββββββββ¬ββββββββ ββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ
β InputProc. β β Transactions β β DataGenerator β
β (IB/Poly/ β β (IB Flex + β β (price/profit/ β
β Cache) β β MyStocks) β β compare/group) β
βββββββ¬βββββββ ββββββββββββββββ ββββββββββββββββββββ
β
βΌ
βββββββββββββββ ββββββββββββββββββββββββββββ
β ibsrv.exe β βββββββ β Pyro5 RPC (separate β
β sidecar β β process; isolates IB) β
βββββββββββββββ ββββββββββββββββββββββββββββ
More detail in CLAUDE.md and the wiki.
pytest src/compare_my_stocks/testsIssues and PRs welcome. Pre-existing wiki: Things good to know when using the app.
If you want to dig into the code:
CLAUDE_REPO.mdβ architecture overview and conventions (also useful for humans)docs/CONFIGURATION.mdβ every config fieldsrc/compare_my_stocks/engine/compareengine.pyβ the orchestratorsrc/compare_my_stocks/processing/β data transformssrc/compare_my_stocks/ibsrv.pyβ the IB sidecar process
- OS: developed and tested on Windows. Other OSes are unverified.
- Display: designed around 1920Γ1080. Auto-scales for other resolutions;
set
Running.TryToScaleDisplay: falseif the auto-scale misfires. - Data location: the app creates
~/.compare_my_stocks/(override viaCOMPARE_STOCK_PATH) for logs, caches, and config. - Python & Pandas pin:
pandas==1.5.3is intentional β caches on disk are pickled with that version. Don't upgrade without migrating the cache. Will change soon. That also means Python 3.11 is required, since Pandas 1.5 is not supported on 3.12 .
- No warranty. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM USE OF THIS SOFTWARE β including any claim associated with usage of the Interactive Brokers API. Consult the relevant providers' licenses before use.
- The software can consume CSVs exported from My Stocks Portfolio & Widget by Peeksoft.
- This project was developed individually, in spare time, without compensation. The author is not affiliated with Interactive Brokers, Polygon, Peeksoft, or any mentioned company.
- The author takes no responsibility for the correctness of any displayed graph or computed P&L.
Eyal Karni Β· eyalk5@gmail.com Β· contributions and bug reports welcome.

