---
title: "Simulate Compare"
method: POST
path: "/simulate/compare"
---

# Simulate Compare

`POST /simulate/compare`

## Request

- Base URL: `https://api.pruviq.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.pruviq.com/simulate/compare`
- Auth: none declared

Run all strategies under identical SL/TP conditions for comparison.

## Request body

- CompareRequest: Compare all strategies under identical conditions.
  - `sl_pct` number: Stop Loss %
  - `tp_pct` number: Take Profit %
  - `max_bars` integer: Max holding period (bars)
  - `top_n` integer, nullable: Number of coins, at most 5 (null = 5). 6..535 → HTTP 400 with detail {error, max_top_n: 5, requested, alternative: "/simulate per strategy"}; above 535 → the generic 422 (detail is a list). Every call runs all strategies and more coins do not finish inside the 45 s gateway limit (Q-B55).

## Response `200`

Successful Response

- CompareResponse: Comparison across all strategies.
  - `sl_pct` number, required
  - `tp_pct` number, required
  - `max_bars` integer, required
  - `coins_used` integer, required
  - `top_n_requested` integer, nullable: The top_n this run resolved to. null for explicit symbols= requests (no top-N universe).
  - `eligible_universe` integer, nullable: Coins eligible for a top-N universe at run time (stablecoins unless include_stablecoins, non-crypto and liquidity-dead markets excluded), read in the same selection as the coins run. null for symbols= requests (and on /backtest when the strategy is invalid, is_valid=false).
  - `universe_capped` boolean, nullable: eligible_universe < top_n_requested: the request asked for more coins than exist, so the whole eligible universe ran. A cap only — coins lacking data are reported in coins_missing_data. null for symbols= requests.
  - `run_cap` integer, nullable: Q-B131: the per-request limit that actually stopped this run before min(top_n_requested, eligible_universe) coins, or null when none did (coins_used then reaches that number, data gaps aside). See run_cap_reason for which limit.
  - `run_cap_reason` 'indicator_cache' | 'compare_max_coins', nullable: Q-B131: which limit run_cap is. «indicator_cache»: the cached path of /simulate/compare, /simulate/validate and /simulate/optimize computes at most the indicator-cache size per request (no all-coin hold; larger runs are a separate async path, Q-B132). «compare_max_coins»: kept for compatibility — since Q-B55 /simulate/compare rejects a top_n above its limit (COMPARE_MAX_COINS) with HTTP 400, so this cut no longer binds. When both apply, the smaller one — the one that bound — is reported. null when no limit bound.
  - `coins_not_computed` string[]: Q-B131: explicitly requested symbols= that were not run because the per-request compute limit (the indicator-cache size) was reached. Empty when every requested symbol ran. Distinct from coins_missing_data (coins without candles in the window).
  - `data_range` string, required
  - `strategies` StrategyResult[], required
    - `strategy_id` string, required
    - `name` string, required
    - `direction` string, required
    - `status` string, required
    - `total_trades` integer, required
    - `wins` integer, required
    - `losses` integer, required
    - `win_rate` number, required
    - `total_return_pct` number, required
    - `profit_factor` number, required
    - `max_drawdown_pct` number, required
    - `tp_count` integer, required
    - `sl_count` integer, required
    - `timeout_count` integer, required
    - `equity_curve` EquityPoint[], required
      - `time` string, required
      - `value` number, required

## Other responses

- `400`: top_n above 5: detail = {error, max_top_n, requested, alternative}
- `422`: Validation Error

---

[API](https://skmtc.dev/pruviq/apis/pruviq-simulation-api.md) · [All operations](https://skmtc.dev/pruviq/apis/pruviq-simulation-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pruviq/apis/pruviq-simulation-api/revisions/972384919a74?raw)
