Using Claude to Build an AI Trading Bot

L-Dog

Executive Member
Joined
Oct 25, 2017
Messages
6,403
Reaction score
3,196
TLDR - Bascially trying to build a trading bot that improves itself over time. Using a few models and they all share their wins and losses end of each week so in theory should impove over time. Below the long summary from claude and my frustration from AI has turned into anticipation of what it could become.


A few months ago I couldn't open a terminal. This week I have four different AI models trading real money against each other — and against me — on live exchanges, with a system that referees the whole thing around the clock.

I'm not a software engineer, and I want to say that up front, because the interesting part of this story isn't the code. It's that someone with no background built this by basically refusing to stop asking an AI "okay — now what?" Here's how it actually went.

Part 1 — Starting from absolutely nothing​



First, I needed Linux. Everything I read said the tooling lived there, and I'm on a Windows machine. So my very first move was installing WSL — a full Ubuntu Linux running inside Windows. First time I'd ever seen a command line that wasn't in a movie. I broke it twice before it would boot. That's the honest starting line: a black window, a blinking cursor, and no idea what to type.


Then, Claude in a browser tab — and a lot of copy-paste. I didn't start with anything clever. I had Claude open in a browser and I just… talked to it. I'd describe what I wanted, it would write the code, and I'd copy it, paste it into a file, run it, watch it break, copy the error, and paste that back. That was the entire loop for the early days. Slow, clumsy, every beginner mistake there is — but piece by piece, a thing started to exist.


Then I installed Claude Code, and everything changed. This is the version that runs *in the terminal* and can read and write the files itself, run the commands, and see the errors directly. Suddenly the copy-paste ping-pong was gone. Instead of being a slow messenger between the AI and the computer, the AI was *at* the computer. I could say "the report is missing funding rates — add them and restart it," and it would go read the code, make the change, run it, and tell me what happened. That's the moment a toy started becoming a system.


1782150580327.png



Part 2 — The report: where it started vs where it is now​


The bot began life as a simple report. Once a day it posted a little summary to me on Telegram. The first ones were almost funny in how basic they were — a price, a percentage, a one-line "looks bullish." That was it.

It grew. Every time I noticed it was missing something, I added it. A funding rate here. ETF flows there. Then whale positioning, prediction-market odds, a market-regime read. It compounded. Today it runs four times a day, pulls in around twenty live data feeds — almost all of them free or read straight off the exchanges — and it doesn't just *describe* the market, it makes decisions and acts on them.


1782150598170.png



The live one-pager — posted to Telegram four times a day

Part 3 — The idea that made it fun: four traders, one ring​


Here's where it stopped being "a bot" and became a competition. Instead of trusting one AI, I gave four different traders the exact same market intelligence and let each decide independently.


1782150629408.png



Qwen — Alibaba's open-weight Qwen 3.5 (9B), running locally on my own GPU through Ollama. Paper-trades only. Costs nothing per call. The control.

OpenClaw — Anthropic's Claude Haiku 4.5. Trades live on Hyperliquid.

Hermes — xAI's Grok 4.3. Trades live on GRVT.

Me — a human, trading by hand on Extended. The benchmark everything else is measured against.


The point of using *different* models — a local Qwen, a Claude, a Grok — is that they fail differently. When three unrelated AIs from three different labs independently land on the same trade, that agreement actually means something.


Every cycle, each brain runs the same six steps:

1782150639850.png




That last step — reconciliation — is the part nobody warns you about, and it's most of the work. Your database thinks it's in charge, and it's wrong. The exchange fires stops on its own and closes positions while your code is asleep. A huge amount of the build is just machinery to keep the bot's beliefs honest about what actually happened on the exchange.

And the bit that surprised me most: it's almost free​


I assumed running three AI models around the clock would be the expensive part. It isn't. The local model costs nothing because it runs on a GPU I already own, and the two paid models are small, fast ones called a handful of times a day. The entire AI bill — every report, every scan, every trade decision across all four brains — comes in under $10 a month. These are real figures pulled straight from the bot's own cost log, not an estimate:



1782150648128.png




Part 4 — The challenge: one week in​



The live competition has only been running for about a week. Everyone started with the same stake. Real money, real fills, one shared scoreboard:

1782150656204.png



Week 1 scoreboard — every brain started at $500



The human is still winning. One week in, on a sample small enough that I won't pretend it's destiny — but it points at exactly the right questions, and those questions became the week-1 upgrades.


What week 1 taught me — and what I changed​



I read the post-mortem on every single losing trade. Three patterns jumped out, and each one turned into a fix:


The losses were bad *timing*, not bad *analysis*. Over and over, a model was right about direction but entered too early — it bought the breakout *before* the breakout, then bled out waiting for a move that hadn't happened yet. The fix: every brain now has to label a trade CONFIRMED (the edge is real right now → trade it) or AWAITING (the edge depends on something that hasn't fired yet → send it to a watch-list, don't auto-fire into hope).


