- Python 99.5%
- Dockerfile 0.5%
Grow the ticker from a single-file dashboard into a small, layered package (src/options_ticker) with a pluggable data feed and two UIs, and implement the full enhancement roadmap. Quick wins - Greeks: Black-Scholes Δ Γ Θ Vega (stdlib NormalDist), behind --greeks, verified against textbook reference values and put/call parity - Tick highlighting: cells flash green/red when a quote moves between polls - Staleness: illiquid quotes fade and show a "last traded 2h ago" tag - Sentiment line: put/call volume & OI ratios, ATM IV, totals, and max pain - Spread% (liquidity) and %-from-spot (moneyness) columns Toward real-time - Pluggable providers behind a DataProvider interface: Yahoo (keyless default, greeks computed locally), Tradier and Polygon (real-time quotes + greeks via API key); vendor payload parsers are unit-tested with fixtures - Non-blocking PollingEngine on a background thread — the UI reads the latest snapshot and never stalls on the network; degrades to last-good on error - Interactive Textual TUI: cycle expiry/strike window, toggle greeks, refresh, and a multi-symbol watchlist via tabs (reuses the shared rich renderers) - Recorder (SQLite/CSV) and edge-triggered threshold alerts with terminal-bell and desktop notifications Project maturity - pytest suite (38 tests, fully offline) covering greeks, formatters, strike selection, analytics, snapshot degradation, market hours, recorder, providers - Packaging: pyproject.toml with an `options-ticker` console script and `python -m options_ticker`; ruff + mypy config - Dockerfile and CI (Gitea Actions + GitHub mirror) running ruff + pytest on Python 3.9-3.12 - Market-hours awareness: OPEN/CLOSED badge and auto-slowed polling when shut, via a computed NYSE holiday calendar (incl. Good Friday) ticker.py is now a thin shim so `python ticker.py AAPL` still works from a source checkout. README fully redesigned to document all of the above. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .gitea/workflows | ||
| .github/workflows | ||
| src/options_ticker | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| Dockerfile | ||
| pyproject.toml | ||
| README.md | ||
| requirements.txt | ||
| ticker.py | ||
⚡ Real-Time Options Ticker
A live, broker-style options-chain dashboard for your terminal.
Calls on the left · strikes down the middle · puts on the right — refreshing in place, with greeks, sentiment, tick highlighting, and a pluggable real-time data feed.
Preview
Quote view — bid/ask/last, % change, volume, implied vol, and bid-ask spread per side.
The at-the-money strike is highlighted; ▲/▼ marks quotes that moved on the latest refresh;
faded prices with an age tag (2h) are stale.
╭─ ⚡ Real-Time Options ──────────────────────────────────────────────────────────────────────────────────────╮
│ AAPL $333.74 ▲ +1.72 (+0.52%) OPEN Exp 2026-07-20 · 2d yahoo Updated 14:32:05 · 10s │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
P/C vol 1.02 P/C OI 1.48 ATM IV 25.0% Call vol 133,839 Put vol 136,570 Max pain 325
Bid Ask Last Chg% Vol IV Spr% STRIKE %Spot Bid Ask Last Chg% Vol IV Spr%
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
9.15 9.55 9.50 ▲ +5.0% 1,921 30.4% 4% 325 -2.6% 0.46 0.50 0.48 -45.9% 18,148 25.9% 8%
6.70 7.15 7.13 -3.0% 2,112 30.1% 6% 327.5 -1.9% 0.81 0.90 0.82 -38.3% 11,595 25.6% 11%
4.90 5.10 5.13 -7.2% 11,294 25.6% 4% 330 -1.1% 1.34 1.46 1.39 -30.8% 26,532 24.7% 9%
3.45 3.60 3.53 ▼ -5.9% 18,310 24.4% 4% [ 332.5 ] -0.4% 2.20 2.50 2.30 -23.3% 12,240 25.6% 13%
2.24 2.30 2.24 -15.8% 40,861 23.9% 3% 335 +0.4% 3.40 3.70 3.55 -17.1% 29,536 25.0% 8%
1.25 1.40 1.30 -27.7% 17,554 23.9% 11% 337.5 +1.1% 4.10 4.35 4.25 -29.5% 1,683 27.2% 6%
CALLS PUTS ATM ▲▼ = ticked this refresh · faded = stale quote next in 7s
Greeks view (--greeks) — swaps the quote columns for Δ Γ Θ Vega, computed locally via
Black-Scholes from each contract's implied vol (or taken straight from Tradier/Polygon).
Last IV Δ Γ Θ Vega STRIKE %Spot Last IV Δ Γ Θ Vega
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5.13 25.6% 0.731 0.0522 -0.548 0.082 330 -1.1% 1.39 24.7% -0.262 0.0534 -0.487 0.080
3.53 24.4% 0.590 0.0645 -0.607 0.096 [ 332.5 ] -0.4% 2.30 25.6% -0.414 0.0617 -0.600 0.096
2.24 23.9% 0.424 0.0664 -0.593 0.097 335 +0.4% 3.55 25.0% -0.572 0.0634 -0.586 0.097
What "real-time" means: the dashboard re-polls its data source on an interval and redraws live. With the default Yahoo feed that data is delayed/indicative (~15 min); point it at Tradier or Polygon with an API key for genuine real-time quotes. See Providers.
Highlights
| 📊 Broker montage | Calls | strikes | puts, aligned, with the ATM strike highlighted |
| 🧮 Greeks | Δ Γ Θ Vega via Black-Scholes (stdlib only) — --greeks |
| 🌡️ Sentiment line | Put/call ratios, ATM IV, total volume, and max pain |
| ✨ Tick highlighting | Cells flash green/red when a quote changes between polls |
| ⏱️ Staleness tags | Illiquid quotes fade and show "last traded 2h ago" |
| 💧 Liquidity at a glance | Bid-ask spread % and % from spot columns |
| 🔌 Pluggable feeds | Yahoo (keyless) · Tradier · Polygon behind one interface |
| 🧵 Non-blocking | Background polling thread — the UI never stutters on the network |
| ⌨️ Interactive TUI | Textual app: change expiry/strikes, toggle greeks, multi-symbol tabs |
| 🗄️ Record & alert | Log every poll to SQLite/CSV; bell + desktop alerts on thresholds |
| 🕰️ Market-aware | OPEN/CLOSED badge; auto-slows polling when the market is shut |
Installation
# from source (recommended)
git clone https://git.mocipher.com/m01/RealTimeOptionsTicker.git
cd RealTimeOptionsTicker
pip install . # installs the `options-ticker` command
# or just the dependencies, to run the script in place
pip install -r requirements.txt
python ticker.py AAPL
Run in Docker
docker build -t options-ticker .
docker run --rm -it options-ticker AAPL --greeks # -it so the live UI gets a terminal
Requires Python 3.9+. Core deps: yfinance,
rich, textual,
requests, tzdata.
Usage
options-ticker AAPL # nearest expiry, live dashboard
options-ticker TSLA -e 2026-07-24 -n 12 # specific expiry, 12 strikes
options-ticker SPY --greeks -i 5 # greeks, refresh every 5s
options-ticker NVDA --list-expiries # list expirations and exit
options-ticker MSFT --once # one snapshot, then exit
options-ticker AAPL MSFT NVDA --tui # interactive multi-symbol watchlist
(From a source checkout without installing, swap options-ticker for python ticker.py.)
Options
| Flag | Argument | Default | Description |
|---|---|---|---|
symbols |
— | (prompted) | One or more ticker symbols |
-e, --expiry |
YYYY-MM-DD |
nearest | Expiration to display |
-n, --strikes |
int | 8 |
Strikes to show around spot |
-i, --interval |
seconds | 10 |
Refresh interval |
--provider |
yahoo·tradier·polygon |
yahoo |
Data source |
--greeks |
— | off | Show Δ Γ Θ Vega |
--rate |
float | 0.04 |
Risk-free rate for greeks |
--tui |
— | off | Launch the interactive Textual TUI |
--record |
PATH |
— | Append each poll to .db (SQLite) or .csv |
--alert |
EXPR |
— | Threshold alert, repeatable (see below) |
--no-market-hours |
— | — | Don't auto-slow polling when closed |
-l, --list-expiries |
— | — | List expirations and exit |
--once |
— | — | Render one snapshot and exit |
Reading the montage
Calls are on the left, puts on the right, sharing the central STRIKE ladder.
The %Spot column is each strike's distance from the underlying.
| Column | Meaning |
|---|---|
| Bid / Ask | Best bid & ask |
| Last | Last trade (faded + age tag when stale) |
| Chg% | Percent change on the day (green up / red down) |
| Vol | Contracts traded today |
| IV | Implied volatility (annualized) |
| Spr% | Bid-ask spread as % of mid — a liquidity tell (green tight, red wide) |
| Δ Γ Θ Vega | Greeks, in --greeks mode |
The sentiment line summarizes the whole chain: put/call volume & open-interest ratios, ATM implied vol, total call/put volume, and the max-pain strike.
🔌 Providers
One interface, swappable feeds. Yahoo is the keyless default; the others give real-time quotes (and their own greeks) once you set an API key.
| Provider | Real-time | Greeks | Setup |
|---|---|---|---|
| yahoo (default) | delayed ~15m | computed locally | none |
| tradier | ✅ | ✅ from feed | export TRADIER_TOKEN=… (get one) |
| polygon | ✅ | ✅ from feed | export POLYGON_API_KEY=… (get one) |
export TRADIER_TOKEN=xxxxxxxx
options-ticker AAPL --provider tradier --greeks
Recording & alerts
# Append every polled quote (the on-screen window) to SQLite for later analysis
options-ticker AAPL --record aapl.db
# Fire a terminal bell + desktop notification when a threshold is crossed
options-ticker AAPL --alert "iv>1.0" --alert "spot>340" --alert "volume>5000"
Alerts are edge-triggered — they fire once when the condition becomes true and re-arm after it
clears. Metrics: per-contract (last, bid, ask, mid, iv, volume, oi, delta,
spread_pct) and chain-level (spot, pc_ratio, pc_oi, atm_iv, max_pain);
operators >, <, >=, <=.
⌨️ Interactive TUI
options-ticker AAPL MSFT NVDA --tui
| Key | Action |
|---|---|
← / → |
Switch symbol (watchlist tab) |
n / p (or ] [) |
Next / previous expiration |
k / j (or + -) |
More / fewer strikes |
g |
Toggle greeks |
r |
Refresh now |
q / Esc |
Quit |
Architecture
A small, layered package — the provider seam and the shared renderers keep the two UIs thin.
flowchart LR
Y[Yahoo] --> E
T[Tradier] --> E
P[Polygon] --> E
E[PollingEngine<br/>background thread] -->|greeks · analytics<br/>tick-diff| S[Snapshot]
S --> R[rich renderers]
R --> L[Live CLI]
R --> U[Textual TUI]
E -.-> D[(SQLite / CSV)]
E -.-> A[Alerts]
src/options_ticker/
├── providers/ yahoo · tradier · polygon behind a DataProvider interface
├── engine.py background polling, strike selection, greeks, tick-diff
├── greeks.py Black-Scholes (stdlib NormalDist)
├── analytics.py put/call ratios, ATM IV, max pain
├── market_hours.py NYSE session + holiday calendar (incl. Good Friday)
├── recorder.py SQLite / CSV logging
├── alerts.py threshold rules + notifications
├── models.py OptionQuote · Chain · Snapshot
├── ui/render.py shared rich renderers (header · montage · sentiment · footer)
├── ui/app.py Textual TUI
└── cli.py argument parsing + run modes
Development
pip install -e ".[dev]"
pytest # 38 tests, fully offline (yfinance is mocked)
ruff check .
CI runs ruff + pytest across Python 3.9–3.12 on every push
(.gitea/workflows/ci.yml, mirrored to .github/).
Limitations
- Delayed by default. Yahoo's free feed is delayed (~15 min) and quiet outside U.S. market hours. Use Tradier/Polygon for real-time.
- Unofficial Yahoo endpoint.
yfinancescrapes Yahoo; it can change or rate-limit. Very short intervals may get throttled — the ticker keeps showing the last good snapshot on error. - Wide output. The montage is happiest at ~130+ columns (more with
--greeks); it wraps gracefully on narrow terminals — reduce--strikes. - U.S. equity options. Coverage follows whatever the provider lists.
Disclaimer
For educational and informational purposes only. This is not investment advice, and the
data is not warranted to be accurate, complete, or timely. Do not rely on it for trading decisions.
Uses yfinance; not affiliated with or endorsed by Yahoo,
Tradier, or Polygon.