---
title: "Simulate Optimize"
method: POST
path: "/simulate/optimize"
---

# Simulate Optimize

`POST /simulate/optimize`

## 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/optimize`
- Auth: none declared

SL/TP grid search — runs up to 36 simulations with different SL/TP pairs.

## Request body

- OptimizeRequest: SL/TP grid search request.
  - `strategy` string: Strategy ID
  - `direction` string, nullable: long | short | both
  - `sl_steps` number[]: Stop Loss values to sweep (max 6)
  - `tp_steps` number[]: Take Profit values to sweep (max 6)
  - `max_bars` integer
  - `market_type` 'futures' | 'spot'
  - `symbols` string[], nullable
  - `top_n` integer, nullable: Limit coins for speed (default 20)
  - `start_date` string, nullable
  - `end_date` string, nullable
  - `timeframe` '1H' | '2H' | '4H' | '6H' | '12H' | '1D' | '1W'
  - `metric` string: Primary metric: total_return_pct | win_rate | profit_factor | sharpe_ratio

## Response `200`

Successful Response

- OptimizeResponse: SL/TP optimization grid results.
  - `strategy` string, required
  - `direction` string, required
  - `metric` string, required
  - `sl_steps` number[], required
  - `tp_steps` number[], required
  - `grid` OptimizeCell[], required
    - `sl_pct` number, required
    - `tp_pct` number, required
    - `total_trades` integer, required
    - `win_rate` number, required
    - `profit_factor` number, required
    - `total_return_pct` number, required
    - `max_drawdown_pct` number, required
    - `sharpe_ratio` number
  - `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
  - `compute_time_ms` integer, required
  - `deflated_sharpe` DeflatedSharpeInfo: 그리드 승자의 Deflated Sharpe — 다중검정(선택 편향) 보정 (Bailey & LdP 2014). dsr > 0.95 = 시도 횟수를 고백한 뒤에도 5% 유의수준에서 우연 최댓값이 아니라는 뜻. sensitivity 는 «독립 시도 수 N 을 정확히 알 수 없다»는 논문 자신의 한계 (부록 A.3)를 제품이 스스로 공시하는 3점이다.
    - `dsr` number, required: N=grid 셀 수(전 시도 공개) 기준 DSR — 보수적 기본
    - `sharpe_annualized` number, required: 승자 셀의 연율 Sharpe (표시용 — 계산은 per-period)
    - `n_trials` integer, required: 이 그리드에서 노출된 시도 수. 개발 중 폐기된 시도는 포함되지 않음(file-drawer)
    - `n_obs` integer, required: 승자 셀의 일별 수익률 관측 수 T
    - `skew` number, required
    - `kurtosis_raw` number, required: raw 첨도 (정규분포=3)
    - `sensitivity` object, required: {N: dsr} — N 불확실성 3점 공시
    - `caveat` string

## Other responses

- `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)
