Crypto backtesting
Loading...
Searching...
No Matches
Crypto/stock backtester pipeline

See my other projects: turpin.dev.

Disclaimer

Don't invest what you can't afford to lose. Illustrations are for illustrative purposes only. History is not an indicator of future performance. That said...

Overview

Historic price data are fetched daily via the Marketstack and CryptoCompare APIs, and converted to CSV format using Python; each currency pair is then analysed in C++. Finally, the table below is generated using the trade summary.

Profiling

The C++ code is profiled using gprof and visualised with gprof2dot and graphviz.

`gprof` profile

Built with ♥ on Thu Jan 22 18:40:09 UTC 2026 by a Ubuntu Questing Quokka (development branch).

Backtests

  • 446 currency pairs (from Marketstack, Coinbase, Kraken, Binance)
  • 3% take profit
  • 6% stop loss
  • 68 candles window size
  • 0.5 minimum ATR (normalised)
  • 4.3 minimum entry price

-0.92% average profit over 19 trades.

Time Token Open Close Hours Profit
2026-01-16 12:00:00 Kraken-ZEC-EUR 354.94 332.44 59 -6.3%
2026-01-15 12:00:00 Kraken-LTC-GBP 56.34 55.93 67 -0.7%
2026-01-07 02:00:00 Kraken-INJ-EUR 4.64 4.34 34 -6.6%
2026-01-07 02:00:00 Kraken-DASH-EUR 36.99 34.74 26 -6.1%
2025-12-11 09:00:00 Kraken-ZEC-EUR 355.01 377.49 3 6.3%
2025-12-10 22:00:00 Coinbase-UNI-EUR 4.85 4.54 18 -6.5%
2025-12-09 14:00:00 Binance-SOL-EUR 113.74 120.81 2 6.2%
2025-12-09 14:00:00 Coinbase-SOL-EUR 113.74 120.71 2 6.1%
2025-11-19 14:00:00 Coinbase-ETH-GBP 2326.37 2171.41 27 -6.7%
2025-11-19 14:00:00 Kraken-ETH-GBP 2326.54 2172.84 27 -6.6%
2025-11-19 13:00:00 Coinbase-BCH-EUR 425.82 439.77 16 3.3%
2025-11-18 14:00:00 Coinbase-UNI-GBP 5.60 5.78 2 3.3%
2025-11-18 14:00:00 Coinbase-UNI-EUR 6.35 6.60 2 4.0%
2025-11-18 04:00:00 Coinbase-UNI-EUR 6.41 6.60 12 3.1%
2025-11-17 02:00:00 Kraken-XMR-EUR 347.87 308.84 52 -11.2%
2025-11-14 21:00:00 Kraken-QNT-EUR 73.49 71.45 67 -2.8%
2025-11-11 01:00:00 Kraken-ALCX-EUR 9.02 8.42 10 -6.7%
2025-11-09 13:00:00 Kraken-ALCX-EUR 8.84 9.42 7 6.6%
2025-11-05 10:00:00 Kraken-MLN-EUR 5.37 5.57 7 3.7%

Benchmarks


----------------------------------------------------------------
Benchmark                      Time             CPU   Iterations
----------------------------------------------------------------
BM_is_entry                53236 ns        53234 ns        13023
BM_is_entry2               40099 ns        40099 ns        17401
BM_to_exit                   222 ns          222 ns      3152465
BM_to_exit2                  222 ns          222 ns      3164741
BM_to_vwap                  7673 ns         7672 ns        90957
BM_to_vwap2                 7811 ns         7804 ns        89344
BM_is_recent_dip2            890 ns          890 ns       785652
BM_to_atr                  60612 ns        60612 ns        11164
BM_to_atr2                  2616 ns         2616 ns       267876
BM_to_atr3                  2764 ns         2764 ns       256118
BM_to_average_func         0.333 ns        0.333 ns   2102908331
BM_to_average_func2        0.333 ns        0.332 ns   2095413567
BM_to_average_volume       62268 ns        62267 ns        11390
BM_to_average_volume2       1991 ns         1991 ns       354191
BM_to_size                 0.510 ns        0.509 ns   1359420932
BM_to_first                0.335 ns        0.335 ns   2120580644
BM_to_last                 0.332 ns        0.332 ns   2074389965
BM_to_sum                  0.330 ns        0.330 ns   2115460690
BM_to_sum2                 0.330 ns        0.330 ns   2126277823
BM_to_spot                 0.335 ns        0.335 ns   2110133657
BM_identity                  161 ns          161 ns      4360713
BM_identity2                 160 ns          160 ns      4371593
BM_to_profit               0.336 ns        0.336 ns   2045258718
BM_to_time                 0.341 ns        0.341 ns   2109519051
BM_to_open                 0.357 ns        0.357 ns   1931582695
BM_to_high                 0.354 ns        0.354 ns   1912863661
BM_to_low                  0.343 ns        0.343 ns   2076862085
BM_to_close                0.354 ns        0.354 ns   1891264140
BM_to_volume               0.335 ns        0.335 ns   1937250384