Confidence was a lie. The trades the models were *most* sure about weren't winning more often — and because position size scaled with confidence, the cockiest calls were quietly the biggest losers. The fix: every model now gets shown its own track record by confidence level, so it can see that its 9-out-of-10 calls aren't actually beating its 6s.


It was fighting the tape. Most machine losses were longs into a falling market. The fix: a market-regime read now sits in front of every decision — not as a hard veto, but as context, so a weak bet *against* a clear trend gets blocked while a genuinely strong reversal still gets through.


None of these are "make the AI smarter." They're "make the AI honest about what it actually does." That's been the whole theme of the project.

Where it's at​


It's a week old as a competition and a few months old as a system — built by someone who started by installing Linux for the first time and copy-pasting code out of a browser. The infrastructure is deliberately boring: one Linux box, one database file, Telegram as the remote control. All the interesting risk lives in the strategy, not in whether the thing stays up.


Right I am beating the machines. That's not the failure of the project — it's the most useful result it could possibly produce, because it tells me exactly where these models are still weak and what to fix next.

Still running. Still losing to me. For now.
 
Amazing actually and thanks for sharing. Keep us posted
 
Would the real strength of AI not be volume?

In that it could make multiple trades that a human could never watch themselves and so make more money on average?

Either way very interesting post.
 
Would the real strength of AI not be volume?

In that it could make multiple trades that a human could never watch themselves and so make more money on average?

Either way very interesting post.

Yeah could be seen a few posts where people made bots that scalp 5-10$ profit trades and lots of them. Might test after I have a month of proper data. Also busy testing hermes so I have signed up to 10 crypto news letters and now I also want to get it into x integration where it can read lots of posts and hopefully try pic up trends and momentum but lets see how it goes. At the moment the biggest factor is still market direction if I can get the bots to be profitable in a choppy market or one that trends down its will be goal achieved.
 
Someone has done this before. In fact many people have learned that technical analysis is astrology for finance bros.

My first office was was first occupied by Mike Sassin, who sold JSE graphing software.

When his investors didn’t win on their own he offered to invest on their behalf.

Classic ponzi-scheme. He’s probably out by now.

All I know is that I needed a replacement door.
 
Interesting, though too many variables at play for a true comparison imo

I get the part about wanting to compare different models, but why different tool sets as well? e.g. Openclaw vs Hermes, Hyperliquid vs GRVT

are they all running on identical instructions btw?
 
Yeah could be seen a few posts where people made bots that scalp 5-10$ profit trades and lots of them. Might test after I have a month of proper data. Also busy testing hermes so I have signed up to 10 crypto news letters and now I also want to get it into x integration where it can read lots of posts and hopefully try pic up trends and momentum but lets see how it goes. At the moment the biggest factor is still market direction if I can get the bots to be profitable in a choppy market or one that trends down its will be goal achieved.
Integrating with external sources like x is extremely risky - AI has a fundamental flaw in that it's susceptible to prompt injection.

AI models don't separate command from data - they process the data they are reading the same as if you were giving them a command so it's possible for an attacker to inject instructions into a web page, X post, Email, etc and make your bot follow those.

The most common form of attack is to ask the bot to share secrets with the attacker so always assume any credentials your bot is using are compromised.

Even the best input sanitisations are only about 98% effective (will let through 1 in 50 attacks).

Here is an article about how a crypto chat bot was duped by morse code:

The key learnings are you need to be very careful when give a bot permission to process transactions - especially when the bot is reading from untrusted sources. You should have a human-in-the-loop to authorise the transactions. The bot should be running under a limited account where they can propose, but not act and a human needs to authorise. That way, even if the credentials are stolen, an attacker cannot directly act on it.
 
Interesting, though too many variables at play for a true comparison imo

I get the part about wanting to compare different models, but why different tool sets as well? e.g. Openclaw vs Hermes, Hyperliquid vs GRVT

are they all running on identical instructions btw?

Was testing out hermes vs openclaw will probably go with hermes long term but currently they just perform insructions but openclaw does have a soul/personality so there is a small difference. The Hype vs Grvt is just the different platforms and a bit of airdrop farming. Hyperliquid has the most liquidity so will probably be the long term solution.

The real big difference is the model (Anthropic vs Xai) - Probably not a 100% fair comparison but will try tweak and run a competition / sample every month.

Integrating with external sources like x is extremely risky - AI has a fundamental flaw in that it's susceptible to prompt injection.

AI models don't separate command from data - they process the data they are reading the same as if you were giving them a command so it's possible for an attacker to inject instructions into a web page, X post, Email, etc and make your bot follow those.

The most common form of attack is to ask the bot to share secrets with the attacker so always assume any credentials your bot is using are compromised.

Even the best input sanitisations are only about 98% effective (will let through 1 in 50 attacks).

