Lumibot + Alpaca Integration Report

Research-backed implementation plan for strategy development, paper trading, and production architecture.

Back to Home

Proposed Strategies

Opening Range Breakout (ORB)

Market: US Equities

Timeframe: 5-min candles, day trading window

Capture intraday momentum once price breaks the first 15-30 minute range with volume confirmation.

Lumibot Sketch: At market open build opening range; if breakout + volume filter pass then submit bracket order via Alpaca paper account.

  • Max 1% account risk per trade
  • Stop loss below range low for longs / above range high for shorts
  • No new entries after 14:30 ET

SMA Regime Rotation

Market: SPY + defensive ETF basket

Timeframe: Daily bars

Use trend regime detection to rotate between risk-on and defensive ETFs while preserving capital in downtrends.

Lumibot Sketch: If SPY close > SMA200 allocate to SPY/QQQ split; otherwise rotate to SHY/IEF and rebalance monthly.

  • Risk-off if SPY closes below 200-day SMA
  • Monthly rebalance frequency
  • Max 30% allocation per non-cash asset

RSI Mean Reversion Basket

Market: Liquid large-cap equities

Timeframe: Daily scan with intraday execution

Buy oversold names in an uptrend and scale out as price mean-reverts.

Lumibot Sketch: Nightly scan for RSI(2) < 10 and close > SMA50; queue bracket orders for next session open on Alpaca paper endpoint.

  • Only trade symbols with average volume > 2M
  • Hard stop at 2 ATR
  • Take-profit ladder at +1 ATR and +2 ATR

Integration Roadmap

  1. 1) Local Python strategy workspace

    Create a /strategies/lumibot folder with reusable indicators, risk utilities, and strategy classes. Keep broker credentials in .env and never in repo.

  2. 2) Alpaca paper trading credentials

    Use APCA_API_BASE_URL=https://paper-api.alpaca.markets and dedicated paper keys to validate order routing and position sync.

  3. 3) Backtest to paper promotion gates

    Define objective gates (Sharpe, max drawdown, win-rate stability) before enabling a strategy in paper mode. Persist all metrics in this app for review.

  4. 4) Vercel deployment split

    Deploy this Next.js dashboard on Vercel for monitoring/configuration. Run Lumibot execution workers on a Python-capable worker host; trigger health checks from Vercel Cron/API routes.

Vercel Deployment Notes

Why split services?

Trading engines are stateful and often long-running, while Vercel functions are request/response and time-bounded. Split improves reliability and restart control.

Recommended deployment path

Vercel hosts UI + API proxy. Worker host (e.g., container VM) runs Lumibot and connects to Alpaca paper/live APIs. Use webhook or queue to pass strategy changes.

Operational checklist

Add structured logs, per-strategy kill-switch, drawdown circuit-breakers, and heartbeat alerts before moving from paper to live.

Research Sources