Command-line reference¶
compare-my-stocks has two CLI surfaces:
python -m compare_my_stocks— the main application (Qt GUI by default; can run headless).python -m compare_my_stocks.gui.config_gui— the standalone config editor.
The installed Windows executable (compare-my-stocks.exe) accepts the
same flags as python -m compare_my_stocks.
python -m compare_my_stocks¶
python -m compare_my_stocks [OPTIONS]
All flags are optional. With no flags the app launches the Qt main
window using ~/.compare_my_stocks/data/myconfig.yaml.
Console / logging¶
| Flag | Effect |
|---|---|
--console |
Keep the terminal attached so startup logs are visible. Useful while configuring. |
--noconsole |
Hide the console window even when launched from a terminal. |
--debug |
Set log level to DEBUG (verbose). |
--trace |
Enable TRACE-level logs (more verbose than --debug). |
--console is purely about the OS-level console window on Windows.
Both --debug and --trace change what is logged regardless of
where it goes; combine with --console to see it live.
Log files always land in ~/.compare_my_stocks/log.txt (and
error.log).
Mode¶
| Flag | Effect |
|---|---|
--nogui |
Run headless: no Qt window, no WebAgg server. Generates the default graph from DefaultParams and exits. Used by smoke tests. |
--noprompt |
Disable interactive prompts. Specifically: TransactionHandlers.IB.PromptOnQueryFail and Sources.IBSource.PromptOnConnectionFail are forced to False, and the first-run IB baseline prompt is skipped. |
--noprompt is the right flag for CI / scripted runs even with the
GUI — it ensures the app never blocks on a modal dialog.
Tutorial¶
| Flag | Effect |
|---|---|
--tutorial |
Run the guided UI tour on startup. |
--tutorial-auto |
Auto-advance tutorial steps without requiring clicks. Implies --tutorial. |
Config file¶
| Flag | Effect |
|---|---|
--config-file PATH |
Absolute path to a myconfig.yaml to use instead of the default. Overrides the COMPARE_STOCK_CONFIG_FILE environment variable. |
To change the whole data directory (caches, statements, groups, …),
set COMPARE_STOCK_PATH instead — --config-file only redirects the
YAML.
IB baseline¶
| Flag | Effect |
|---|---|
--generate-ib-statement |
On startup, fetch open positions from IB and (over)write IBStatement.SrcFile as a baseline statement. Bypasses the one-time first-run prompt and the file-existence check. Requires a live IB connection. |
Use this if you want to script the "seed open positions from IB" step that the app normally offers as a one-time prompt on first run.
Deprecated / no-op¶
| Flag | Status |
|---|---|
--ibconsole |
No-op. Was the IB sidecar console flag; this branch runs IB in-process. Kept so old scripts/shortcuts don't error. |
Environment variables¶
These are read by the app on import, before any flag parsing.
| Variable | Effect |
|---|---|
COMPARE_STOCK_PATH |
Overrides the default data dir (~/.compare_my_stocks). Caches, myconfig.yaml, groups.json, graphs.json, logs all live under it. |
COMPARE_STOCK_CONFIG_FILE |
Absolute path to a myconfig.yaml. --config-file takes precedence. |
QT_SCALE_FACTOR |
Standard Qt knob. The app sets this automatically based on screen size unless Running.TryToScaleDisplay is false in config — set it yourself only to override the auto-detected value. |
Common invocations¶
# Normal launch
python -m compare_my_stocks
# Debug a startup issue
python -m compare_my_stocks --console --debug
# Headless smoke test (CI-friendly)
python -m compare_my_stocks --nogui --noprompt
# Use an alternate config without touching ~/.compare_my_stocks
python -m compare_my_stocks --config-file C:\work\altconfig.yaml
# Point the whole data dir somewhere else (tests, parallel installs)
$env:COMPARE_STOCK_PATH = "$HOME\.compare_my_stocks_test"
python -m compare_my_stocks
# Seed an IB Activity Statement from currently-open positions
python -m compare_my_stocks --generate-ib-statement
# Run the guided tour on first launch
python -m compare_my_stocks --tutorial
# Auto-advance tour (for screencasts / demos)
python -m compare_my_stocks --tutorial-auto
python -m compare_my_stocks.gui.config_gui¶
Standalone config editor — same tabs that are reachable via the main window's Config/Help… button, but launched as its own process. Includes a Tutorial / Actions tab where the tutorial and the "Generate IB Statement now" button live (those two require the running main app, so they are disabled in standalone mode).
python -m compare_my_stocks.gui.config_gui [--config PATH]
| Flag | Effect |
|---|---|
--config PATH |
Path to the myconfig.yaml to edit. Default: ~/.compare_my_stocks/myconfig.yaml. The file must already exist (the editor will not create it). |
Exit code 2 if the config file is missing.
Single-instance behaviour¶
The main app holds a Windows mutex
(Global\CompareMyStocks_SingleInstance) — launching a second copy
shows a "Already Running" dialog and exits with code 1. The config
GUI is not mutex-guarded; you can run it alongside the main app.
See also¶
- QUICKSTART.md — getting up and running.
- CONFIGURATION.md — every YAML option.
- config_help.md — credential / file-path field reference (mirror of the GUI's Help tab).