Crypto/stock backtester
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
.
Built with ♥ on Thu Dec 19 18:43:28 UTC 2024 by a Ubuntu Plucky Puffin (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.44% average profit over 65 trades.
Time | Token | Open | Close | Hours | Profit |
---|---|---|---|---|---|
2024-12-18 14:00:00 | Kraken-SOL-GBP | 170.14 | 155.66 | 28 | -8.5% |
2024-12-18 14:00:00 | Binance-SOL-EUR | 205.96 | 188.04 | 28 | -8.7% |
2024-12-18 14:00:00 | Coinbase-SOL-GBP | 170.17 | 155.77 | 28 | -8.5% |
2024-12-17 09:00:00 | Coinbase-LTC-EUR | 112.62 | 116.16 | 8 | 3.1% |
2024-12-17 09:00:00 | Kraken-LTC-EUR | 112.08 | 116.06 | 8 | 3.5% |
2024-12-17 09:00:00 | Binance-LTC-EUR | 112.29 | 116.16 | 8 | 3.4% |
2024-12-17 09:00:00 | Coinbase-LTC-GBP | 92.82 | 96.01 | 8 | 3.4% |
2024-12-15 05:00:00 | Kraken-ATOM-GBP | 7.05 | 7.52 | 5 | 6.6% |
2024-12-14 07:00:00 | Kraken-ETC-EUR | 32.11 | 31.44 | 67 | -2.1% |
2024-12-13 18:00:00 | Kraken-BCH-EUR | 507.13 | 500.66 | 67 | -1.3% |
2024-12-13 18:00:00 | Coinbase-BCH-GBP | 421.80 | 436.51 | 55 | 3.5% |
2024-12-08 18:00:00 | Kraken-ENS-EUR | 38.65 | 36.27 | 15 | -6.1% |
2024-12-08 18:00:00 | Kraken-APT-EUR | 13.56 | 12.71 | 15 | -6.3% |
2024-12-08 17:00:00 | Coinbase-ATOM-EUR | 9.48 | 8.84 | 16 | -6.7% |
2024-12-08 17:00:00 | Kraken-RAY-EUR | 4.72 | 4.43 | 19 | -6.2% |
2024-12-08 17:00:00 | Coinbase-LTC-GBP | 104.59 | 97.24 | 16 | -7.0% |
2024-12-05 10:00:00 | Kraken-AXS-EUR | 8.83 | 9.10 | 36 | 3.1% |
2024-12-05 09:00:00 | Kraken-ZEC-EUR | 66.57 | 69.28 | 9 | 4.1% |
2024-12-05 01:00:00 | Coinbase-LTC-EUR | 122.45 | 126.37 | 10 | 3.2% |
2024-12-03 11:00:00 | Kraken-FARM-EUR | 53.90 | 58.41 | 1 | 8.4% |
2024-12-03 09:00:00 | Kraken-ENS-EUR | 38.92 | 41.48 | 16 | 6.6% |
2024-12-02 19:00:00 | Kraken-ETC-EUR | 31.24 | 32.27 | 2 | 3.3% |
2024-12-02 19:00:00 | Kraken-BCH-EUR | 490.21 | 505.96 | 2 | 3.2% |
2024-12-02 19:00:00 | Coinbase-BCH-EUR | 487.13 | 506.31 | 2 | 3.9% |
2024-11-29 16:00:00 | Coinbase-ETC-GBP | 25.06 | 25.84 | 11 | 3.1% |
2024-11-26 19:00:00 | Coinbase-AAVE-GBP | 136.52 | 141.27 | 3 | 3.5% |
2024-11-26 07:00:00 | Kraken-NEAR-EUR | 6.19 | 5.78 | 4 | -6.6% |
2024-11-21 03:00:00 | Kraken-BCH-GBP | 346.85 | 368.88 | 1 | 6.4% |
2024-11-20 12:00:00 | Kraken-EGLD-EUR | 28.49 | 26.65 | 15 | -6.5% |
2024-11-20 11:00:00 | Binance-EGLD-EUR | 28.64 | 26.76 | 16 | -6.6% |
2024-11-20 11:00:00 | Coinbase-UNI-EUR | 8.58 | 8.85 | 27 | 3.2% |
2024-11-20 10:00:00 | Kraken-GNO-EUR | 243.95 | 252.00 | 31 | 3.3% |
2024-11-20 07:00:00 | Coinbase-ATOM-GBP | 4.99 | 5.19 | 3 | 4.0% |
2024-11-20 05:00:00 | Binance-DOT-EUR | 5.46 | 5.69 | 4 | 4.0% |
2024-11-18 06:00:00 | Coinbase-ICP-GBP | 7.21 | 7.45 | 12 | 3.3% |
2024-11-18 06:00:00 | Binance-APT-EUR | 11.31 | 12.07 | 51 | 6.7% |
2024-11-15 13:00:00 | Kraken-BCH-GBP | 336.41 | 346.97 | 20 | 3.1% |
2024-11-15 13:00:00 | Binance-BNB-EUR | 588.63 | 593.56 | 67 | 0.8% |
2024-11-15 13:00:00 | Coinbase-BCH-EUR | 406.57 | 419.98 | 21 | 3.3% |
2024-11-15 05:00:00 | Kraken-KP3R-EUR | 23.77 | 26.77 | 12 | 12.6% |
2024-11-14 23:00:00 | Kraken-SOL-EUR | 200.05 | 207.29 | 23 | 3.6% |
2024-11-14 17:00:00 | Kraken-FARM-EUR | 40.18 | 36.43 | 13 | -9.3% |
2024-11-13 14:00:00 | Coinbase-DOT-EUR | 4.96 | 4.58 | 25 | -7.7% |
2024-11-13 14:00:00 | Kraken-DOT-EUR | 4.95 | 4.58 | 25 | -7.5% |
2024-11-13 00:00:00 | Kraken-LPT-EUR | 10.78 | 9.96 | 4 | -7.6% |
2024-11-12 21:00:00 | Binance-LTC-EUR | 71.34 | 74.04 | 30 | 3.8% |
2024-11-11 16:00:00 | Kraken-RAY-EUR | 5.05 | 4.75 | 8 | -6.0% |
2024-11-11 14:00:00 | Binance-LINK-EUR | 13.08 | 13.51 | 2 | 3.3% |
2024-11-11 14:00:00 | Coinbase-LINK-GBP | 10.82 | 11.30 | 3 | 4.4% |
2024-11-11 14:00:00 | Coinbase-LINK-EUR | 13.07 | 13.53 | 2 | 3.5% |
2024-11-11 14:00:00 | Coinbase-UNI-GBP | 6.91 | 7.15 | 3 | 3.5% |
2024-11-11 05:00:00 | Coinbase-LINK-GBP | 10.83 | 11.30 | 12 | 4.3% |
2024-11-11 05:00:00 | Kraken-YFI-EUR | 6353.67 | 5947.67 | 29 | -6.4% |
2024-11-11 05:00:00 | Coinbase-UNI-EUR | 8.45 | 9.04 | 21 | 6.9% |
2024-10-26 08:00:00 | Binance-LINK-EUR | 10.32 | 10.53 | 67 | 2.1% |
2024-10-26 08:00:00 | Coinbase-LINK-EUR | 10.30 | 10.57 | 67 | 2.6% |
2024-10-25 16:00:00 | Coinbase-SOL-EUR | 159.11 | 163.89 | 53 | 3.0% |
2024-10-23 17:00:00 | Kraken-SOL-EUR | 153.95 | 160.28 | 3 | 4.1% |
2024-10-22 08:00:00 | Coinbase-RNDR-EUR | 4.85 | 4.76 | 67 | -1.7% |
2024-10-20 11:00:00 | Coinbase-RNDR-EUR | 4.88 | 5.08 | 13 | 4.1% |
2024-10-18 20:00:00 | Kraken-KP3R-EUR | 50.70 | 49.63 | 67 | -2.1% |
2024-10-16 16:00:00 | Kraken-INJ-EUR | 19.09 | 19.93 | 16 | 4.4% |
2024-10-08 16:00:00 | Kraken-RUNE-EUR | 4.58 | 4.24 | 29 | -7.5% |
2024-10-02 09:00:00 | Kraken-INJ-EUR | 19.88 | 18.24 | 10 | -8.3% |
2024-10-02 07:00:00 | Kraken-MLN-EUR | 14.38 | 14.83 | 34 | 3.1% |
Benchmarks
---------------------------------------------------------------- Benchmark Time CPU Iterations ---------------------------------------------------------------- BM_is_entry 55870 ns 55786 ns 12678 BM_is_entry2 42399 ns 42398 ns 16525 BM_to_exit 238 ns 238 ns 2947255 BM_to_exit2 248 ns 248 ns 2862819 BM_to_vwap 7508 ns 7508 ns 93125 BM_to_vwap2 7520 ns 7520 ns 93172 BM_is_recent_dip2 801 ns 801 ns 870313 BM_to_atr 65327 ns 65327 ns 10707 BM_to_atr2 2405 ns 2405 ns 291693 BM_to_atr3 2528 ns 2528 ns 275397 BM_to_average_func 0.347 ns 0.347 ns 1000000000 BM_to_average_func2 0.337 ns 0.337 ns 1000000000 BM_to_average_volume 60901 ns 60901 ns 11473 BM_to_average_volume2 1896 ns 1896 ns 370685 BM_to_size 0.510 ns 0.510 ns 1000000000 BM_to_first 0.339 ns 0.339 ns 1000000000 BM_to_last 0.332 ns 0.332 ns 1000000000 BM_to_sum 0.337 ns 0.337 ns 1000000000 BM_to_sum2 0.328 ns 0.328 ns 1000000000 BM_to_spot 0.328 ns 0.328 ns 1000000000 BM_identity 158 ns 158 ns 4433017 BM_identity2 159 ns 159 ns 4387898 BM_to_profit 0.347 ns 0.347 ns 1000000000 BM_to_time 0.338 ns 0.338 ns 1000000000 BM_to_open 0.336 ns 0.336 ns 1000000000 BM_to_high 0.343 ns 0.343 ns 1000000000 BM_to_low 0.350 ns 0.350 ns 1000000000 BM_to_close 0.335 ns 0.335 ns 1000000000 BM_to_volume 0.345 ns 0.345 ns 1000000000