Starter bot
A first trading bot you can read in one sitting. It replays recent prices, or watches the live price, and keeps a pretend account so you can see what a strategy would have done.
Plain Python 3.11 or newer. Nothing else to install. No exchange account, no keys.
It cannot place real orders. There is no code in it that could. Read the disclaimer before you change that.
Run it
Unzip it
You get a folder with four files: bot.py, config.toml, README.md and LICENSE.
Open a terminal in that folder and run
python3 bot.pyOn Windows the command is usually python bot.py.
Read the report
Strategy: momentum Market: XBTUSD Bars: 60 min Period: 27 days
Started with: $1,000.00
Ended with: $916.96 (-8.3%)
Just holding bitcoin: -25.5% <- the number to beat
Round trips: 3 won 0, lost 3
Fees paid: $22.62
Worst drop from a high point: -8.3%
Careful: 3 round trips is far too few to trust. Thirty is a bare minimum; hundreds is better.
Every trade is in trades.csv.No computer set up for this yet? Start with where to run a bot.
The control room
Every setting lives in config.toml. Change a number, save, run again. You never open the code.
[strategy]
# Pick ONE: "momentum", "ma_cross", "rsi_dip", "breakout"
use = "momentum"
[strategy.momentum]
# Buy when price has risen at least this much over the lookback. Sell when it has fallen this much.
lookback_bars = 24
buy_when_up_percent = 3.0
sell_when_down_percent = 2.0
[safety]
stop_loss_percent = 5.0 # sell if the position is down this much. 0 = off
max_trades_per_day = 4 # a runaway bot is the classic beginner disaster
The same file sets the market, the size of each price bar, the fee, how much of your pretend cash each trade uses, and whether the bot replays history or watches the live price.
What it did when we ran it
| Strategy | Result | Round trips |
|---|---|---|
| Momentum | −8.3% | 3 |
| Moving-average cross | −13.8% | 8 |
| Breakout | −14.2% | 4 |
| Buy the dip (RSI) | −20.1% | 18 |
| Just holding bitcoin | −25.5% | n/a |
Run on November 24, 2026: 27 days of hourly prices, $1,000 of pretend money, a 0.40% fee on every buy and sell. Three to eighteen trades is far too few to trust, and the bot's own report says so.
How to read a result honestly
- Holding is the number to beat. Losing less than bitcoin did in a bad month is not the same as making money.
- Count the round trips. Three trades prove nothing. Thirty is a bare minimum.
- Never set the fee to zero. Most strategies that look good with no fee lose with a real one.
- One good month is where testing starts. Try other bar sizes, and wait for new prices before you believe it.