> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quantdesk.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Quantitative Backtesting Engine

> QuantDesk backtesting lifecycle: historical oracle dataset catalog, simulation queue, deploy gate verification, and StrategyCardSchema.

# Quantitative Backtesting Engine

QuantDesk provides an integrated, verifiable **backtesting and strategy simulation engine**. Algorithmic traders can test momentum, mean-reversion, and arbitrage strategies against granular historical oracle datasets with explicit friction models (exchange fees, dynamic slippage, and Solana priority fees).

<CardGroup cols={3}>
  <Card title="Historical Datasets" icon="database">
    High-resolution tick-level candle feeds with Pyth oracle benchmark history.
  </Card>

  <Card title="Deploy Gate Verification" icon="shield-check">
    Mathematically validates out-of-sample Sharpe, max drawdown, and Deflated Sharpe Ratio.
  </Card>

  <Card title="Verified Flex Proofs" icon="award">
    Generates cryptographic StrategyCardSchema bundles for trustless track record sharing.
  </Card>
</CardGroup>

***

## The Backtest Lifecycle

```mermaid theme={null}
flowchart LR
  DS["Oracle Dataset\nCatalog"] --> SIM["Simulation Engine\n(Friction Models)"]
  SIM --> METRICS["Performance Metrics\n(Sharpe, Sortino, DSR)"]
  METRICS --> GATE{"Deploy Gate\nCheck"}
  GATE -- Pass --> BUNDLE["StrategyCard\nDeploy Bundle"]
  GATE -- Fail --> REJECT["Rejection Notice\n(High Overfitting Risk)"]
  BUNDLE --> LIVE["Paper / Live\nOrder Execution"]
```

***

## Backtest REST Endpoints

Base path: `/api/v2/backtest`. Interactive parameter schemas are available in OpenAPI (`/api/docs/`).

<AccordionGroup>
  <Accordion title="GET /api/v2/backtest/datasets" icon="list">
    Browse available historical datasets. Each dataset entry returns `dataset_id`, symbol, timeframe resolution, and date coverage.
  </Accordion>

  <Accordion title="POST /api/v2/backtest/runs" icon="play">
    Submits a backtest job for queuing and execution.

    ```bash theme={null}
    curl -s -X POST \
      -H "Authorization: Bearer $QD_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "dataset_id": "SOL-PERP-1M-2026",
        "strategy_type": "mean_reversion",
        "parameters": {
          "lookback": 20,
          "z_score_entry": 2.0,
          "max_leverage": 5
        },
        "friction": {
          "maker_fee_bps": 2,
          "taker_fee_bps": 5,
          "slippage_bps": 10
        }
      }' \
      "$QD_API/api/v2/backtest/runs" | jq .
    ```

    <Warning>
      **Friction Required**: Zero-friction backtests are strictly rejected by the gateway. Realistic fee and slippage models are mandatory to prevent overfitted curves.
    </Warning>
  </Accordion>

  <Accordion title="GET /api/v2/backtest/runs/:id" icon="chart-pie">
    Fetches the completed manifest and computed quantitative metrics for a run:

    * Annualized Return & Volatility
    * Sharpe & Sortino Ratios
    * Maximum Peak-to-Trough Drawdown
    * **Deflated Sharpe Ratio (DSR)**: Corrects for selection bias across multiple parameter trials
    * Total Executed Trade Count
  </Accordion>

  <Accordion title="POST /api/v2/backtest/runs/:run_id/deploy-gate/check" icon="check-double">
    Evaluates whether the backtest result satisfies minimum institutional safety thresholds:

    * Minimum statistical trade sample size (default: 50 trades)
    * Out-of-sample (OOS) Sharpe `>= 1.5`
    * Maximum Drawdown `<= 20%`
    * Minimum DSR confidence `>= 95%`
  </Accordion>
</AccordionGroup>

***

## StrategyCardSchema & Verified Proofs

Passing the deploy gate allows the trader to export a canonical **StrategyCardSchema** bundle. This bundle acts as the single source of truth for:

* Maximum authorized leverage
* Whitelisted market symbols
* Slippage floors and priority fee limits
* Public flex proof badge publication (see [Verified Flex Charter](/docs/social/verified-flex-charter))


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.