Here is an article about how a crypto chat bot was duped by morse code:

The key learnings are you need to be very careful when give a bot permission to process transactions - especially when the bot is reading from untrusted sources. You should have a human-in-the-loop to authorise the transactions. The bot should be running under a limited account where they can propose, but not act and a human needs to authorise. That way, even if the credentials are stolen, an attacker cannot directly act on it.

Agreed there are various risks remember one person launched a trading bot on x and it had something to do with a lobster and someone also tricked it into sending it all its money becuase its family member was attacked by a lobster or something rediculous. Currently my bots have sub account and cant withraw or transfer any capital only make trades. The idea with x is just to pull more "live" data and follow key prominent news / track emerging trens.

I set this up with hermes yesterday so not part of the report or data set the agents analyse yet.


1782188360193.png
 
I am sure it’s a fun project, and you will learn about bunch of cool things putting this together, but trading off signals successfully needs a ton of statistics, machine learning, and an understanding of market dynamics.

Please don’t put a lot of money in there. At best it will lean long and follow an index. More likely you will trade on signals more advanced systems know are bad, and you will lose money.
 
Was testing out hermes vs openclaw will probably go with hermes long term but currently they just perform insructions but openclaw does have a soul/personality so there is a small difference
also find myself preferring Hermes more for a variety of tasks, Hermes and Openclaw both have soul/personality though?

here's my local Hermes set to 'pirate', telling me where to find SOUL.md ...

1782192766051.png

PS: somewhere on my todo list is an intent to do something very similar to you, will follow this thread, I'm more of a mindset to focus on longer term swing trades with human in the middle and a goal of maximising something other than the fiat value of a trade, should be interesting to do nonetheless
 
also find myself preferring Hermes more for a variety of tasks, Hermes and Openclaw both have soul/personality though?

here's my local Hermes set to 'pirate', telling me where to find SOUL.md ...

View attachment 1916541

PS: somewhere on my todo list is an intent to do something very similar to you, will follow this thread, I'm more of a mindset to focus on longer term swing trades with human in the middle and a goal of maximising something other than the fiat value of a trade, should be interesting to do nonetheless


Ahh ok have two versions of hermes, one inside my project and the other I have insatlled on the side just running a few cron jobs. Will need to do some experimiting with Hermes and set it up properly.
 
I am sure it’s a fun project, and you will learn about bunch of cool things putting this together, but trading off signals successfully needs a ton of statistics, machine learning, and an understanding of market dynamics.

Please don’t put a lot of money in there. At best it will lean long and follow an index. More likely you will trade on signals more advanced systems know are bad, and you will lose money.

Fair enough, there are obviously companies and professional who do this with much more resources and data but the amount of free information /data available is astounding. In 2021-2022 people were paying $1000 a month subs for certain data sets now all that information and more is available freely. Gap will never close completely but its shrinking every year and crypto is still the wild west so lots of opportunities and risks.
 
Fair enough, there are obviously companies and professional who do this with much more resources and data but the amount of free information /data available is astounding. In 2021-2022 people were paying $1000 a month subs for certain data sets now all that information and more is available freely. Gap will never close completely but it’s shrinking every year and crypto is still the wild west so lots of opportunities and risks.
The gap isn’t shrinking, it’s growing. Those who do this well are making more than ever. Even with $100m of funding you would battle to get anything to work. They key thing is that they figure out the signals and trade them, which means that the signals get traded out of the market. What’s left is noise, or things that look like signals but will leave you holding the bag.
 
Small update after week 1, was travelling and not focused on my trades. Made some bad trades chasing volume and swing trades and got rekt.

Upgrades/Fixes made last week:

🛡️ Anti-hallucination guard — the model once quoted an entry ~2× off the market (LIT $3.10 vs real $1.54). Bots now auto-abort any trade whose claimed entry drifts >10% from the live venue price. Only validated trades hit the book.

🎯 Confirmed vs Awaiting — 9 of the premature entries (setup never triggered).Low-conviction counter-trend ideas now go to a watchlist, not the order book.

🆕 Catalyst engine — the tradeable universe was ~36 major coins. Now fresh Binance/Coinbase/Upbit
listings, token unlock schedule.

📡 New data feeds — on-chain flows (positioning, cross-venue funding gaps,a macro/TradFi overlay. Qwen went from ~5 data blocks to real coverage on the alts it trades.

⚙️ Smarter risk — a false "daily-loss" halt was blocking new trades while my open shorts were actually winning. Split it into two gates (outcomes now scored from real exchangeP&L, not recorded price.)

🔧 Reliability — fixed GRVT profit-lock trailing stops (silently failing), capped a GPU inference wedge (480s→300s) that was killing report gest.

3 AI models (Claude, Grok, local Qwe learning from the whole fleet's wins and losses. Week 2 is live.


1782763515435.png
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X