Building a trading bot with Claude or ChatGPT: what works and what to avoid

An engineer's guide to the three ways people use Claude, Claude Code, ChatGPT and other large language models (LLMs) in trading bots: where each helps, where each fails, how to keep a model away from unchecked orders, and what each costs at $50/hour.

The short answer

An LLM is a good assistant to a trading bot and a poor replacement for its rules.

  • As a coding assistant (Claude Code, ChatGPT, Cursor), it can write a first version of a bot in hours. The code still needs an engineer's review and testing before it handles real money.
  • As a step inside the bot, it can read text that rules cannot: news, filings, announcements, your own notes. It works best as a filter or a summary that your fixed rules then check.
  • As an agent with trading tools, it can place orders through an exchange API or a broker's MCP server. This needs the strictest limits: a separate account, small position caps, a daily loss limit and full logs.

In every case the bot automates a strategy you define. A model does not know where prices go next, it can be confidently wrong, and trading carries a real risk of loss.

Three ways to use an LLM in a trading bot

Coding assistantLLM step inside the botAI agent with trading tools
What it doesWrites, explains and refactors the bot's codeClassifies or summarises text into a signal or a flagDecides and calls tools: quotes, positions, orders
Typical toolsClaude Code, ChatGPT, CursorClaude, GPT or an open model through an APIAgent SDKs, broker or exchange MCP servers
Good forFast prototypes, boilerplate, converting a strategy between languagesNews and announcement filters, sentiment, reading reports, explaining tradesQuestions about your portfolio, assisted rebalancing, research with confirmation
Main riskCode that runs but mishandles fills, errors and restartsInconsistent answers, cost, latency, injected instructions in textA wrong decision executed at machine speed
Needs before live moneyCode review, tests, paper tradingFixed model and prompt version, forward testing, logsSeparate account, hard limits, confirmations, kill switch

A safe design: the model advises, the rules decide

  1. DataPrices, candles, order book and any text feeds, from official APIs
  2. Your rulesThe strategy you defined, in plain code that gives the same answer every time
  3. LLM stepOptional: reads text and returns a short structured answer, such as a flag or a score
  4. Risk engineHard limits the model cannot change: size caps, daily loss limit, allowed symbols, kill switch
  5. Broker or exchangeOrders through the official API, with every model input, output and order logged

The model returns data in a fixed format (for example JSON with a label and a reason), never free text that the bot executes. If the model times out or returns something invalid, the bot falls back to its rules or does nothing.

If Claude Code or ChatGPT wrote your bot: what to check

We see more AI-written bots each month. Most run in a demo and then fail in the same places. Before you trade real money, check that the bot:

  • keeps API keys out of the code and the repository, uses trade-only keys with withdrawals disabled, and restricts them by IP where the exchange allows it;
  • handles partial fills, rejected orders and orders that time out but were actually placed (no duplicate orders after a retry);
  • reads the exchange's rules for minimum order size, price and quantity steps, and rate limits, instead of guessing them;
  • rebuilds its position and open orders from the exchange after a restart, instead of trusting its own memory;
  • reconnects cleanly when a websocket drops, and alerts you when it cannot;
  • has a daily loss limit and a kill switch that work even when the strategy code has a bug;
  • was backtested with fees and slippage, without using future data, and then paper traded for long enough to see real fills.

If several of these are missing, a review is cheaper than learning about them with real money. We fix the issues in your code; we do not need to start again.

Testing an LLM signal honestly

  • Backtests can flatter a model. A model trained on data up to a certain date may already have seen the news and the price moves in your backtest period, so it can look smarter than it is. Judge an LLM step mainly on forward tests: paper trading on data that is newer than the model.
  • Fix the version. Pin the exact model version and prompt, set randomness low, and re-test whenever either changes. A model update can change answers without warning.
  • Measure it like any other rule. Compare the strategy with and without the LLM step over the same period. If it does not clearly help after costs, remove it.
  • Watch latency and cost. A model call takes from under a second to several seconds, so LLM steps suit decisions on minutes or hours, not order-book speed.

