We Re-Ran a CoinQuant Bitcoin Backtest in Python, Trade by Trade

We re-coded one CoinQuant Bitcoin rule in Python from Binance daily closes, with fills at the daily close and the same 0.1% fee, and compared every trade from 1 Aug 2021 to 1 Nov 2026. 25 of the 25 trades matched on entry and exit days, and CoinQuant's 124.63% return differed from the re-run by 0.05 percentage points.
Python backtest vs AI backtest is a fair question: if an AI builds and tests a rule for you, would your own code agree? For this rule, it did. The re-run ended at $22,458.04 against CoinQuant's $22,462.83, and every entry and exit landed on the same day.
The rule also beat holding Bitcoin on the same window, 124.63% against 96.23%. This article shows the rule, the data, how we coded it, every trade next to each other and the small places the two differed. It reports the results without adjustment.
The answer first: how many trades matched
All 25 trades matched on their entry day and exit day. On 17 of the 25, the prices and fees matched too. On the other eight, one or both fill prices differed by between one cent and $6.33.
- Trades: 25 in CoinQuant, 25 in Python, the same days.
- Return: 124.63% in CoinQuant, 124.58% in Python.
- Final balance: $22,462.83 in CoinQuant, $22,458.04 in Python.
If you have checked a backtest before by adding up its trade log, this goes one step further: it rebuilds the trades themselves from exchange data. For the simpler check, see how to rebuild the return from the trade log.
The rule and the data (Binance closes, UTC days)
The rule, as typed into CoinQuant in plain English:
Enter long when the daily close crosses above the 200-day simple moving average of the close. Exit when the daily close crosses below the 200-day simple moving average. BTCUSDT spot on Binance, 1d candles, from 2021-08-01 to 2026-11-01, $10,000 starting capital, all equity in each trade, one position at a time, 0.1% fee per order.
The Python side used Binance BTCUSDT daily candles from the public Binance API, closed candles only, each day running 00:00 to 24:00 UTC. CoinQuant's data comes from Kaiko via CoinQuant.
Both sides fill at the daily close. In CoinQuant's trade log, a row stamped 9 Aug 2021 00:00 was filled at the close of 9 Aug 2021 UTC.
| Metric | SMA 200 rule | BTC Spot Comparison |
|---|---|---|
| Strategy | BTC SMA 200 Close Cross 1D Aug 2021-Nov 2026 | BTC Buy and Hold 1D Aug 2021-Nov 2026 |
| Total Return | 124.63% | 96.23% |
| Final Balance | $22,462.83 | $19,622.82 |
| Total Trades | 25 | 1 |
| Win Rate | 24.00% | n/a (single hold) |
| Profit Factor | 2.57 | n/a |
| Sharpe Ratio | 0.61 | 0.51 |
| Max Drawdown | 36.13% | 76.63% |
| Total Fees | $734.36 | $29.63 |
Both runs share the same window, capital, sizing and fee. With 25 trades, the results card marks the rule "Statistically inconclusive": 25 trades, and it needs 50+ to rate.
Python backtest vs AI backtest: how we coded it, standard Python only
The re-run is one short script of about 70 lines, using only the Python standard library: no backtesting framework and no pandas. It does five things.
- Load closes: download BTCUSDT daily candles from the Binance API, starting in December 2020 so the 200-day average is ready by 1 Aug 2021.
- Average: compute the 200-day simple moving average of the close for each day.
- Signal: enter when the previous day's close was at or below its average and that day's close is above it; exit on the reverse.
- Fill and fee: fill at that day's close, put all equity into the trade and charge 0.1% on the entry and on the exit.
- Close out and compare: close any open trade on 1 Nov 2026, then line up each trade with CoinQuant's saved orders.
That is the whole rule. Nothing in the script reads CoinQuant's signals: it only reads the saved orders at the end, to compare.
Trade by trade: dates, prices, fees
25 of 25 trades matched on entry and exit days
Every trade, as both sides recorded it:
| No. | Entry day (UTC) | Exit day (UTC) | Same days | Same prices and fees |
|---|---|---|---|---|
| 1 | 2021-08-09 | 2021-08-12 | Yes | Yes |
| 2 | 2021-08-13 | 2021-08-17 | Yes | Yes |
| 3 | 2021-08-19 | 2021-09-10 | Yes | Yes |
| 4 | 2021-09-12 | 2021-09-13 | Yes | Yes |
| 5 | 2021-09-14 | 2021-09-20 | Yes | Exit fill differs |
| 6 | 2021-10-01 | 2021-12-13 | Yes | Yes |
| 7 | 2021-12-14 | 2021-12-17 | Yes | Both fills differ |
| 8 | 2021-12-21 | 2021-12-28 | Yes | Entry fill differs |
| 9 | 2023-01-13 | 2023-08-17 | Yes | Yes |
| 10 | 2023-08-29 | 2023-08-30 | Yes | Both fills differ |
| 11 | 2023-10-16 | 2024-07-04 | Yes | Exit fill differs |
| 12 | 2024-07-13 | 2024-08-03 | Yes | Yes |
| 13 | 2024-08-23 | 2024-08-26 | Yes | Exit fill differs |
| 14 | 2024-09-24 | 2024-09-25 | Yes | Yes |
| 15 | 2024-09-26 | 2024-09-30 | Yes | Yes |
| 16 | 2024-10-14 | 2025-03-09 | Yes | Exit fill differs |
| 17 | 2025-03-12 | 2025-03-13 | Yes | Yes |
| 18 | 2025-03-14 | 2025-03-16 | Yes | Yes |
| 19 | 2025-03-19 | 2025-03-20 | Yes | Yes |
| 20 | 2025-03-23 | 2025-03-28 | Yes | Yes |
| 21 | 2025-04-22 | 2025-10-17 | Yes | Yes |
| 22 | 2025-10-19 | 2025-10-22 | Yes | Entry fill differs |
| 23 | 2025-10-23 | 2025-10-30 | Yes | Yes |
| 24 | 2025-10-31 | 2025-11-03 | Yes | Yes |
| 25 | 2026-08-19 | 2026-11-01 | Yes | Yes (end of test) |
The last trade was still open on 1 Nov 2026, so both sides closed it at the end of the test.
The two orders of the earliest trade are on CoinQuant's Trades tab, where each trade is two rows.

