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 Mar 12 18:40:04 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

-4.11% average profit over 10 trades.

Time Token Open Close Hours Profit
2026-03-03 22:00:00 Coinbase-LINK-GBP 6.56 6.90 11 5.2%
2026-02-26 08:00:00 Binance-BCH-EUR 424.10 397.83 29 -6.2%
2026-02-19 13:00:00 Kraken-XMR-EUR 281.05 272.94 67 -2.9%
2026-02-19 04:00:00 Coinbase-AAVE-GBP 91.75 85.70 44 -6.6%
2026-02-09 01:00:00 Coinbase-ETC-EUR 7.26 6.80 54 -6.3%
2026-02-09 01:00:00 Coinbase-LTC-GBP 40.08 38.26 67 -4.5%
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-DASH-EUR 36.99 34.74 26 -6.1%
2026-01-07 02:00:00 Kraken-INJ-EUR 4.64 4.34 34 -6.6%

Benchmarks


----------------------------------------------------------------
Benchmark                      Time             CPU   Iterations
----------------------------------------------------------------
BM_is_entry                53276 ns        53195 ns        13027
BM_is_entry2               40279 ns        40275 ns        17410
BM_to_exit                   220 ns          219 ns      3176233
BM_to_exit2                  220 ns          220 ns      3173166
BM_to_vwap                  7596 ns         7596 ns        92239
BM_to_vwap2                 7628 ns         7628 ns        92005
BM_is_recent_dip2            887 ns          887 ns       788182
BM_to_atr                  60158 ns        60155 ns        11626
BM_to_atr2                  2583 ns         2583 ns       270214
BM_to_atr3                  2696 ns         2692 ns       259393
BM_to_average_func         0.321 ns        0.321 ns   2186982027
BM_to_average_func2        0.319 ns        0.319 ns   2220002565
BM_to_average_volume       61540 ns        61539 ns        11231
BM_to_average_volume2       1926 ns         1926 ns       364590
BM_to_size                 0.509 ns        0.509 ns   1384109591
BM_to_first                0.317 ns        0.317 ns   2208669413
BM_to_last                 0.326 ns        0.326 ns   2232054956
BM_to_sum                  0.318 ns        0.318 ns   2177982760
BM_to_sum2                 0.320 ns        0.320 ns   2190696226
BM_to_spot                 0.317 ns        0.317 ns   2203142789
BM_identity                  169 ns          169 ns      4161873
BM_identity2                 168 ns          168 ns      4163864
BM_to_profit               0.317 ns        0.317 ns   2210454674
BM_to_time                 0.323 ns        0.323 ns   2221986261
BM_to_open                 0.316 ns        0.316 ns   2225146064
BM_to_high                 0.332 ns        0.332 ns   2116467968
BM_to_low                  0.320 ns        0.320 ns   2131697943
BM_to_close                0.333 ns        0.333 ns   2156869095
BM_to_volume               0.332 ns        0.332 ns   2126944734