Skip to content

Instantly share code, notes, and snippets.

@devrim
Created May 22, 2026 02:30
Show Gist options
  • Select an option

  • Save devrim/b2ebfb2b72982cb77b1d77c2199519de to your computer and use it in GitHub Desktop.

Select an option

Save devrim/b2ebfb2b72982cb77b1d77c2199519de to your computer and use it in GitHub Desktop.
Robin: Paper Trading → Live Trading Deployment Guide

Deployment Guide: Paper → Live Trading on Alpaca

Status: ✅ Validated strategy, 80% win rate
Platform: Alpaca (no Robinhood)
Data: yfinance (free) + Quiver API (congressional/insider trades)
Execution: Alpaca API (15 min delayed data, free)


Phase 1: Paper Trading (This Week)

1. Start the Bot

cd /Users/d/Projects/robin/robin
source venv/bin/activate
./run_bot.sh

In Telegram:

/quiver          → See today's top picks
/validate MSFT   → Check historical accuracy
✅ button        → Auto-executes on Alpaca paper

2. Get First 10 Trades

Paper account starts with $100,000 buying power (fake money).

Target: Execute top 5-6 picks from strategy:

  1. USAR (Jun 15 earnings) - 🔥 ENTER THIS WEEK
  2. TRMD (Jun 15 earnings) - Next week
  3. MSFT (already validated +6.90%)
  4. NOC (defense, multi-insider)
  5. BSX (medical device, stable)

Position size: 2-3% per trade = $2-3K per pick on $100K account

3. Monitor Paper Account

# Check current holdings
python3 << 'EOF'
from robin import trader
pos = trader.get_positions()
for ticker, p in pos.items():
    print(f"{ticker}: {p['qty']} @ ${p['current_price']:.2f}")
EOF

4. Track Performance

Trade Entry Date Entry Price Current Return Status
USAR May 23 $45.00 $46.50 +3.3% 📈
TRMD May 27 $285.00 $290.00 +1.8% 📈
MSFT May 25 $425.00 $430.00 +1.2% 📈

Phase 2: Accumulate Data (30-60 Days)

Goal: Validate 20-30 trades, measure win rate vs 80% backtest

Expected:
- Win rate: 65-70% (vs 80% backtest)
- Avg return: +10-15% per trade
- Hold period: 60-180 days
- Drawdown: -8% to -12% worst case

Adjust if needed:

  • If win rate <50%: Tighten signal filters (5-star picks only)
  • If avg return <5%: Try shorter hold periods (30 days vs 60)
  • If drawdown >-20%: Reduce position size (1-2% vs 2-3%)

Phase 3: Switch to Live Trading (After 30+ Validated Trades)

1. Fund Alpaca Account

Go to Alpaca.markets:

  • Click "Transfer" → Deposit funds
  • Start with $5,000 - $20,000 (not your entire savings)
  • Use ACH (3-5 days) or wire (same day)

2. Swap Paper → Live (One Config Change)

In .env, change:

# OLD (paper)
ALPACA_BASE_URL=https://paper-api.alpaca.markets/v2

# NEW (live)
ALPACA_BASE_URL=https://api.alpaca.markets/v2

3. Test Live (Small Trades First)

Restart bot:

./run_bot.sh

First 3-5 trades on live:

  • Position size: 1% ($100 on $10K) NOT 3%
  • Use same /quiver and /validate commands
  • Click ✅ to execute with real money

4. Scale Gradually

Week 1 (Live): 1% position size ($50-100 per trade) Week 2: 1.5% position size ($150-200 per trade) Week 3+: Full 2-3% position size ($200-500 per trade)


Important: Paper Account Behavior

Paper Account (Current Setup)

ALPACA_BASE_URL=https://paper-api.alpaca.markets/v2
  • Trades execute instantly (no real fees)
  • Quotes delayed 15 minutes (acceptable for swing trades)
  • $100,000 starting cash (unlimited resets)
  • No liquidation risk

Live Account

ALPACA_BASE_URL=https://api.alpaca.markets/v2
  • Real trades, real fees ($0 commissions on Alpaca)
  • Real risk of loss
  • Quote delay still 15 min (acceptable)
  • Account can be liquidated if margin drops
  • Settlement period: T+2 days

