Backtests

Run a single-asset backtest (sync)

Synchronous backtest run. Persistiert in backtest_runs mit user_id. Per-Endpoint-Quota: Pro 50/d, Power 500/d. Globaler Tier-Rate-Limit zählt zusätzlich. With ?montecarlo=true the response includes a montecarlo block: a trade-order block-bootstrap (5000 iterations) over the realized trades — percentile bands (P5–P95) for CAGR / max drawdown / final equity plus probability of ruin and of beating Buy & Hold. It measures how much the result depends on trade order, NOT a forecast of future prices. [API Pro tier]

post/api/v1/backtests/run

Request

  • Base URL: https://tradingstrategies.work
  • URL: https://tradingstrategies.work/api/v1/backtests/run
  • Auth: HTTP bearer

Query parameters

montecarloboolean

If true, add a Monte-Carlo robustness block (trade-order bootstrap) to the response. Needs ≥20 closed trades.

Request body

strategystring required

Strategy key from /v1/strategies.

pairstring required

e.g. BTCUSDT, ETHUSDT, SOLUSDT

asset_type'crypto' | 'tokenized_equity' | 'tokenized_etf' | 'commodities'
interval'1d' | '2d' | '3d' | '1w' | '1M' required
date_fromstring date required

YYYY-MM-DD

date_tostring date

YYYY-MM-DD (optional, default = today)

capitalnumber
paramsobject

Strategy-specific parameters.

Response

Backtest result with summary + persisted run id. The summary result carries two win-rate metrics: win_rate (per entry/exit decision — counts profitable exits AND accretive re-entries, i.e. buying back below the last sell = accumulating more of the asset) and roundtrip_win_rate (per closed round-trip — share of USD-profitable closed exits only; null when no closed round-trips). max_drawdown is bar-exact (mark-to-market intra-trade, not only at trade points). result.net_cagr is the CAGR after per-side trading costs (K3-B); gross cagr stays canonical. Optional montecarlo block when ?montecarlo=true.

Changes

No recorded changes to this operation across all 1 revision of this API.