{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pruviq-com/json-schema/pruviq-com-simulation-response-schema.json",
  "title": "SimulationResponse",
  "description": "시뮬레이션 결과",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pruviq-com-openapi.json#/components/schemas/SimulationResponse",
  "properties": {
    "provenance": {
      "anyOf": [
        {
          "$ref": "#/$defs/ExecutionProvenance"
        },
        {
          "type": "null"
        }
      ]
    },
    "strategy": {
      "type": "string",
      "title": "Strategy"
    },
    "direction": {
      "type": "string",
      "title": "Direction"
    },
    "params": {
      "additionalProperties": true,
      "type": "object",
      "title": "Params"
    },
    "market_type": {
      "type": "string",
      "title": "Market Type"
    },
    "total_trades": {
      "type": "integer",
      "title": "Total Trades"
    },
    "wins": {
      "type": "integer",
      "title": "Wins"
    },
    "losses": {
      "type": "integer",
      "title": "Losses"
    },
    "win_rate": {
      "type": "number",
      "title": "Win Rate"
    },
    "total_return_pct": {
      "type": "number",
      "title": "Total Return Pct"
    },
    "profit_factor": {
      "type": "number",
      "title": "Profit Factor"
    },
    "avg_win_pct": {
      "type": "number",
      "title": "Avg Win Pct"
    },
    "avg_loss_pct": {
      "type": "number",
      "title": "Avg Loss Pct"
    },
    "max_drawdown_pct": {
      "type": "number",
      "title": "Max Drawdown Pct"
    },
    "max_consecutive_losses": {
      "type": "integer",
      "title": "Max Consecutive Losses"
    },
    "total_fees_pct": {
      "type": "number",
      "title": "Total Fees Pct"
    },
    "profit_factor_ci": {
      "anyOf": [
        {
          "$ref": "#/$defs/MetricCI"
        },
        {
          "type": "null"
        }
      ]
    },
    "sharpe_ci": {
      "anyOf": [
        {
          "$ref": "#/$defs/MetricCI"
        },
        {
          "type": "null"
        }
      ]
    },
    "sharpe_window_days": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sharpe Window Days"
    },
    "sharpe_annualized_below_one_year": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sharpe Annualized Below One Year"
    },
    "mc_p_value": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Mc P Value"
    },
    "mc_percentile": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Mc Percentile"
    },
    "total_funding_pct": {
      "type": "number",
      "title": "Total Funding Pct",
      "default": 0.0
    },
    "funding_uncovered": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Funding Uncovered",
      "default": []
    },
    "funding_missing": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Funding Missing",
      "default": []
    },
    "tp_count": {
      "type": "integer",
      "title": "Tp Count"
    },
    "sl_count": {
      "type": "integer",
      "title": "Sl Count"
    },
    "timeout_count": {
      "type": "integer",
      "title": "Timeout Count"
    },
    "sharpe_ratio": {
      "type": "number",
      "title": "Sharpe Ratio",
      "default": 0.0
    },
    "sortino_ratio": {
      "type": "number",
      "title": "Sortino Ratio",
      "default": 0.0
    },
    "calmar_ratio": {
      "type": "number",
      "title": "Calmar Ratio",
      "default": 0.0
    },
    "coins_used": {
      "type": "integer",
      "title": "Coins Used"
    },
    "top_n_requested": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Top N Requested",
      "description": "The top_n this run resolved to. null for explicit symbols= requests (no top-N universe)."
    },
    "eligible_universe": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Eligible Universe",
      "description": "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": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Universe Capped",
      "description": "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."
    },
    "coins_missing_data": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Coins Missing Data",
      "description": "min(top_n_requested, eligible_universe) - (selected coins with at least one candle inside start_date..end_date). Counts selected coins with no complete candle up to the cutoff AND coins whose candles all fall outside the requested window (those stay in coins_used, so this can exceed min(top_n_requested, eligible_universe) - coins_used). null for symbols= requests."
    },
    "data_range": {
      "type": "string",
      "title": "Data Range"
    },
    "equity_curve": {
      "items": {
        "$ref": "#/$defs/EquityPoint"
      },
      "type": "array",
      "title": "Equity Curve"
    },
    "btc_hold_return_pct": {
      "type": "number",
      "title": "Btc Hold Return Pct",
      "default": 0.0
    },
    "btc_hold_curve": {
      "items": {
        "$ref": "#/$defs/EquityPoint"
      },
      "type": "array",
      "title": "Btc Hold Curve",
      "default": []
    },
    "coin_results": {
      "items": {
        "$ref": "#/$defs/CoinResult"
      },
      "type": "array",
      "title": "Coin Results",
      "default": []
    },
    "yearly_stats": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Yearly Stats",
      "default": []
    },
    "rolling_sharpe": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Rolling Sharpe",
      "default": []
    },
    "best_trade_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Best Trade Pct"
    },
    "worst_trade_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Worst Trade Pct"
    },
    "exposure_time_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Exposure Time Pct"
    },
    "direction_breakdown": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Direction Breakdown"
    },
    "monthly_stats": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Monthly Stats",
      "default": []
    },
    "start_sensitivity": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Start Sensitivity",
      "default": []
    },
    "regime_performance": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Regime Performance"
    },
    "trades": {
      "items": {
        "$ref": "#/$defs/TradeItem"
      },
      "type": "array",
      "title": "Trades",
      "default": []
    },
    "trades_total": {
      "type": "integer",
      "title": "Trades Total",
      "default": 0
    },
    "trades_truncated": {
      "type": "integer",
      "title": "Trades Truncated",
      "default": 0
    },
    "ruin_index": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ruin Index"
    },
    "ruin_trade": {
      "anyOf": [
        {
          "$ref": "#/$defs/RuinTrade"
        },
        {
          "type": "null"
        }
      ]
    },
    "scope_disclosure": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object",
      "title": "Scope Disclosure",
      "description": "Population coverage is separate from sample/reliability warnings.",
      "readOnly": true
    },
    "reliability_checks": {
      "items": {
        "$ref": "#/$defs/ReliabilityCheck"
      },
      "type": "array",
      "title": "Reliability Checks",
      "description": "축별 판정 레코드 — 이 응답의 «판정 SSoT». reliability_warning 은 파생물.\n\n⚠ `verdict` 는 세 값이다. `not_evaluated` 를 «통과»로 세면 0거래 응답이\n「4개 축 통과」로 읽힌다 — 그 축들은 실행조차 안 됐다.",
      "readOnly": true
    },
    "reliability_warning": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reliability Warning",
      "description": "계약은 build_reliability_warning 한 곳이 소유한다(룰3).",
      "readOnly": true
    }
  },
  "type": "object",
  "required": [
    "strategy",
    "direction",
    "params",
    "market_type",
    "total_trades",
    "wins",
    "losses",
    "win_rate",
    "total_return_pct",
    "profit_factor",
    "avg_win_pct",
    "avg_loss_pct",
    "max_drawdown_pct",
    "max_consecutive_losses",
    "total_fees_pct",
    "tp_count",
    "sl_count",
    "timeout_count",
    "coins_used",
    "data_range",
    "equity_curve",
    "scope_disclosure",
    "reliability_checks",
    "reliability_warning"
  ],
  "$defs": {
    "CoinResult": {
      "properties": {
        "symbol": {
          "type": "string",
          "title": "Symbol"
        },
        "trades": {
          "type": "integer",
          "title": "Trades"
        },
        "wins": {
          "type": "integer",
          "title": "Wins"
        },
        "losses": {
          "type": "integer",
          "title": "Losses"
        },
        "win_rate": {
          "type": "number",
          "title": "Win Rate"
        },
        "profit_factor": {
          "type": "number",
          "title": "Profit Factor"
        },
        "total_return_pct": {
          "type": "number",
          "title": "Total Return Pct"
        },
        "avg_pnl_pct": {
          "type": "number",
          "title": "Avg Pnl Pct"
        },
        "tp_count": {
          "type": "integer",
          "title": "Tp Count"
        },
        "sl_count": {
          "type": "integer",
          "title": "Sl Count"
        },
        "timeout_count": {
          "type": "integer",
          "title": "Timeout Count"
        }
      },
      "type": "object",
      "required": [
        "symbol",
        "trades",
        "wins",
        "losses",
        "win_rate",
        "profit_factor",
        "total_return_pct",
        "avg_pnl_pct",
        "tp_count",
        "sl_count",
        "timeout_count"
      ],
      "title": "CoinResult",
      "description": "Per-coin simulation result in portfolio backtest."
    },
    "EngineRun": {
      "properties": {
        "parameters": {
          "additionalProperties": true,
          "type": "object",
          "title": "Parameters",
          "description": "Bound run_fast arguments, including defaults. Fee/slippage are per-side fractions; SL/TP are fractions."
        },
        "strategy_parameters": {
          "additionalProperties": true,
          "type": "object",
          "title": "Strategy Parameters"
        },
        "strategy_config": {
          "additionalProperties": true,
          "type": "object",
          "title": "Strategy Config",
          "description": "All public instance attributes of the strategy as constructed (superset of strategy_parameters)"
        },
        "data": {
          "$ref": "#/$defs/FrameSnapshot"
        }
      },
      "type": "object",
      "required": [
        "parameters",
        "strategy_parameters",
        "data"
      ],
      "title": "EngineRun"
    },
    "EquityPoint": {
      "properties": {
        "time": {
          "type": "string",
          "title": "Time"
        },
        "value": {
          "type": "number",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "time",
        "value"
      ],
      "title": "EquityPoint"
    },
    "ExecutionProvenance": {
      "properties": {
        "schema_version": {
          "type": "string",
          "const": "1.0.0",
          "title": "Schema Version",
          "default": "1.0.0"
        },
        "engine_commit": {
          "type": "string",
          "pattern": "^[0-9a-f]{40}$",
          "title": "Engine Commit"
        },
        "started_at": {
          "type": "string",
          "format": "date-time",
          "title": "Started At"
        },
        "measured_at": {
          "type": "string",
          "format": "date-time",
          "title": "Measured At"
        },
        "request": {
          "additionalProperties": true,
          "type": "object",
          "title": "Request",
          "description": "Validated request with defaults before engine normalization"
        },
        "coins": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Coins"
        },
        "data_snapshot_id": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$",
          "title": "Data Snapshot Id"
        },
        "selection": {
          "items": {
            "$ref": "#/$defs/SelectedFrame"
          },
          "type": "array",
          "title": "Selection"
        },
        "runs": {
          "items": {
            "$ref": "#/$defs/EngineRun"
          },
          "type": "array",
          "title": "Runs"
        },
        "funding": {
          "items": {
            "$ref": "#/$defs/FundingSnapshot"
          },
          "type": "array",
          "title": "Funding"
        },
        "margin": {
          "items": {
            "$ref": "#/$defs/MarginSnapshot"
          },
          "type": "array",
          "title": "Margin",
          "description": "Liquidation maintenance-margin inputs used (leverage>1 runs)"
        }
      },
      "type": "object",
      "required": [
        "engine_commit",
        "started_at",
        "measured_at",
        "request",
        "coins",
        "data_snapshot_id",
        "selection",
        "runs",
        "funding"
      ],
      "title": "ExecutionProvenance"
    },
    "FrameColumn": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "dtype": {
          "type": "string",
          "title": "Dtype"
        }
      },
      "type": "object",
      "required": [
        "name",
        "dtype"
      ],
      "title": "FrameColumn"
    },
    "FramePeriod": {
      "properties": {
        "start": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Start"
        },
        "end": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "End"
        }
      },
      "type": "object",
      "required": [
        "start",
        "end"
      ],
      "title": "FramePeriod"
    },
    "FrameSnapshot": {
      "properties": {
        "snapshot_id": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$",
          "title": "Snapshot Id"
        },
        "rows": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Rows"
        },
        "columns": {
          "items": {
            "$ref": "#/$defs/FrameColumn"
          },
          "type": "array",
          "title": "Columns"
        },
        "row_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "title": "Row Hash"
        },
        "pandas_version": {
          "type": "string",
          "title": "Pandas Version"
        },
        "period": {
          "$ref": "#/$defs/FramePeriod"
        }
      },
      "type": "object",
      "required": [
        "snapshot_id",
        "rows",
        "columns",
        "row_hash",
        "pandas_version",
        "period"
      ],
      "title": "FrameSnapshot"
    },
    "FundingSnapshot": {
      "properties": {
        "symbol": {
          "type": "string",
          "title": "Symbol"
        },
        "available": {
          "type": "boolean",
          "title": "Available"
        },
        "rows": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rows"
        },
        "snapshot_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Snapshot Id"
        }
      },
      "type": "object",
      "required": [
        "symbol",
        "available"
      ],
      "title": "FundingSnapshot"
    },
    "MarginSnapshot": {
      "properties": {
        "symbol": {
          "type": "string",
          "title": "Symbol"
        },
        "mmr": {
          "type": "number",
          "title": "Mmr"
        },
        "source": {
          "type": "string",
          "title": "Source"
        },
        "tiers_sha256": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tiers Sha256"
        },
        "fallback_mmr": {
          "type": "number",
          "title": "Fallback Mmr"
        },
        "taker_fee_buffer": {
          "type": "number",
          "title": "Taker Fee Buffer"
        }
      },
      "type": "object",
      "required": [
        "symbol",
        "mmr",
        "source",
        "fallback_mmr",
        "taker_fee_buffer"
      ],
      "title": "MarginSnapshot"
    },
    "MetricCI": {
      "properties": {
        "unit": {
          "type": "string",
          "title": "Unit"
        },
        "point": {
          "type": "number",
          "title": "Point"
        },
        "lo": {
          "type": "number",
          "title": "Lo"
        },
        "hi": {
          "type": "number",
          "title": "Hi"
        },
        "ci_pct": {
          "type": "number",
          "title": "Ci Pct"
        },
        "n_input": {
          "type": "integer",
          "title": "N Input"
        },
        "n_resamples": {
          "type": "integer",
          "title": "N Resamples"
        },
        "n_used": {
          "type": "integer",
          "title": "N Used"
        },
        "no_loss_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "No Loss Pct"
        }
      },
      "type": "object",
      "required": [
        "unit",
        "point",
        "lo",
        "hi",
        "ci_pct",
        "n_input",
        "n_resamples",
        "n_used"
      ],
      "title": "MetricCI",
      "description": "지표 하나의 부트스트랩 신뢰구간.\n\n★ `unit` 이 **값으로** 있는 이유 (Q-B29 A, 2026-08-29):\n각 지표의 CI 는 «그 헤드라인이 실제로 쓰는 입력» 을 재표집해야 한다.\n    profit_factor  ← 거래별 gross P/L        → unit=\"trades\"\n    sharpe_ratio   ← 일별 수익률 × √365      → unit=\"daily_returns\"\n거래를 재표집해 Sharpe CI 를 내면 **화면의 그 Sharpe 가 아니다.** 그런데\n틀려 보이지 않는다 — 실측(BTCUSDT rsi<30 long, 176거래): 헤드라인 −0.91,\n거래 축 CI −4.78~0.29 로 **헤드라인이 구간 안에 들어간다.** 라벨도 «Sharpe\nCI», 숫자 모양도 맞고 점추정도 구간 안이다. 축만 다르다.\n⇒ 라벨이 스스로 축을 말하게 한다. 소비자는 이 값을 «무엇을 몇 번 재표집한\n  CI 인가» 문구에 그대로 쓴다(룰4 스코프 라벨)."
    },
    "ReliabilityCheck": {
      "properties": {
        "axis_id": {
          "type": "string",
          "enum": [
            "trades",
            "ruin",
            "sample",
            "leverage",
            "diversification"
          ],
          "title": "Axis Id"
        },
        "verdict": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not_evaluated"
          ],
          "title": "Verdict"
        },
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Value"
        },
        "threshold": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Threshold"
        },
        "message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Message"
        }
      },
      "type": "object",
      "required": [
        "axis_id",
        "verdict"
      ],
      "title": "ReliabilityCheck",
      "description": "신뢰 판정 **한 축의 레코드**. 판정은 여기 «데이터»로 산다.\n\n2026-08-31 온리원 토론: 판정 결과가 데이터가 아니라 **문장**으로 살아서\n① 통과·미평가가 응답에 **존재하지 않고**(실패만 join 하니 나머지는 `None`)\n② 프론트가 그 문자열을 `startsWith(\"Small sample\")` · `!includes(\" · \")` 로\n   **파싱**하고 ③ 화면에서 「전부 통과」·「필드 안 옴」·「이 경로에 컴포넌트\n없음」이 **한 픽셀**이 됐다. 세 결함의 공통 뿌리는 «판정의 표현»이다.\n\n`verdict` 가 **세 값**인 것이 이 모델의 핵심이다 — `not_evaluated` 가 없으면\n0거래 응답에서 나머지 4축이 «통과»로 읽힌다(실제로는 실행조차 안 된다)."
    },
    "RuinTrade": {
      "properties": {
        "symbol": {
          "type": "string",
          "title": "Symbol"
        },
        "entry_time": {
          "type": "string",
          "title": "Entry Time"
        },
        "exit_time": {
          "type": "string",
          "title": "Exit Time"
        },
        "table_row": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Table Row"
        },
        "rows_shown": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rows Shown"
        }
      },
      "type": "object",
      "required": [
        "symbol",
        "entry_time",
        "exit_time"
      ],
      "title": "RuinTrade",
      "description": "The trade at which capital reached zero (Q-H1218). ruin_index counts trades in realisation (exit) order;\na trade table listed in entry order shows a different row at position N, so the trade is named, not only numbered."
    },
    "SelectedFrame": {
      "properties": {
        "snapshot_id": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$",
          "title": "Snapshot Id"
        },
        "rows": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Rows"
        },
        "columns": {
          "items": {
            "$ref": "#/$defs/FrameColumn"
          },
          "type": "array",
          "title": "Columns"
        },
        "row_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "title": "Row Hash"
        },
        "pandas_version": {
          "type": "string",
          "title": "Pandas Version"
        },
        "period": {
          "$ref": "#/$defs/FramePeriod"
        },
        "symbol": {
          "type": "string",
          "title": "Symbol"
        }
      },
      "type": "object",
      "required": [
        "snapshot_id",
        "rows",
        "columns",
        "row_hash",
        "pandas_version",
        "period",
        "symbol"
      ],
      "title": "SelectedFrame"
    },
    "TradeItem": {
      "properties": {
        "symbol": {
          "type": "string",
          "title": "Symbol"
        },
        "direction": {
          "type": "string",
          "title": "Direction"
        },
        "entry_time": {
          "type": "string",
          "title": "Entry Time"
        },
        "exit_time": {
          "type": "string",
          "title": "Exit Time"
        },
        "entry_price": {
          "type": "number",
          "title": "Entry Price",
          "default": 0.0
        },
        "exit_price": {
          "type": "number",
          "title": "Exit Price",
          "default": 0.0
        },
        "pnl_pct": {
          "type": "number",
          "title": "Pnl Pct"
        },
        "pnl_usd": {
          "type": "number",
          "title": "Pnl Usd",
          "default": 0.0
        },
        "exit_reason": {
          "type": "string",
          "title": "Exit Reason"
        },
        "bars_held": {
          "type": "integer",
          "title": "Bars Held"
        },
        "mfe_pct": {
          "type": "number",
          "title": "Mfe Pct",
          "default": 0.0
        },
        "mae_pct": {
          "type": "number",
          "title": "Mae Pct",
          "default": 0.0
        }
      },
      "type": "object",
      "required": [
        "symbol",
        "direction",
        "entry_time",
        "exit_time",
        "pnl_pct",
        "exit_reason",
        "bars_held"
      ],
      "title": "TradeItem"
    }
  }
}