How to build a crypto arbitrage bot with Claude AI and deploy it on-chain

Video: I Let Claude AI Build Me a Crypto Trading Bot (Full Guide & Insane Results)
ยท based on the channel Larry Hite
AI trading with a large language model such as Claude means using it to write, review and iterate on bot code rather than to predict prices: you describe the exchange pair, the strategy rules, the risk limits and the logging you want, and Claude returns a working scaffold you then test and harden. The fastest way to start is to take the full prompt and source code from the AI trading bot guide, run it in dry-run mode on a testnet, and only then connect a funded wallet.
What AI trading with Claude actually means
Claude is a code generator, not an oracle: it produces the bot's structure, the contract calls and the risk checks, while the edge still comes from the strategy you specify. In the build shown by Larry Hite, the model is used to turn a plain-English description of a two-venue arbitrage strategy into a runnable script โ the prompt does the heavy lifting, and the quality of the output tracks the specificity of the input. That distinction matters, because a bot that merely executes trades is worthless without a rule set that defines when a trade is worth taking.
A useful prompt for this task contains four blocks:
- Environment โ chain, language and libraries (for example Python with web3.py, or TypeScript with ethers), the DEX or aggregator being called, and whether the bot runs locally or as a hosted service.
- Strategy logic โ the exact condition that triggers a trade, such as a price divergence between two pools above a stated percentage.
- Risk limits โ maximum position size, slippage tolerance in basis points, a gas price ceiling, and a hard stop after a defined number of failed transactions.
- Output and logging โ a structured record of every quote, every submitted transaction, gas paid and realized slippage, so performance can be audited afterwards.
Ask Claude for the code in small pieces rather than one giant file: the quote function first, then the profitability check, then the swap execution, then the logger. Each piece is easier to review, and errors are cheaper to catch.
How an arbitrage bot finds and sizes a trade
The bot only trades when expected profit survives every cost: the price gap must exceed gas on both legs, swap fees on both pools, and slippage on entry and exit. A raw divergence of 0.4% between two pools looks attractive until you subtract two swap fees, two network fees and the price impact of your own order โ which is why most naive arbitrage scripts lose money slowly rather than dramatically. The sizing rule should therefore be derived from the gap, not fixed in advance: larger gaps justify larger positions, thin gaps justify none.
In practice the loop looks like this: fetch reserves from both pools, compute the implied price on each, subtract the full cost stack, and only then decide whether the residual profit clears a minimum threshold you set in the prompt. On Ethereum mainnet, a single swap can easily cost several dollars in gas during busy periods, so a bot hunting sub-1% gaps needs either a cheaper chain or a much larger position size.
Costs, gas and slippage are where most bots die
Reducing gas cost is a design decision, not an afterthought: batching calls, avoiding unnecessary approvals and setting a gas ceiling in the code all cut the drag on thin edges. A common trick is to check the current gas price before quoting at all and skip the cycle entirely when the network is congested โ no trade is better than a trade that eats its own margin. Slippage deserves the same treatment: set it in basis points, verify the received amount against the quoted amount after execution, and revert or log loudly when the difference exceeds tolerance.
Three costs are routinely underestimated:
- Approval and setup transactions, which are one-off but real, especially when a fresh wallet trades a new token pair.
- Failed transactions, which still consume gas โ a bot that retries aggressively on a losing condition burns capital without ever opening a position.
- MEV competition, where faster actors capture the same gap first; on public mempools your profitable quote can be stale by the time it lands.
Testing the bot before it touches real money
The only responsible sequence is dry run, then testnet or a forked mainnet state, then a small live position, then scale โ and each stage needs its own pass criteria. In dry-run mode the bot quotes and logs but never submits; on a fork you can replay real pool states and see whether the profitability check fires when it should. Compare the bot's simulated fills against the quotes it recorded and look for systematic gaps, because a backtest that ignores gas and slippage will always flatter the strategy.
When you do go live, start with the smallest position the exchange allows and keep the gas ceiling tight. Track three numbers daily: net profit after all fees, number of failed transactions, and average realized slippage versus the configured tolerance. If any of them drifts, stop the bot and fix the rule rather than the threshold.
Common questions from people building their first bot
Builders consistently raise the same doubts, and they are the right ones to have. The first is trust: an AI-generated script should be treated as a draft from a competent but unsupervised junior developer โ read every line that touches a private key or a token approval, and never run code you do not understand with a wallet that holds meaningful funds. The second is realism about returns: arbitrage edges are small, competitive and intermittent, so a bot that trades a few times a day at a thin margin is normal, and screenshots of large gains usually omit the losing cycles.
The third is scope. A single-pair bot on one chain is a reasonable first project; multi-chain routing, monitoring dashboards and alerting are follow-up work, not part of version one. The fourth is operational: a bot needs a process that survives restarts, a wallet with enough native token for gas, and a way to pause it quickly when the market moves against the strategy.
Where to get the full prompt and source code
The complete prompt, the bot source code and the step-by-step build walkthrough are distributed through a single resource linked from the video. Everything referenced in this article โ the prompt structure, the arbitrage logic and the cost checks โ is covered there in runnable form, which is far more useful than retyping a scaffold from a description.
- Main resource (full guide and source code): https://tr.ee/AIpKv7
Conclusion
AI trading with Claude works best when the model is treated as a fast, tireless code writer and the human stays responsible for the strategy, the risk limits and the testing discipline. The build covered by Larry Hite follows exactly that pattern: a detailed prompt produces a working arbitrage bot, and the honest part of the demonstration is the attention paid to fees, slippage and the limits of the approach. Start in dry-run mode, keep positions small, log everything, and let the numbers โ not the demo โ decide whether the bot deserves more capital. Grab the full prompt and source code and build your own version before the next market cycle moves.
Key takeaways
- Claude generates the bot's code from a single structured prompt covering the DEX pair, slippage limits, gas ceiling and profit threshold.
- Arbitrage profit exists only when the price gap between two pools exceeds gas plus swap fees plus slippage on both legs.
- The bot must be tested on a fork or testnet in dry-run mode before any real capital is committed.
- Every trade should be logged with gas paid and realized slippage so the profit-and-loss numbers stay honest.
- The full prompt and source code are distributed via https://tr.ee/AIpKv7.
Source: I Let Claude AI Build Me a Crypto Trading Bot (Full Guide & Insane Results) ยท Markdown version
Questions & answers
Can Claude AI really build a working crypto trading bot?
Yes, for the code layer: Claude can generate the quoting logic, the swap execution, the risk checks and the logging from a detailed prompt. What it cannot do is supply the edge โ you still have to define the strategy, verify the cost assumptions and test the bot before it trades real funds.
How much capital do I need to start arbitrage trading with a bot?
Enough that the expected profit on a trade exceeds gas, swap fees and slippage on both legs. On a cheap chain that can be a few hundred dollars; on Ethereum mainnet, where a single swap may cost several dollars, small positions rarely clear the cost stack and a larger balance or a cheaper network is required.
Why do so many arbitrage bots lose money despite finding price gaps?
Because the gap is measured before costs. Two swap fees, two network fees, price impact and failed transactions can exceed a sub-1% divergence, and competing bots often capture the same opportunity first. A profitability check that subtracts every cost before sizing the trade is what separates a viable bot from an expensive lesson.
What should I check before running an AI-generated bot with real money?
Read every line that handles private keys, token approvals and transfers, then run the bot in dry-run mode and on a testnet or forked mainnet state. Only after the simulated fills match expectations should you start with the smallest live position, a tight gas ceiling and daily tracking of net profit, failed transactions and realized slippage.