Abhi-AlgoForge Back home

Alpaca QQQ Sniper

A 0-DTE QQQ options bot engineered like software, not a script — 48 tests, one-shot systemd deploys and acceptance-gated calibration.

Client engagement — source code stays private. Shown: architecture, flows and reports.

Alpaca QQQ Sniper trades a morning dip-bounce mean reversion on QQQ with same-day options via Alpaca: a move of at least 0.30% from the open, near a support or resistance level — prior-day high/low, session VWAP or EMA — confirmed by a reversal candle on above-average volume, buys a one-strike-out-of-the-money contract. One trade per day, entries only between 9:35 and 9:50, and everything force-flattens at 10:30.

What sets it apart is engineering discipline. Live trading and backtesting share the exact same strategy and risk code through swappable executors — the twelve-month backtest that narrowed the strategy to the short side ran the very code that trades. Forty-plus backtest variant reports (markdown, trade CSVs, equity charts) document a milestone-based calibration process with explicit acceptance gates.

Operations are deliberately boring: a systemd timer wakes a one-shot process at 9:25 ET each trading day — no daemon to babysit — which runs a pre-market health gauntlet before a single bar is processed. Telegram carries everything, including a daily summary that explains quiet days: which entry gate failed, how often, and what the closest miss looked like.

Risk is layered beyond the per-trade stop: 2% equity sizing with a contract cap, a daily loss cutoff, a consecutive-loss-day halt, blackout dates, and liquidity rules that walk strikes outward until the spread and volume qualify — or decline to trade at all.

System architecture

The modules that make it up, and how data flows between them.

Strategy core

Dip / rally signals · shared with backtest

Risk module

2% sizing · loss cutoff · blackouts

Execution layer

Alpaca · limit-at-mid · requote

Reporting

SQLite log · Telegram · charts

Hover a module to trace what it feeds.

Session flow

One trading morning, end to end — from the systemd timer to the daily summary.

  1. 1

    9:25 ET — wake up

    A DST-safe systemd timer fires the one-shot process; there is nothing running the other 23 hours.

  2. 2

    Pre-market gauntlet

    All checks pass

    Account active, options approved, a real trading day (half-days excluded), data feed returning fresh bars — proceed.

    Any check fails

    A Telegram alert explains exactly what failed, and the process exits cleanly.

  3. 3

    Setup

    Prior-day high and low fetched, the bot waits for the open, then polls minute bars every twenty seconds.

  4. 4

    Entry gate chain

    Inside the window → move past threshold → near a support/resistance level → reversal pattern → above-average volume. Every gate's verdict is recorded per bar for the evening diagnostics.

  5. 5

    Contract hunt

    Strikes are walked outward until one passes the liquidity rules — usable quote, spread within 5%, real daily volume. No qualifying contract means no trade today.

  6. 6

    Sizing & entry

    2% of equity at risk, capped contracts; a limit order at mid with a short wait and up to two requotes — unfilled still counts as the day's one attempt.

  7. 7

    Exit paths

    Target / stop

    +50% take-profit or −50% stop on the premium closes at mid with requotes.

    10:30 hard flatten

    Time's up — force-close everything; if even that fails, a manual-intervention alert fires.

  8. 8

    Wrap-up

    Trade logged to SQLite, the Telegram daily summary goes out — including the gate-failure breakdown and the day's closest miss — and the process exits zero.

Engineering highlights

The details that keep it alive with real money on the line.

48 tests, run before deploys

Executors with mocked fills, strategy functions, risk rules and contract parsing all covered — the suite doubles as the deployment smoke check.

Backtest / live parity

Swappable executors mean the strategy code is identical in research and production — calibration results actually transfer.

One-shot architecture

A process that exists only from 9:25 to shortly after 10:30 has no overnight state to corrupt and nothing to babysit.

Alerts that can't kill trading

Every Telegram send is wrapped so a notification failure can never take down the trading loop.

Explainable quiet days

Per-bar evaluation records turn "why didn't it trade?" into a one-line answer in the daily summary.

Documented operations

A full VPS runbook — setup, ops table, credential rotation, troubleshooting — ships with the bot. Handover-ready.

Under the hood

The stack, and the system in numbers.

Engine
Pythonalpaca-pypandaspydantic
Quality
pytest (48 tests)matplotlib reports
Storage
SQLite
Operations
Ubuntu VPSsystemd timerTelegram
3.3k
Lines of code
48
Tests
40+
Backtest reports
$6/mo
Infrastructure cost

Need a system like this?

I design and build trading infrastructure end to end — let's talk about yours.