How to Build an
AI Trading Bot with Claude
Connect Claude to Robinhood with the MCP, teach it your strategy with skill files, pull live market data, and backtest before you ever risk a dollar.
A practical, end-to-end guide for building your own AI trading bot.
No trading engine to write · Guide Claude with plain language · Track every trade
The Roadmap
What you will learn
An AI trading bot is just three pieces working together: Claude as the brain, the Robinhood MCP as its hands, and your skill files as the rulebook. This guide walks through each piece, then shows you how to get market data, form a strategy, and backtest it before going live.
Claude as the brain
The AI model that reads the market, reasons about your rules, and decides what to trade.
The MCP as its hands
The Robinhood MCP gives Claude tools to read quotes and historicals and to place orders.
Skill files as the rulebook
Plain-language instruction files that make Claude's decisions consistent and disciplined.
PRO & Premium
Need help building?
PRO and Premium members get hands-on agentic bot support from our own software engineering and finance team, with over a decade of experience building and trading real systems. Stuck on a Claude script, unsure how to pull market data, or want a second set of eyes on your strategy before going live? We help with any part of the process.
Claude script help. We review and debug your skill files and trading scripts so Claude follows your rules exactly.
Strategy guidance. Talk through your approach with people who have traded professionally for over ten years.
Market data and MCP setup. We help you connect the MCP and pull the quotes and historicals your bot needs.
Backtesting support. Validate a strategy on historical data with our help before you risk a dollar.
Help at every step. From first setup to going live, reach out at any point in the process.
Built by the same team. The people who build ThetaPal are the ones answering your questions.
Included with PRO and Premium plans.
Step 1
Connect Claude to Robinhood with the MCP
The Model Context Protocol (MCP) is an open standard that lets an AI model securely use outside tools. Instead of writing custom API code, you add the Robinhood MCP server to Claude once, and Claude gains a clean set of trading tools it can call on its own.
With the MCP connected, Claude can look up a quote, check your positions, read historical prices, and place an order, all through the same secure connection. You stay in control of what it is allowed to do.
A few tools the Robinhood MCP gives Claude
- › Get equity and option quotes
- › Read positions and portfolio value
- › Pull historical price data
- › Place and review orders
Watch how it works
Connecting Claude and Robinhood
A short walkthrough of AI trading on Robinhood. Opens on YouTube.
Robinhood Agentic Trading overviewStep 2
Guide Claude with skill files
A skill file is a plain-language instruction file that tells Claude exactly how to behave. It is the difference between a chatbot that improvises and a disciplined bot that follows your rules every single time.
Keep your instructions specific and unambiguous. Spell out your entry and exit rules, how much to risk per trade, what to never do, and the exact steps to take when a signal fires. The more precise the file, the more consistent your bot.
Start small with one strategy, watch how Claude follows it, then tighten the wording wherever it drifts. Treat your skill file like code you refine over time.
What a strong skill file covers
- A Entry rules. The exact conditions that must be true before the bot opens a position.
- B Exit rules. Your profit target, stop loss, and time-based exits, stated as numbers.
- C Risk limits. Position size, max trades per day, and the most you will ever lose on one trade.
- D Guardrails. Hard rules the bot must never break, like skipping earnings days or low-liquidity names.
example-trading-bot/SKILL.md
A real bot skill file, sanitized into a fill-in-the-blanks template
--- name: example-trading-bot description: Reads a signal, places a whole-share entry through the Robinhood MCP, then manages a broker-side trailing stop and flattens before the close. Drive it on an interval with /loop. --- # EXAMPLE_BOT - AI Trading Bot Template ## The plan is law Read `.claude/your_bot_plan.json` at the start of EVERY invocation. It defines the account, sizing, stop and trail percentages, and exit rules. ## The loop - what to do each invocation 1. Load context (plan, signal file, state file, current time). 2. Bootstrap your signal source if it is not already running. 3. Branch on phase: IDLE -> ENTER -> PROTECT -> TRAILING -> CLOSE ### ENTER - place the entry (only once per signal) - Capture the decision snapshot now (for slippage tracking). - Size whole shares against the limit price, never the raw ask. - review_equity_order, then place_equity_order with a fresh ref_id. ## Hard safety rules - One position at a time, one entry per signal. - Whole shares only so the broker-side stop is valid. - Never leave the position without a resting stop. If you cannot, HALT. - Anything outside the plan -> stop and ask. ... full template includes the state-file shape, the complete TRAILING + flatten logic, slippage tracking, the audit ledger, and the daily-summary schema. Open it with the button above.
This is a sanitized version of a skill file we actually run. The strategy specifics and tuned numbers have been replaced with placeholders, so you can drop in your own rules. It is a template, not trading advice.
Step 3
Get market data into your bot
A bot is only as good as the data it sees. The same MCP connection that places orders also pulls the data Claude needs to decide. Give it a clear picture of price, trend, and context before it acts.
Live quotes
Current bid, ask, and last price so the bot knows where the market is right now before it sizes a trade.
Historical prices
Intraday and daily history to measure trend, volatility, and support and resistance levels.
Fundamentals and context
Company fundamentals and broader context so the bot avoids trading blind into news or earnings.
Tip: tell Claude exactly which data to fetch and in what order in your skill file. A clear data checklist keeps every decision grounded in the same inputs instead of whatever it happens to look at.
Step 4
Form a strategy Claude can follow
A strategy is just a clear set of if-then rules. The goal is to make it so specific that two people reading it would place the exact same trade. Vague strategies produce vague bots.
Pick one edge
Choose a single, simple idea to start: an opening-range breakout, a mean reversion off an extreme, or a trend follow. One edge done well beats five done loosely.
Define the trigger
Write the exact condition that opens a trade, with real numbers. For example, price closes above the first 30-minute high by more than a set percent.
Set the exit and stop
Decide your profit target and stop loss before entering. Make them numeric so the bot never has to guess when to get out.
Size the position
Tie position size to your risk per trade, not a gut feeling. Risk a fixed, small percent of the account on each idea.
Step 5
Backtest before you risk a dollar
Backtesting means replaying your strategy over historical data to see how it would have performed. It is the cheapest way to find out whether your edge is real before any money is on the line.
Claude can help here too. Hand it your rules and a window of historical prices and ask it to walk the data day by day, log each trade your rules would have taken, and total up the results.
Be honest with the numbers. Test on data the strategy was not tuned on, account for fees and slippage, and treat a strategy that only works after heavy tweaking with suspicion.
Numbers worth checking
A backtest is a guide, not a guarantee. Past performance never promises future results.
Step 6
Run the bot and track every trade
Once your strategy holds up in a backtest, run it for real. Start small, run the bot on a schedule during market hours, and review what it does at the end of each day.
Then connect the account to ThetaPal. It links through SnapTrade's secure, read-only sync, so it tracks every trade your bot makes and shows your real percentage return without ever placing an order or moving your money.
- ✓ Start small. Fund only what you are comfortable putting to work while you learn how the bot behaves.
- ✓ Run on a schedule. Let the bot check the market on an interval rather than watching it by hand.
- ✓ Review the closed trades. Your real edge shows up in realized profit and loss, tracked live in ThetaPal.
- ✓ Refine the skill file. When the bot drifts, tighten the wording and run again. It is a loop, not a one-time setup.
Put your bot up against the field
When your AI trading bot is live, enter the monthly Agentic Trading Competition. Climb a live leaderboard ranked purely by percentage return and compete for real prizes.
New to all this? Start with our agentic trading bot setup guide for the simplest path.
Frequently Asked Questions
What is an AI trading bot?
An AI trading bot is an AI model, like Claude, connected to your brokerage through a tool layer such as the Model Context Protocol (MCP). It reads live market data, applies the rules you give it, and can place trades, while you control its limits and watch its performance.
What is the Robinhood MCP?
MCP, the Model Context Protocol, is an open standard that lets an AI model securely use external tools. The Robinhood MCP gives Claude a set of tools to read quotes, positions, and historicals and to place orders, all through one connection instead of custom code.
What are skill files and why do they matter?
Skill files are instruction files that tell Claude how to behave: your strategy rules, risk limits, position sizing, and the exact steps to follow. Good skill files are what turn a general chatbot into a disciplined, repeatable trading bot.
Do I need to know how to code?
You do not need to be a developer. Connecting an MCP is mostly configuration, and skill files are written in plain language. Some comfort with the command line and reading your bot's output helps, but you are guiding Claude with instructions, not writing a trading engine from scratch.
How do I backtest a strategy before going live?
Backtesting means replaying your strategy rules over historical price data to see how it would have performed. You measure win rate, average gain and loss, and worst drawdown. If the numbers do not hold up on past data, refine the rules before risking real money.
Does ThetaPal place trades for me?
No. ThetaPal connects through a secure, read-only sync. It tracks every trade your bot makes and shows your real percentage return, but it never places orders and never moves your money.
Ready to build your AI trading bot?
Connect the MCP, write your skill files, backtest your edge, and track every trade in one place. ThetaPal is free to start.