2026-12-04 · The Spera team
Build and Backtest a Trading Strategy With Claude or ChatGPT
How to backtest a trading strategy with ChatGPT or Claude using an MCP server, so results come from a real engine on real candles instead of a guess in chat.
TL;DR
- A chat assistant on its own cannot backtest anything. It has no candles, no execution engine, and no way to check its own claims, so any "backtest result" it types is a guess.
- The Model Context Protocol (MCP) lets Claude, ChatGPT, Cursor, and other apps call tools on an outside service. Connect Spera over MCP and your assistant can create a strategy graph, compile it, backtest an exact revision, and read back the trades, all inside your Spera account.
- The connector has no tool for deploying a bot, reading exchange API keys, or moving money. Those are missing from the server, not switched off.
- A backtest describes one window of history. Before you trust it, run a deep backtest and the Edge Report checks. The figures come from Spera's engine, not from the assistant.
- Start at spera.bot/mcp, pick your app, approve once, restart, and ask.
Why doesn't "just ask ChatGPT for a strategy" work?
Ask any capable model for a trading strategy and you will get something that reads well, often with a confident line about how it "historically performs." That line is the problem.
There are three separate failures here, and they stack.
It can't run the strategy on real data. A model in a plain chat has no price history for your symbol and timeframe, no fill model, no fees or slippage. Even when it can write code, it does not have your market data or an engine that matches how the strategy would actually execute. So it is not measuring anything.
It fills the gap with plausible numbers. Language models produce likely-sounding text. Ask for a Sharpe ratio and you will get one. Nothing ties that number to a run, so you can't tell an invented result from a measured one by reading it.
It can't grade itself. Even with real results, a model that built a strategy is a poor judge of whether the strategy has an edge. It has every incentive in the conversation to call the work a success. The questions that matter, such as whether the result survives data the strategy never saw or whether random entries would have done as well, need tests the model can't run in chat.
The fix is not a better prompt. The assistant needs real tools, run on real data by something other than itself, and results it can't rewrite.
What is MCP, in one paragraph?
The Model Context Protocol is an open standard for connecting AI applications to outside systems. Its own documentation compares it to a USB-C port for AI apps: one standard plug, so an assistant like Claude or ChatGPT can reach data sources and tools without a custom integration for each one (modelcontextprotocol.io). A service exposes an MCP server; your AI app connects to it; you approve access; and from then on the assistant can call that service's tools for you. Both Anthropic and OpenAI document how their products connect to remote MCP servers. OpenAI's page also warns that custom servers carry security and prompt-injection risks, which is a good reason to check exactly what a trading connector can do before you connect it.
How does the Spera connector work?
Spera runs a remote MCP server. Once connected, your assistant works inside your Spera account. It is not a separate sandbox or a copy of your data. Whatever it creates is in your workspace, and you can open it in the Strategy Builder and look.
What the assistant can do
- Find and read your strategies, modules, and custom nodes.
- Create and edit them, then compile to confirm the graph is valid. Every strategy write compiles, so a successful call means the graph builds, not just that it was saved.
- Backtest an exact revision, quick or deep, and read back trades, equity, and metrics.
- Run the Edge Check on a finished deep backtest.
- Write project knowledge and artifact documentation, cited to real results.
It also follows guided workflows, such as building a strategy, running a backtest, or delivering a finished strategy with its evidence. Each workflow covers the steps, not just the goal: which revision to pin, what evidence to attach, and when to stop and ask you rather than guess.
The assistant reads the node catalog and exact node schemas before writing a graph, so it builds with node types that exist rather than invented ones. It pins an exact revision before editing. If the strategy changed since it last read it, the edit is rejected instead of overwriting your work.
What the assistant cannot do
The connector never trades
There is no tool for deploying a bot, starting live trading, reading your exchange API keys, or moving money. Those tools do not exist on the server, so no phrasing reaches them. It also cannot reach anyone else's account.
This is the main design choice. Spera is meant as a proving ground for AI trading agents: the agent can build and test as much as you like, and turning a strategy into a running bot stays a step you take yourself, in the Spera app.
How do you connect Claude, ChatGPT, or Cursor?
You need a free Spera account first, because the connector works in your account. Then use the picker on spera.bot/mcp, which has a button or command for each app. The steps below summarize Connect your assistant; check there if anything looks different in your app.
If your app asks for a URL, use the whole thing, including the query string:
https://api.spera.bot/mcp?mode=authoringWithout ?mode=authoring the assistant connects with read-only access. It will list your
strategies, then fail with a permissions error the first time it tries to save an edit. The
one-click buttons and the published plugins already include it.
ChatGPT
Spera is a published ChatGPT plugin, so there is no URL to paste.
- Open the Spera plugin from Open Spera in ChatGPT on spera.bot/mcp?client=chatgpt.
- Choose Connect, sign in to Spera, and approve the permissions.
- Start a new chat. A chat that was open before you connected won't see Spera.
Claude (claude.ai and Claude Desktop)
- Copy the URL above. The Open Claude button on spera.bot/mcp?client=claude copies it for you.
- Open Settings → Connectors (in Claude Desktop, Customize → Connectors).
- Choose Add custom connector, paste the URL, and confirm.
- Sign in to Spera and approve the permissions.
- Quit and reopen Claude.
Claude Code takes the same server from a terminal. The exact commands, including the
--scope user flag that keeps Spera available in every project, are in
Connect your assistant.
Cursor
- Use Install in Cursor on spera.bot/mcp?client=cursor, or install the Spera plugin from cursor.directory.
- Approve the Spera sign-in when it opens.
- Fully quit and reopen Cursor.
Restart after approving
Approving creates a grant, and a grant obtained partway through a running session does not attach to that session. The app may report success while the conversation still behaves as signed out. Fully quitting and reopening fixes most "it said it worked but nothing happened" reports. Then ask something simple to confirm the connection:
What Spera projects do I have?
What does a real session look like?
Here is the shape of a build-and-test session. The prompts are the kind of thing you can type. The results depend on your strategy and the market, so none are shown here.
1. Describe the strategy precisely
Build me an EMA(20)/EMA(50) crossover on BTCUSDT 1h. Long when the fast crosses above the slow, flat otherwise, 2% stop loss.
Be specific about thresholds and direction. "Buy when oversold" is ambiguous; "buy when RSI crosses below 30" is a rule. If you have several projects and the request could fit more than one, the assistant has to stop and ask which one you mean. Creating a new strategy needs no existing project.
2. The assistant builds and compiles
It reads the node catalog, creates the strategy graph, and compiles it. If the compile fails, it gets diagnostics back and repairs the graph in place. You may see a round or two of this. The result appears in chat as a strategy card showing what the strategy reads, when it acts, and what it does.
3. Run a quick backtest
Backtest that over 2024 and show me the drawdown.
The backtest is bound to an exact revision, so the result always names the code that produced it. In apps that show cards (Claude, ChatGPT, Cursor, and VS Code), you get a result card with the equity curve against buy and hold, plus return, max drawdown, and trade count. Terminal clients such as Claude Code and Codex show the same result as text.
4. Make it show its receipts
This is the step people skip. Ask:
Which revision did you test, and did it compile clean?
Show me the trades behind that drawdown.
A real answer names a revision and a compile receipt and can page through the actual trades. If the assistant can't point at them, treat the claim as unverified. See What to ask for for more follow-ups like these.
5. Branch instead of overwriting
That drawdown is too deep. Branch it, try a 1% stop and an ATR filter, then backtest both over the same window and show them side by side.
Branching keeps the original intact so the comparison means something. Then ask the assistant to confirm both runs used the same symbol, timeframe, and date range. Changing the window between runs is the easiest way to make a variant look better than it is.
6. Open it in the builder
Everything the assistant made is in your account. Open the strategy in the Spera Strategy Builder, read the graph node by node, and confirm it does what you meant. The assistant built it; checking it is still your job.
Why does an agent's strategy still need out-of-sample checks?
A quick backtest answers one question: what would this rule have done on this stretch of history? It can't tell you whether that stretch was representative or flattering. A strategy tuned in conversation, where an assistant can try variant after variant in minutes, is especially likely to fit the past and nothing else.
That's why a quick backtest never rises above "Past data only" on Spera's trust ladder. Moving up takes a deep backtest, which carries five of the eight Edge Report checks: the out-of-sample check, walk-forward, track record, the trade-order test, and a breakdown across market conditions. The other three (random entries, shuffled market, and parameter sensitivity) run when you ask for the Edge Check. That doesn't use any of your daily backtest runs.
Is this edge real, or just this window?
Would randomly timed trades have done as well?
Does it still work one setting either side of that?
Until those three checks run, the connector reports them as not run, never as passed. An assistant that calls a strategy "validated" without them has skipped the part that decides.
Why the agent doesn't get to grade its own work
Every figure on a Spera result card comes from Spera's engine, from the run the card names, with the engine, candle count, revision, and run listed under it. The assistant writes none of those numbers, and the same result always draws the same card. The trust rung is set by which checks ran and what they found, not by how the conversation went. Card wording states what was measured and which way it moved ("return is 1.2 points lower"), never a judgment like "worse."
That split is deliberate. The assistant can build, test, and explain. Spera's engine does the measuring. You decide what the evidence is worth, and whether anything ever gets real money.
What are you approving when you connect?
When you connect, Spera's own sign-in screen lists the permissions your app asked for. A plain connection gets two read-only permissions. The authoring URL asks for eight more. Here's the full list from What you're approving:
| Permission | What it allows |
|---|---|
spera:context:read | See who you are and which projects you have |
spera:artifact:read | Read your strategies, modules, and custom nodes |
spera:artifact:write | Create and edit strategies, modules, and custom nodes; compile them |
spera:backtest:run | Start a quick or deep backtest |
spera:backtest:read | Read back trades, equity, and metrics |
spera:backtest:cancel | Stop a running backtest |
spera:knowledge:read | Read your project documents |
spera:knowledge:write | Create and revise project documents |
spera:documentation:read | Read documentation attached to an artifact |
spera:documentation:write | Write documentation attached to an artifact |
What's not on the list matters as much: no deployment permission, no exchange-credential permission, no funds permission. Each app you connect gets its own grant, scoped to your account, and removing the connector in your AI app revokes it.
FAQ
Can ChatGPT or Claude backtest a trading strategy on their own?
Not in a meaningful sense. Without real market data and an execution engine, a chat assistant can only describe a backtest, not run one. Connected to a backtesting service over MCP, it can start a real run and read back the results that service produced.
Is there an MCP server for trading?
Several services offer MCP servers. Some can place orders. Spera's is built for strategy research: it builds, compiles, backtests, and documents strategies, and it has no trading, deployment, exchange-key, or money-movement tools. You can see every tool it has in the tool reference.
Can the assistant deploy a bot or trade with my exchange account?
No. Those tools don't exist on the Spera connector, so no prompt can reach them. When you're ready, you deploy from the Spera app yourself.
Which AI apps work with Spera?
The connect page covers ChatGPT, Claude (claude.ai, Claude Desktop, and Claude Code), Cursor, Grok Bot (through your Cursor plugins), VS Code, and Codex. Any MCP client that supports streamable HTTP servers and standard OAuth can connect with the authoring URL.
Why does my assistant say it lacks permission to save?
Usually the connection was made without ?mode=authoring, so it only has read access, or the grant
was made before a permission it now needs existed. Remove the Spera connector, add it again with
the full URL, approve, and restart the app.
Does a good backtest mean the strategy will make money?
No. A backtest describes the past under stated assumptions. Even a strategy that passes every Edge Report check can lose money going forward. The checks tell you whether a result is fragile, not whether it will continue.
Not financial advice
This guide explains how to use software to build and test trading strategies. It is not investment advice, and nothing here is a recommendation to buy or sell anything. Backtests are simulations of past data, and past performance does not predict future results. Trading crypto carries a high risk of loss. Only trade with money you can afford to lose.
Next steps
- Connect your assistant from the Spera MCP page.
- Read what the connector is and what you're approving before you connect.
- Use What to ask for for prompts that work.
- New to backtesting? Start with how to backtest a crypto trading strategy.