Add backtesting engine with SMA cross strategy

Reads features from Supabase, simulates SMA(3)/SMA(20) crossover signals,
and outputs P&L, drawdown, and trade logs per instrument/granularity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Brent Neale
2026-02-16 15:58:00 +10:00
co-authored by Claude Opus 4.6
parent 31c74d4e5f
commit 187ebe9a9e
5 changed files with 412 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
time,instrument,granularity,side,price,position_size,equity,drawdown
2026-02-16 03:05:00+00:00,USD_JPY,M1,BUY,153.046,100.0,10000.0,0.0
2026-02-16 03:19:00+00:00,USD_JPY,M1,FLAT,153.054,0.0,10000.01,3e-06
2026-02-16 03:34:00+00:00,USD_JPY,M1,BUY,153.057,100.0,10000.01,3e-06
2026-02-16 04:04:00+00:00,USD_JPY,M1,FLAT,153.06,0.0,10000.01,3e-06
2026-02-16 04:16:00+00:00,USD_JPY,M1,BUY,153.056,100.0,10000.01,3e-06
2026-02-16 05:09:00+00:00,USD_JPY,M1,FLAT,153.215,0.0,10000.11,2e-06
2026-02-16 05:23:00+00:00,USD_JPY,M1,BUY,153.228,100.0,10000.11,2e-06
2026-02-16 05:29:00+00:00,USD_JPY,M1,FLAT,153.184,0.0,10000.08,5e-06
2026-02-16 05:30:00+00:00,USD_JPY,M1,BUY,153.214,100.0,10000.08,5e-06
2026-02-16 05:44:00+00:00,USD_JPY,M1,FLAT,153.205,0.0,10000.08,5e-06
1 time instrument granularity side price position_size equity drawdown
2 2026-02-16 03:05:00+00:00 USD_JPY M1 BUY 153.046 100.0 10000.0 0.0
3 2026-02-16 03:19:00+00:00 USD_JPY M1 FLAT 153.054 0.0 10000.01 3e-06
4 2026-02-16 03:34:00+00:00 USD_JPY M1 BUY 153.057 100.0 10000.01 3e-06
5 2026-02-16 04:04:00+00:00 USD_JPY M1 FLAT 153.06 0.0 10000.01 3e-06
6 2026-02-16 04:16:00+00:00 USD_JPY M1 BUY 153.056 100.0 10000.01 3e-06
7 2026-02-16 05:09:00+00:00 USD_JPY M1 FLAT 153.215 0.0 10000.11 2e-06
8 2026-02-16 05:23:00+00:00 USD_JPY M1 BUY 153.228 100.0 10000.11 2e-06
9 2026-02-16 05:29:00+00:00 USD_JPY M1 FLAT 153.184 0.0 10000.08 5e-06
10 2026-02-16 05:30:00+00:00 USD_JPY M1 BUY 153.214 100.0 10000.08 5e-06
11 2026-02-16 05:44:00+00:00 USD_JPY M1 FLAT 153.205 0.0 10000.08 5e-06