Build Claude Stock Trading Bots in 3 Levels
Connect Claude to Alpaca for paper trading, automate trailing stops and ladder buys on stocks like Tesla, copy politicians' trades via Capitol Trades data, and run options wheel strategies—all by prompting Claude to code and schedule bots.
Core Setup: Connect Claude to Live Markets Without Coding
Claude accesses real-time market data and executes trades via Alpaca's API, democratizing Wall Street advantages in data, execution, and intelligence. Start with paper trading (fake money, real prices) to test risk-free. Prerequisites: Claude Pro/Max desktop app (Windows/Mac), no prior trading or coding experience needed—this fits early in any AI automation workflow for finance.
Step-by-step connection:
- Download Claude desktop app from claude.ai/download.
- Create free Alpaca account at alpaca.markets; generate paper trading account with $50k simulated funds.
- In Alpaca dashboard, generate API keys: Endpoint, Key ID, Secret Key.
- In Claude's code workspace, create 'trading' folder; paste keys as files (endpoint.txt, key.txt, secret.txt).
- Prompt Claude: "Using the Alpaca docs and my keys, buy 1 share of AAPL." Claude codes the connection and executes—verify in Alpaca dashboard.
- Save credentials permanently: "Save these credentials in this folder for future trades."
Principle: Wall Street wins with asymmetric info (whales/politicians' moves) and automation; Claude plugs into APIs for both. Common mistake: Trading real money first—always paper trade to validate bots. Quality check: Orders appear instantly in dashboard; Claude summarizes each trade.
"The gap between Wall Street and regular people comes down to just three things: data, execution, intelligence."
Rule-Based Bots: Trailing Stops and Ladder Buys for Disciplined Gains
Encode your risk tolerance into bots that run autonomously, outperforming gut-feel trading. Trailing stop: Buy at $100, set 10% stop-loss floor ($90). As price rises to $110, trail floor to $105 (5% below peak)—floor only rises, locking profits. Ladder buys: On dips (e.g., -20% buy 10 shares, -30% buy 20), average down for better entry.
Build the bot: Prompt Claude in trading folder: "Buy 10 TSLA shares at market. Set trailing stop: 10% initial stop-loss, trail 5% below peaks. Ladder: -20% buy 10 more, -30% buy 20. Summarize orders." Claude buys, sets orders, shows summary.
Schedule automation: "/schedule Tesla trailing stop monitor every 5min market hours (Mon-Fri 9am-4pm ET). Check/adjust floors, re-enter ladders." View in Claude's clock icon—runs if computer on.
Test scenarios: Role-play: "If TSLA hits $500?" Claude simulates: Trails floor up, no sells unless dip hits new floor. Refine: "Optimize ladder levels for gradual buys on rises." Avoid mistake: Vague prompts like "trade smart"—specify rules mirroring your strategy for discipline at machine speed.
"The rules aren't the limitation... Claude executes your decisions at speed and discipline you never could."
Before: Manual checks miss opportunities. After: Bot loops 24/5, protects capital, recycles losses into new setups.
Smart Money Copy Trading: Plug Claude into Whale and Politician Data
Retail loses to "smart money" (whales: $50M+ trades; politicians: insider access, legally reported). Services like Capitol Trades aggregate filings; Claude's MCP skill (plug) pulls live data.
Copy bot setup: New Claude session/paper account. Prompt: "Connect to new Alpaca keys. Use Capitol Trades to track top politicians beating S&P (e.g., Michael McCaul: 34.8% vs S&P 15% over year). Auto-copy buys/sells." Claude scans, picks McCaul, mirrors trades.
Why it works: Politicians outperform via committees/contracts; data free/public but overwhelming—Claude filters. Backtest: $50k following McCaul yields $67.4k (34.8%) vs S&P $57.75k.
Mistake: Ignoring data volume—use pre-aggregated services, not raw web scraping. Quality: Bot logs trades with rationale (e.g., "McCaul bought post-briefing").
"Members of Congress are required by law to report their stock trades... many consistently beat the market."
Options Wheel Strategy: Consistent Income via Selling Premiums
Options: Contracts betting on price moves. Calls (bullish), puts (bearish). Wheel: Sell cash-secured puts (collect premium as "insurance"), get assigned shares cheap, sell covered calls, repeat—theta decay profits time over direction.
Why consistent: 70-80% options expire worthless; you're the house. Fail point: Overleveraging—wheel on quality stocks, small positions.
Bot build: Prompt Claude: "Explain/implement wheel on stock. Sell put 20% OTM, collect premium. If assigned, sell ATM call. Automate weekly." Claude codes full cycle, schedules.
Fits after stocks mastery; assumes basic options grasp from tutorial.
"Selling options makes you the insurance company... most consistent income strategies."
Key Takeaways
- Always paper trade first: Same market dynamics, zero risk—scale to live only after 1-3 months validation.
- Define explicit rules (e.g., 10% stop, 5% trail) before prompting; test scenarios to harden bots.
- Plug data via MCP/Capitol Trades for edge—copy proven outperformers like McCaul over gut picks.
- Schedule bots with /schedule for 5min market checks; keep computer on or use cloud later.
- Wheel for income: Sell OTM puts/calls on stables; avoid high-vol meme stocks.
- Refine iteratively: Ask Claude "What if X?" or "Optimize Y" to evolve strategies.
- No gut trading: Encode discipline—"hand your AI a pile of money and say 'figure it out' fails."
- Tools stack: Claude desktop + Alpaca API keys + data plugs = full autonomy.
"You've still got that capital. Claude can now take that money and go looking for the next setup. Live to trade another day."