A crypto trading bot is mostly risk code

Most of the code in a working crypto trading bot is not the strategy, it is position sizing, failure handling and the conditions under which it stops trading, because a strategy that is right most of the time can still lose everything on the occasion it is not.

A crypto trading bot is a program that places orders according to rules. The rules are the part people write about and the smallest part of the work.

The strategy is the short part

Buy when this, sell when that. Most strategies fit in a page and many fit in a paragraph. If a bot were only its strategy it would be an afternoon's work, and the reason it is not is everything that has to be true for the strategy to run safely.

What the rest of the code does

Decides how much to risk on each position. Decides what happens when an order partially fills, or does not fill, or fills at a worse price than quoted. Decides what to do when the exchange stops responding mid-position. Decides when to stop entirely. None of that is the idea, and all of it is what separates a bot that runs from a bot that runs unattended.

The failure that costs the most

Not a wrong prediction. A bot that keeps trading through a condition it was never designed for: a stale price feed, a market halt, a fill it did not expect. A strategy being wrong loses one trade. A bot not noticing that its inputs are broken loses in a loop, quickly, and usually while nobody is watching.

What to build first

The stop. Before the strategy, before the backtest, write the conditions under which the thing turns itself off: maximum loss, maximum position, stale data, unexpected state. It is the least interesting code in the project and it is the only part that determines the worst case.

Live, right now, on this page

MarketPriceFunding24h volume
BTC$78,325.500.0013%$525,711,370
ETH$2,451.650.0013%$271,372,138
SOL$102.330.0009%$77,237,120
HYPE$84.06-0.0003%$16,731,388

Read from a live market as this page rendered, through a public endpoint that needs no key. Read at 2026-09-01 14:43 UTC; accurate as of that time and not afterwards.

Describe something and watch it get built.

Open the builder, or start from a working app and change it.

Live market pages