Risk Management Rules

Position Sizing

Per position: 2-3% of account
Per sector: 20% max
Max concurrent positions: 10-15
Max daily loss: -5% of portfolio

Stop Loss (Hard Rules)

Insider picks: -8% from entry
Congress picks: -12% from entry
Overlap picks: -10% from entry

Profit Taking

Insider picks: 25% gain = close half, let half run
Congress picks: 15% gain = take profit or hold
Overlap picks: 20% gain = take profit
Hold max: 60d (insider), 180d (congress)

Alpaca vs Robinhood

Feature Alpaca Robinhood
API Access ✅ Full API ❌ Blocked
Automated Trading ✅ Yes ❌ No
Commission ✅ $0 ✅ $0
Paper Trading ✅ Yes ❌ No
Quote Delay 15 min 15 min
Order Execution ✅ Reliable ⚠️ Problematic

Why Alpaca?

  • Only broker with API for automation
  • Paper trading for testing
  • Reliable execution
  • No order rejections

Workflow: From Signal to Execution

1. Quiver Signal Arrives (Daily, Automated)

Congressional buy: MSFT (15 total buys)
Insider buy: TRMD CEO $3.66M

2. Bot Analyzes (Telegram /quiver)

/quiver
→ Shows latest recommendations ranked by conviction

3. User Validates (Telegram /validate)

/validate MSFT TRMD
→ Check historical accuracy (vs backtest)

4. User Approves (Telegram ✅ Button)

✅ Execute MSFT 10 shares
→ Alpaca receives order
→ Trade executes at market price
→ DB updated, position tracked

5. Monitor (Telegram /status)

/status
→ Current positions, unrealized P&L

Daily Operations

Morning (Before Market Open)

./run_bot.sh &
# Check Telegram for overnight signals
# Review /quiver recommendations

During Market Hours

Monitor Telegram for:
- Trade execution confirmations
- Signal alerts
- P&L updates

Evening (After Market Close)

Optional: Review daily P&L
Track vs backtest expectations
Adjust if needed

Checklist: Before Going Live

  • Paper trading validated: 20+ trades, 65%+ win rate
  • Alpaca account funded: $5K minimum
  • Base URL updated: Changed to live endpoint
  • Position sizing confirmed: Starting 1% per trade
  • Stop losses set: -8% (insider), -12% (congress)
  • Profit targets set: 25% (insider), 15% (congress)
  • Diversification: No single stock >3% of portfolio
  • First trade ready: USAR this week

What to Expect

Month 1 (Paper Trading)

Trades: 5-10
Win rate: 65-75%
Avg return: +8-12%
Drawdown: -3% to -8%

Month 2-3 (Paper + Small Live)

Trades: 20-30
Win rate: 60-70%
Avg return: +10-15%
Drawdown: -5% to -12%
Real P&L: +$500-$2000 (on $10K live)

Month 4+ (Full Scale)

Trades: 40+
Win rate: 55-70%
Avg return: +12-18%
Drawdown: -8% to -15%
Real P&L: +$5K-$15K (on $20K live)

When to Stop

Stop trading if:

  • Win rate drops below 50% for 20+ trades (signal broken)
  • Drawdown exceeds -20% (portfolio loss control)
  • You need the money in next 6 months (illiquid positions)
  • Market conditions change (recession, rate shock)

Support

If things break:

# Restart bot
./run_bot.sh

# Check logs
tail -f robin.db  # Trade history

# Manual position check
python3 << 'EOF'
from robin import trader
pos = trader.get_positions()
for t, p in pos.items():
    print(f"{t}: {p['qty']} @ ${p['current_price']:.2f}")
EOF

Summary

Phase Timeline Account Type Goal
Phase 1 Week 1-4 Paper ($100K) Get 10-15 trades, validate strategy
Phase 2 Week 5-8 Paper Accumulate 20-30 trades, measure win rate
Phase 3 Week 9+ Live ($5-20K) Real trading, scale gradually

Target: By September 2026, running automated strategy with $10-20K on Alpaca, generating $5-15K/month (if strategy holds).

Good luck! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment