Why a crypto trading bot should never place its own orders. Position size, not the signal, decides who survives.
Bitcoin fell below $56,000 on 21 November and the Fear & Greed Index hit 6. Weeks like that are when bots blow up, and it is rarely because the signal was wrong. We ran one strategy at different position sizes: the edge that grew an account 2.4× at 2% a trade lost 87% of it at 20%.
In short
- A trading bot should split deciding from doing. The strategy proposes a trade; a separate risk gate decides whether it is allowed, how big it can be, and logs why.
- In 20,000 simulated paths, a strategy with a real edge of +0.1R a trade grew a median 2.4× at 2% risk per trade and shrank to 0.13× at 20%. Same signals, same trades.
- With no edge, size decides how much you lose: a median 0.88× at 2% a trade, 0.05× at 10%.
- Regulated firms must run these checks before any order reaches a market. Knight Capital lost more than $460 million in 45 minutes without them.
Weeks like this are when bots blow up
On 21 November Bitcoin fell below $56,000, its lowest level since September 2024, and CoinMarketCap’s Fear & Greed Index read 6, one point above its all-time low. About $1.5 billion of leveraged positions were liquidated in the previous day’s sell-off (CryptoNews).
That was mild next to 10 October 2025, when CoinGlass counted $19.13 billion liquidated in 24 hours across 1.6 million traders, nearly $17 billion of it longs (Decrypt). In our own data, Hyperliquid alt perps fell 50–80% within four hours that day, while the same coins’ Kraken marks fell 22–44%.
And sometimes the venue is the problem. After the $6.3 billion Binance hot-wallet theft on 29 October, Binance suspended deposits and withdrawals the next day and resumed them in phases from 1 November (Tangem).
None of these is a signal problem. A strategy that is right on average still has to survive the hours when it is wrong, and the venue it trades on still has to be working. That job belongs to something other than the strategy.
The pattern: strategies propose, a gate decides
In most retail bots the strategy calls the exchange directly. A signal fires and an order goes out. Every safety rule lives inside each strategy, written again for the next one, and nothing looks at the whole account at once.
HYV splits that path into stages. A strategy emits an intent: a side, a size hint, a confidence and the market regime it saw. It never places an order. The risk gate checks the intent against the account, then permits it, resizes it or rejects it, and records the reason. Only a permitted intent reaches the execution layer, which uses the same interface for paper and live trading.
How an order is born in HYV
Strategies never talk to the exchange. Every intent passes the gate first.
- Position size
- Exposure
- Capital floor
- Market conditions
- System health
Rejected or resized intents are logged with the rule that fired, so every decision can be audited later.
Professional trading firms are required to work this way. In the UK and EU, the rules for algorithmic trading (RTS 6, Article 15) require price collars, maximum order values, maximum order volumes and message limits on every order before it enters the book. Article 12 requires a kill function that can cancel any or all unexecuted orders at once. In the US, the SEC’s market access rule requires controls immediately before orders reach the market.
The SEC’s case against Knight Capital shows what happens without them. On 1 August 2012, Knight’s router sent more than 4 million orders while trying to fill 212 customer orders, traded more than 397 million shares in 45 minutes, and lost more than $460 million. The SEC found that Knight lacked controls immediately before orders reached the market, and that its risk controls could not stop orders that exceeded its capital thresholds (SEC).
The five checks every order passes
The gate runs the same checks, in the same order, for every strategy. The first one to fail decides the verdict and becomes the logged reason.
- Position size. Risk per trade is capped as a share of equity, and size is computed from the stop distance, not guessed. This is the check the simulation below is about.
- Exposure. Total and per-coin limits, with correlated positions counted together. Ten altcoin longs are not ten bets: on 10 October 2025 they fell together.
- Capital floor. A drawdown limit that stops new risk once equity falls far enough. A 50% loss needs a 100% gain to recover, so the cheapest loss is the one you stop taking.
- Market conditions. Volatility, spread, depth and regime. An analysis of 0d Labs data found order-book depth within 5 bps on Hyperliquid’s long-tail perps fell about 85% in a year (TechFlow). A size that was fine a year ago can move the price today.
- System health. Data freshness, venue status, duplicate orders and order rate. In our own research pipeline, a venue that dropped out was filled with zeros, which created a fake order-book imbalance spike: exactly the kind of signal a strategy would happily trade. The gate rejects intents built on data older than its threshold, and stops sending orders to a venue that is degraded.
Above all five sits the kill switch. In HYV-BOT it applies across every running strategy at once and moves holdings into stablecoins.
Position size decides who survives: the simulation
To isolate size, we simulated one strategy and changed nothing but its bet. It wins 50% of trades, makes 1.2 times its risk on a win and loses its risk on a loss: an edge of +0.1R a trade, better than most strategies we have tested. Each path is 500 trades, there are 20,000 paths, and every size sees exactly the same sequence of wins and losses. Risk is a fixed share of current equity.
Chance of losing half the account within 500 trades
Share of 20,000 simulated paths whose drawdown reached 50% at any point, by risk per trade.
Show as a table
| Risk per trade | +0.1R edge | No edge |
|---|---|---|
| 1% | 0.0% | 1.1% |
| 2% | 2.3% | 36.7% |
| 5% | 76.7% | 98.4% |
| 10% | 100% | 100% |
| 20% | 100% | 100% |
| +0.1R edge | No edge | |||
|---|---|---|---|---|
| Risk per trade | Median account | Worst drawdown | Median account | Worst drawdown |
| 1% | 1.60× | 15% | 0.96× | 25% |
| 2% | 2.41× | 28% | 0.88× | 45% |
| 5% | 5.72× | 59% | 0.46× | 82% |
| 10% | 7.33× | 88% | 0.05× | 99% |
| 20% | 0.13× | 99.8% | 0.00× | 100% |
Account value after 500 trades as a multiple of the starting balance, and the median of each path’s worst peak-to-trough drawdown.
Past a point, more size means less money
The size that maximises long-run growth, the Kelly fraction, is 8.3% a trade for this strategy. It produced the highest median, 7.96×, but halved the account at some point in 99.7% of paths and took 80% off in 52% of them. Nobody keeps a bot running through an 80% drawdown.
Beyond Kelly, size starts destroying money. At 20% a trade the median account ends at 0.13×, and 66% of paths finish below where they started: a strategy that wins on average, sized to lose. The reason is that losses compound harder than gains. After a 20% loss you need 25% to get back; after 50%, you need 100%.
Losing streaks are normal
At a 50% win rate over 500 trades, the median longest losing streak was 8 trades, and one path in ten had 11 or more. Eight losses in a row cost 15% at 2% a trade and 57% at 10% a trade. Those streaks are not bad luck you can plan around. They are the expected path.
If the edge isn’t real
Now give the same payoff a 45.5% win rate, which makes the edge exactly zero. In our first two research notes, that is roughly what we found. At 2% a trade the median account ends at 0.88×; at 10% it ends at 0.05×. Position sizing can’t create an edge. It decides whether a strategy without one is a lesson or a wipe-out.
# Reproduce the table: fixed-fraction sizing, one set of trades for every size
import numpy as np
rng = np.random.default_rng(7)
p_win, win_r, n_trades, n_paths = 0.50, 1.2, 500, 20_000 # +0.1R a trade
draws = rng.random((n_paths, n_trades))
for p in [p_win, 1 / 2.2]: # 1/2.2 = same payoff, zero edge
wins = draws < p
for risk in [0.01, 0.02, 0.05, 0.10, 0.20]:
equity = np.cumprod(np.where(wins, 1 + win_r * risk, 1 - risk), axis=1)
peak = np.maximum.accumulate(np.maximum(equity, 1.0), axis=1)
max_dd = (1 - equity / peak).max(axis=1)
print(f"win {p:.1%} risk {risk:.0%} median {np.median(equity[:, -1]):.2f}x "
f"max DD {np.median(max_dd):.0%} halved {np.mean(max_dd >= 0.5):.1%}")
Python 3 with NumPy. Runs in a few seconds and prints every number in the chart and table.
Leverage is position size with a deadline
Leverage adds a hard stop you didn’t choose. At L times leverage, a long is liquidated after a fall of roughly 1 ÷ L, and a little sooner once maintenance margin is counted.
Fall that wipes out a leveraged long, against 10 October 2025
Approximate fall to liquidation, before maintenance margin, with the day’s four-hour altcoin moves behind.
Show as a table
| Leverage | Approximate fall to liquidation |
|---|---|
| 2× | 50% |
| 3× | 33% |
| 5× | 20% |
| 10× | 10% |
| 25× | 4% |
| 50× | 2% |
The recovery maths is why the capital floor exists. The deeper the hole, the harder the climb out:
| Loss | Gain needed to get back |
|---|---|
| 10% | 11.1% |
| 20% | 25% |
| 33% | 50% |
| 50% | 100% |
| 75% | 300% |
| 90% | 900% |
How to add a risk gate to your own bot
You don’t need our engine to use the pattern. Seven changes get most of the way:
- Make strategies return an intent, never call the exchange themselves.
- Put every rule in one gate, run in a fixed order, and log a reason for every rejection.
- Size from equity and stop distance. Position = equity × risk per trade ÷ stop distance.
- Count exposure across strategies, and treat correlated coins as one position.
- Timestamp every data point and reject intents built on data older than your threshold.
- Make orders idempotent with a client order ID, so a retry after a disconnect never doubles a position.
- Wire a kill switch that halts everything at once, and test it before you need it.
Sizing from the stop, for a $10,000 account risking 1% with a stop 4% below entry:
$10,000 × 1% ÷ 4% = $2,500 position
Stop hit: $2,500 × 4% = $100 lost, 1% of equity
A gate won’t make a weak strategy strong. Our buy-the-dip backtest lost its edge to fees, and our Hyperliquid market-making test found short-horizon signals worth under 2 bps. What a gate does is make sure the weak strategies fail small, and the good ones live long enough to matter.
Questions traders ask
What is a risk gate in a trading bot?
A separate layer between a strategy and the exchange. The strategy proposes a trade; the gate checks position size, exposure, drawdown, market conditions and system health, then permits, resizes or rejects it and logs the reason. The strategy never places orders itself.
How much should a trading bot risk per trade?
In our simulation of a strategy with a +0.1R edge, risking 1–2% of equity a trade kept the chance of halving the account within 500 trades at 0–2.3%; at 5% it rose to 77%. Real edges are usually smaller than backtests suggest, which argues for sizing well below the Kelly fraction.
What is the Kelly criterion in trading?
The bet size that maximises long-run growth: f* = p − (1 − p) ÷ b, where p is the win rate and b the ratio of the average win to the average loss. For a 50% win rate and a 1.2 payoff it is 8.3% a trade. In our simulation, full Kelly halved the account at some point in 99.7% of paths.
What is a kill switch in algorithmic trading?
One control that stops every strategy at once. UK and EU rules for algorithmic trading firms (RTS 6, Article 12) require the ability to cancel any or all unexecuted orders immediately. HYV-BOT’s kill switch applies across every running strategy and moves holdings into stablecoins.
Why do trading bots get liquidated in crashes?
Leverage. At L times leverage a long is liquidated after a fall of roughly 1 ÷ L, and sooner once maintenance margin is counted. On 10 October 2025, CoinGlass counted $19.13 billion of positions liquidated in 24 hours.
Run a strategy against the gate
HYV-BOT paper-trades your strategy on live market data. Every intent passes the risk gate first, fees are counted in every result, and your funds stay on your own exchange. Paper trading is free.
Method notes
- Simulation: 20,000 paths of 500 trades, NumPy generator seed 7. Each trade wins 1.2R with probability p and loses 1R otherwise: p = 0.50 for the +0.1R edge, p = 1/2.2 ≈ 0.4545 for no edge. Risk is a fixed share of current equity. Both cases and all sizes use the same random draws. No fees or slippage, which would make every row worse.
- Kelly fraction: f* = p − (1 − p) ÷ b = 0.50 − 0.50 ÷ 1.2 ≈ 8.3%.
- Liquidation distances are 1 ÷ leverage for an isolated long and ignore maintenance margin and fees, so real liquidation comes earlier.
- 10 October 2025 moves: our Hyperliquid four-hour candles and Kraken hourly marks for liquid altcoins listed on both venues.
This is research, not investment advice. Simulations and backtests are hypothetical; they use assumed returns and past prices, and past results don’t predict future ones. Leveraged crypto trading can lose more than a position’s margin.
Sources
- CryptoNews — Bitcoin’s decline continues: Fear and Greed Index drops to 6 (21 November 2026)
- Decrypt — record $19 billion in crypto liquidations (10 October 2025, CoinGlass data)
- Tangem — Binance hack 2026: how attackers stole $6.34B
- SEC — Knight Capital charged with violations of the market access rule (2013)
- Delegated Regulation 2017/589 (RTS 6), Article 15: pre-trade controls
- Delegated Regulation 2017/589 (RTS 6), Article 12: kill functionality
- TechFlow — Hyperliquid order book depth shrinks 85% (11 November 2026)