market-option-monitor

Automated leveraged-ETF trading driven by options sentiment on SPY / QQQ / IWM.

Internal Use · Live-Trading Capable Core developer

Context

Reading the options chain manually to gauge sentiment, then routing a leveraged-ETF trade by hand, is a workflow with two problems: humans are slow to act on signals they’ve already read, and the signal itself is noisy enough that ad-hoc decisions drift. This project automates the loop end-to-end for SPY, QQQ, and IWM — the three liquid indices where an options signal is worth trusting.

Approach

Two decoupled loops

  • Signal loop — scans the options chain daily, computes P/C ratio, ATM IV, max pain, and 20-day rolling versions of each. Writes to a local SQLite cache so the trading loop never re-hits the broker API unnecessarily.
  • Trading loop — reads cached signals only. Decides entry/exit on leveraged ETFs (long-bias) with explicit position-sizing rules.

Broker integration

Primary: Moomoo OpenD (local broker gateway). Fallback: Yahoo Finance for free quote validation when the gateway is cold.

Safety rails (the real work)

  • Kill switch file that short-circuits the trading loop on check-in.
  • Broker dirty-state guard — if the broker state (positions, open orders) doesn’t match the last cached state, the loop halts rather than trades through uncertainty.
  • TFSA constraints encoded explicitly so the trader can’t violate contribution or behavior limits.
  • Minimum holding time to prevent pattern-day-trading issues and churn.
  • Discord webhook for every trade, fill, and guard trigger — the operator knows before the email does.
  • systemd timer for scheduling; the bot is a service, not a cron hack.

Results & What I Learned

Internal use; live-trading capable; performance not publicly reported. I’m not publishing a PnL curve — publishing a PnL curve for a bot that’s run less than a full macro cycle is a way to tell a partial story, and most of the partial stories lie.

What the project is really about is the safety infrastructure, not the signal. The signal is tractable; anyone can compute a P/C ratio. The difference between “a script that traded once” and “a system that can trade every day for a year without blowing up” is kill switches, dirty-state guards, and the discipline to halt rather than trade through uncertainty.

Stack: Python · SQLite · pandas · Moomoo OpenD API · Yahoo Finance (fallback) · Discord webhook · systemd timer

This project’s source is internal-only and not linked publicly.