Strategy Backtest
Prove a strategy's edge over decades of real history — computed metrics and sample trades.
/api/backtestOverview
Run a real, rules-based historical backtest of any strategy over Yahoo daily bars (SPY back to 1993; other symbols as available) and get computed performance metrics plus the most recent sample trades. Every number is calculated from the simulated trades — never invented. All 10 strategies are backtestable: most run a single-symbol engine, Momentum Breakout runs a 42-name universe backtest, and Supertrend Market Regime is backtested as a 'trade-the-regime' rule (long SPY while RISK_ON). Metrics are decimals (0.0131 = +1.31%). Pass ?strategy=<id>; optionally ?symbol=, ?from=YYYY-MM-DD and ?to=YYYY-MM-DD to change the instrument or window.
Use it toValidate a strategy's edge over decades of real history before trusting today's signal.
Coverage
Call it
Send your ra_live_… key in the x-api-key header. Pick your language:
curl "https://raspberrytrades.com/api/backtest?strategy=triple_rsi" \
-H "x-api-key: ra_live_your_key_here"Parameters
| Parameter | Type | Description |
|---|---|---|
strategy | string | Strategy id to backtest, e.g. triple_rsi (required) |
symbol | string | Override the instrument, e.g. SPY or IWM (optional — defaults to the strategy's asset) |
from | string | Window start, YYYY-MM-DD (optional — defaults to all available history) |
to | string | Window end, YYYY-MM-DD (optional — defaults to today) |
x-api-key | header | Your API key (required) |
{
"strategy": "triple_rsi",
"symbol": "SPY",
"range": {
"requestedFrom": null,
"requestedTo": null,
"testedFrom": "1993-01-29",
"testedTo": "2026-08-05",
"barsTested": 8436
},
"metrics": {
"totalTrades": 89,
"winningTrades": 80,
"losingTrades": 9,
"winRate": 0.8989,
"averageReturn": 0.0131,
"medianReturn": 0.0132,
"bestTrade": 0.0781,
"worstTrade": -0.0737,
"averageHoldingPeriod": 4.83,
"profitFactor": 6.2147,
"totalReturn": 2.1381,
"maxDrawdown": 0.0737
},
"sampleTrades": [
{ "entryDate": "2025-12-17", "exitDate": "2025-12-19", "entryPrice": 671.4, "exitPrice": 680.59, "return": 0.0137, "holdingDays": 2 },
{ "entryDate": "2025-11-18", "exitDate": "2025-11-24", "entryPrice": 660.08, "exitPrice": 668.73, "return": 0.0131, "holdingDays": 4 }
],
"openTradeEntryDate": null
}
// A universe backtest (momentum_breakout) leaves maxDrawdown / bestYear /
// worstYear null — a pooled cross-section has no single equity curve — and
// reports pooled trade stats instead.Create a free account, copy your ra_live_… key and make your first call to https://raspberrytrades.com/api/backtest.
Keep your key on your server — never ship it in front-end code.