Prompt injection and other AI-specific risks

  • Text the bot reads (news, posts, web pages, token descriptions) can contain instructions aimed at the model. The model's tools must not allow anything that the risk engine would block, whatever the text says.
  • Never give a model tools for withdrawals, transfers, changing API keys or editing its own limits.
  • Log every prompt, response and resulting action, so you can see why the bot did what it did.
  • Keep a person in the loop for anything outside normal size or outside the allowed symbol list.

For broker MCP servers and agentic trading accounts, see the agentic trading section on our AI agent development page.

Cost: planning ranges at $50/hour

ProjectTypical hoursTypical cost
Review of an AI-written bot with a written report of issues10–30 h$500–$1,500
Hardening an AI-written bot: fixes, risk limits, logging, paper-trading run30–80 h$1,500–$4,000
Adding an LLM news or announcement filter to an existing bot30–60 h$1,500–$3,000
Chat assistant over your bot in Telegram or Slack ("what is my exposure?")25–50 h$1,250–$2,500
Agentic trading setup with MCP tools, limits, confirmations and logs40–100 h$2,000–$5,000
New bot with rules, LLM step, risk engine, backtest and dashboard100–200 h$5,000–$10,000

Model API usage is billed by the provider on top of hosting. For your own mix of features, use the bot cost calculator; for bots without an AI step, see trading bot development and crypto trading bot development.

How we work

  1. You describe the strategy in plain words, or send the code you already have.
  2. We write it back as a precise spec and say where an LLM step helps and where plain rules are better.
  3. We build or fix the bot, with the risk engine and logging first.
  4. Backtest with fees, then paper trade; you decide whether to go live.
  5. Code, keys and servers stay in your accounts. We sign an NDA on request.

What we do not build

  • Bots for betting, sports betting or prediction markets.
  • Meme-coin sniper bots, or bots that copy wallets to front-run launches.
  • Bots sold with promised returns, or "AI that predicts the market" claims.
  • Setups that give a model unlimited order or withdrawal access.

You are responsible for following your exchange's or broker's terms and the laws where you live, including tax and any licence needed to manage other people's money.

Questions clients ask

Can Claude build a trading bot for me?

Claude and Claude Code can write a working first version quickly, especially for a simple strategy on one exchange. What they often miss are the parts that lose money in production: partial fills, rate limits, reconnects, order size rules, duplicate orders and state after a restart. Use AI to draft the code, then have an engineer review and test it before real money is involved.

Can Claude or ChatGPT place trades on its own?

Technically yes, through an exchange API or a broker's MCP server, but we never let a model place unchecked orders. Every order a model proposes goes through a hard risk engine with position caps, a daily loss limit and a kill switch, and for agentic setups we use a separate account, small limits and confirmation for anything unusual.

Will an AI trading bot make money?

No one can promise that. A language model does not know where prices go next, and adding one to a bot adds a step that must itself be tested. The bot automates a strategy you define, and trading carries a real risk of loss.

Can you review or fix a trading bot I built with Claude Code?

Yes. We read the code, list what is missing or unsafe, and fix it: API key handling, order and position reconciliation, error handling, rate limits, logging, a kill switch and a paper-trading run. A review with a written report is usually 10 to 30 hours ($500 to $1,500) at $50 per hour.

How much does it cost to run an LLM inside a trading bot?

It depends on how often the model is called and how much text it reads each time. A bot that asks a model to classify a few news items per hour costs little; one that sends long prompts on every candle across many symbols can cost more than the server. We call the model only on events, cache results and use a smaller model where it is good enough, and we estimate the monthly API bill with you before building.

Is Claude or GPT better for a trading bot?

For writing and reviewing code, both are strong, and the result depends more on how clearly the strategy is specified and tested than on the model. For an LLM step inside the bot, we test the candidate models on your own examples, fix the model version and prompt, and pick the one that is accurate enough at a cost you accept.

Have a project that needs a reliable engineering team?

Tell us what you want to build. You will get a reply within one business day, with questions or a rough estimate.

Start a project