Claude trading bot: build and test one with Claude
A Claude trading bot is a set of trading rules that Claude, the AI assistant from Anthropic, helps you write and test. On Tactfolio, Claude builds the rules from your words and backtests them on decades of real prices. You read the result, and a saved strategy then runs on paper or in your own Alpaca account. Claude itself never places the trades.
Key points#
- You tell Claude your idea in plain words. Claude builds it in Tactfolio and runs the backtest.
- You check the rules and the numbers yourself before anything trades.
- Trade runs the saved strategy once each trading day, on paper or in your own Alpaca account.
- There are other ways to use Claude for trading. Each one has different risks, shown below.
- No AI can promise a profit, and every backtest is hypothetical.
Three ways to make a trading bot with Claude#
| Way | What Claude does | What runs the trades | Main risk |
|---|---|---|---|
| Claude with Tactfolio | Builds and backtests rules you can read, with no code | Tactfolio, once each trading day, on paper or in Alpaca | Rules that fit the past by luck |
| Claude with Alpaca’s MCP server | Sends orders when you ask in chat | Claude, during the chat | A wrong order, with no backtest first |
| Claude Code writing a bot | Writes Python that calls a broker API | Your program, on a computer you run | Bugs, and a server you must watch |
Claude with Tactfolio. Claude connects to your Tactfolio account through MCP (Model Context Protocol), a standard way for AI assistants to use outside tools. It uses the same blocks as the visual builder, so every rule is something you can open and read. The bot is the saved strategy, not the chat. It follows the same rules every day, whether or not you talk to Claude.
Claude with Alpaca’s MCP server. Alpaca offers its own MCP server. With it, Claude can check prices and send orders for stocks, ETFs, options and crypto in your Alpaca account. It runs on your own computer with your Alpaca API keys, and starts on paper by default. This makes Claude a trading helper you talk to, not a bot that runs by itself. Nothing backtests the idea first. Our list of MCP servers for trading compares it with the others.
Claude Code writing a Python bot. Claude Code is Anthropic’s coding tool. It can write a program that reads prices and sends orders through a broker’s API. You own the code, but you also own every bug. You need to test it, host it, and keep it running.
How to build a Claude trading bot on Tactfolio#
Five steps take you from one sentence to a bot running on paper.
- Connect Claude to Tactfolio. In Use Tactfolio from your AI assistant, choose Claude and press Add to Claude. Then sign in to Tactfolio in your browser. There is no API key to copy.
- Describe your rule in one sentence. Say what to hold, when to switch, and how often to check. Name your tickers and the dates to test.
- Check the rules and the backtest. Open the saved strategy in the builder. Read the tree, the worst drawdown and the costs. A drawdown is how far a portfolio falls from its last high point.
- Run it on paper first. In Trade, a paper account runs the strategy with pretend money at real prices. You get an email after each close.
- Connect Alpaca when you are ready. Add your own Alpaca account, paper or live, with your own API keys. The bot trades only the starting balance you give it.
Claude Code works the same way. Its setup is on the same page, under Claude Code.
An example prompt#
You can paste this into Claude after you connect:
Build a Tactfolio strategy that holds QQQ while it is above its 200-day moving average and holds SHY otherwise. Check it every day. Backtest it from 2007 and tell me its worst drawdown and its worst year.
Claude builds a tree with one If block. A moving average is the average price over a set time, here 200 trading days. QQQ is a fund that tracks 100 large Nasdaq stocks. SHY is a fund of short-term US Treasury bonds. Claude then runs the backtest and reports the numbers you asked for.
Next, ask the harder questions. What if trading costs were twice as high? How did it do from 2021 on, which it was not tuned on? Our trend following bot shows a tested version of a similar rule.
What Claude can and cannot do on Tactfolio#
| Claude can | Claude cannot |
|---|---|
| Build a strategy from builder blocks | Place trades or move money |
| Run backtests and compare variations | Publish a strategy for others |
| Save drafts and new revisions in your account | Change your account settings |
| Explain where a rule did worst | Promise how a rule will do next |
Stock and ETF strategies are long only. They hold funds, stocks or cash, and never sell short or borrow. They check their rules once each trading day. Claude can also build crypto strategies on Hyperliquid perps, but those are backtest and paper or testnet only.
What can go wrong with a Claude trading bot?#
The biggest risk is a rule that fits the past by luck. Claude can test many versions of an idea in a minute. The best of many past results is often just the luckiest one.
- Say why the idea should work. Ask for a reason, not only the best number.
- Keep some years back. Tune on older years, then check the winner once on recent ones.
- Ask for the bad news. Worst drawdown, worst year, and results with higher costs.
US regulators warn about bots sold with big promises. The CFTC says AI “can’t predict the future or sudden market changes.” Why past results mislead explains the traps in more detail.
Common questions#
Can Claude trade stocks for me?#
Not on Tactfolio. Claude builds and tests the strategy, and you start it in Trade yourself. Claude can place orders only if you connect it to a broker server that allows trading, such as Alpaca’s MCP server.
Is Claude good at picking stocks?#
Claude is not a stock picker, and no AI can see the future. It is good at turning a clear idea into exact rules and testing them fast. Use it to check ideas, not to find a sure thing.
Is a Claude trading bot free?#
Tactfolio has a Free plan, and every feature is free until billing opens. That includes the Claude connection, backtests and paper trading. You need your own Claude account, and an Alpaca account to trade with real money.
Does this work with ChatGPT too?#
Yes. Tactfolio works with any assistant that supports remote MCP servers with sign-in, including ChatGPT, Cursor and VS Code. See Can ChatGPT or Claude backtest a trading strategy? for how the assistants compare.
Can a Claude trading bot trade crypto?#
Claude can build and backtest crypto strategies on Hyperliquid perps, such as BTC. Those run only on paper or the Hyperliquid testnet, because real-money crypto trading is off.
Can I start from a tested strategy instead?#
Yes. Every classic strategy is live, with its rules and backtest. Copy one, ask Claude to change it, and test your copy.
Sources
- Alpaca MCP Server, Alpaca, accessed October 25, 2026
- Claude Code overview, Anthropic, accessed October 25, 2026
- Customer Advisory: AI Won’t Turn Trading Bots into Money Machines, U.S. Commodity Futures Trading Commission, accessed October 16, 2026
- Artificial Intelligence (AI) and Investment Fraud, FINRA, the SEC Office of Investor Education and Advocacy, and NASAA, accessed October 16, 2026
- Paper Trading, Alpaca, accessed October 16, 2026