Order rows 1 and 2 of BTC SMA 200 Close Cross 1D Aug 2021-Nov 2026 on CoinQuant: the buy on 9 August 2021 and the sell on 12 August 2021, with the price and size of each order, as the Python re-run reproduced them. Times are UTC.
Where they differed and why (warm-up, rounding, fee timing)
The eight trades that did not match exactly all had the same cause: a stored daily close that differs slightly from the Binance API close. Ten fills on those eight trades differ:
| No. | Fill | Binance API close (Python) | CoinQuant fill |
|---|---|---|---|
| 5 | Exit | 43,015.62 | 43,016.63 |
| 7 | Entry | 48,343.28 | 48,336.95 |
| 7 | Exit | 46,131.20 | 46,133.83 |
| 8 | Entry | 48,889.88 | 48,889.89 |
| 10 | Entry | 27,716.34 | 27,716.35 |
| 10 | Exit | 27,299.99 | 27,300.00 |
| 11 | Exit | 57,050.01 | 57,050.02 |
| 13 | Exit | 62,834.00 | 62,834.28 |
| 16 | Exit | 80,734.37 | 80,734.31 |
| 22 | Entry | 108,642.78 | 108,643.01 |
The largest gap was $6.33, on the entry of trade 7. Four of the ten were a single cent. None changed a signal, so none moved a trade to a different day.
- Warm-up: no effect. Both sides used history before 1 Aug 2021 for the 200-day average, so both opened the first trade on 9 Aug 2021. For why a long lookback need not delay the first trade, see indicator warm-up periods.
- Rounding: the price gaps above come from small data differences, not rule differences.
- Fee timing: both charge 0.1% on each fill. Because each fee depends on the equity at the time, the price gaps carried into the fees by a few cents. For why fees and data decide whether a result is real, see backtesting data quality.
Net effect on the return: 0.05 percentage points.

The totals the re-run had to match: the Total Trades, Total Fees and Total Return rows of BTC SMA 200 Close Cross 1D Aug 2021-Nov 2026 in CoinQuant's Detailed Statistics.
AI agent backtesting vs coding it yourself
Coding it yourself gives full control and takes time: data download, signal logic, fills, fees and a check of every edge case. Our script is short because the rule is simple. A rule with stops, several indicators or a second timeframe would need far more code and testing.
Building it on CoinQuant took one plain-English description. The test above shows that, for this rule, the two approaches produce the same trades. For the wider comparison in words, see how AI agent backtesting compares to traditional backtesting. For coded research frameworks, see CoinQuant vs Backtrader and vectorized vs event-driven backtesting.
One test of one rule does not prove every result matches. It does show a way to check any result you plan to trust.
The Practical Lesson
- Same days, every trade: 25 of 25 entries and exits landed on the same day in both.
- Tiny price gaps: ten fills differed by one cent to $6.33, from the stored daily close.
- Same answer: 124.63% against 124.58%, a gap of 0.05 percentage points.
If a result matters to you, re-run one rule yourself once. On CoinQuant, an AI trading platform, you can build the rule in plain English, read every order on the Trades tab and compare it with your own code.
Build trading strategies on real data. No coding required.
Frequently Asked Questions
How does ai agent backtesting compare to traditional backtesting methods?
In our test, an AI-built CoinQuant backtest and a hand-coded Python re-run of the same Bitcoin rule matched on all 25 trades' entry and exit days, from 1 Aug 2021 to 1 Nov 2026. The returns differed by 0.05 percentage points. The AI route took one plain-English description; the coded route took a script and a data download.
Can I verify a backtest in Python?
Yes. Download the same daily closes, code the entry and exit exactly as stored, fill at the same price and charge the same fee. Then compare each trade's entry and exit day, not just the final return.
Why would two backtests of the same rule give different results?
Small data differences, such as a stored close that differs from an exchange API close by a cent, change fills slightly. Bigger gaps usually come from a different warm-up, fill price or fee setting.
Re-run this rule yourself, or test your own on the same window.
Disclaimer:
Key Takeaway