PRUVIQ Backtest API

The Backtest API from PRUVIQ — 1 operation(s) for backtest.

GitHub OpenAPI

Operations 1

POST /backtest Run Backtest #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/pruviq-com:pruviq-com-backtest-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

pruviq-com-backtest-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: PRUVIQ Simulation Backtest API
  description: Run crypto strategy simulations with realistic costs.
  version: 0.3.0
tags:
- name: Backtest
paths:
  /backtest:
    post:
      summary: Run Backtest
      description: 'Run a custom strategy backtest using the ConditionEngine.

        This is the core Strategy Builder endpoint.'
      operationId: run_backtest_backtest_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BacktestRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BacktestResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - Backtest
components:
  schemas:
    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 스코프 라벨)."
    BacktestRequest:
      properties:
        name:
          type: string
          maxLength: 100
          title: Name
          default: Custom Strategy
        direction:
          type: string
          title: Direction
          description: short | long. Omitted → SHORT (the documented /backtest default). Unlike /simulate, which resolves an omitted direction from the strategy registry, /backtest has no strategy id to resolve from — send direction explicitly. The response's direction_source says whether it was sent or defaulted (Q-B82).
          default: short
        indicators:
          additionalProperties: true
          type: object
          title: Indicators
          description: 'Indicator configs: {''bb'': {''period'': 20}, ''ema'': {}, ...}'
          default:
            bb: {}
            ema: {}
            volume: {}
            candle: {}
        entry:
          additionalProperties: true
          type: object
          title: Entry
          description: 'Entry conditions tree: {''type'': ''AND'', ''conditions'': [...]}'
        exit_conditions:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Exit Conditions
          description: Optional exit-signal conditions tree (same shape as entry). When met during an open trade, exit early (exit_reason='signal'). null = no signal exit (TP/SL/trailing/timeout only).
        avoid_hours:
          items:
            type: integer
          type: array
          title: Avoid Hours
          description: UTC hours to avoid (0-23)
          default: []
        avoid_months:
          anyOf:
          - items:
              type: integer
            type: array
          - type: 'null'
          title: Avoid Months
          description: Months to avoid entering trades (1-12). null = no month filter
        min_vol_regime:
          anyOf:
          - type: number
          - type: 'null'
          title: Min Vol Regime
          description: Minimum ATR ratio (current ATR / 14-period ATR MA) to allow entry. e.g., 0.7 = skip low-volatility periods. null = no filter
        sl_pct:
          type: number
          maximum: 50.0
          minimum: 0.5
          title: Sl Pct
          description: Stop Loss %
          default: 10.0
        tp_pct:
          type: number
          maximum: 100.0
          minimum: 0.5
          title: Tp Pct
          description: Take Profit %
          default: 8.0
        tp_source:
          type: string
          enum:
          - custom_pct
          - trailing
          title: Tp Source
          description: 'Exit mode: custom_pct = fixed TP/SL; trailing = trailing stop (tp_pct is the trail distance)'
          default: custom_pct
        trailing_pct:
          anyOf:
          - type: number
            maximum: 50.0
            minimum: 0.5
          - type: 'null'
          title: Trailing Pct
          description: Trailing stop distance %. If null and tp_source=trailing, uses tp_pct.
        max_bars:
          type: integer
          maximum: 168.0
          minimum: 1.0
          title: Max Bars
          description: Max holding period (bars)
          default: 48
        top_n:
          anyOf:
          - type: integer
            maximum: 535.0
            minimum: 1.0
          - type: 'null'
          title: Top N
          description: Number of coins (null = top 50)
        symbols:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Symbols
          description: Specific symbols
        include_stablecoins:
          type: boolean
          title: Include Stablecoins
          description: Include stablecoins (USDC, DAI…) in the top_n universe. Default false — ~0 volatility → empty backtests. Ignored when `symbols` is set (explicit picks always honored).
          default: false
        symbol:
          anyOf:
          - type: string
          - type: 'null'
          title: Symbol
          description: Single-symbol alias for `symbols`. Auto-mapped (prevents silent ignore).
        start_date:
          anyOf:
          - type: string
          - type: 'null'
          title: Start Date
          description: Backtest start date (YYYY-MM-DD)
        end_date:
          anyOf:
          - type: string
          - type: 'null'
          title: End Date
          description: Backtest end date (YYYY-MM-DD)
        timeframe:
          type: string
          enum:
          - 1H
          - 2H
          - 4H
          - 6H
          - 12H
          - 1D
          - 1W
          title: Timeframe
          description: 'Candle timeframe: 1H, 2H, 4H, 6H, 12H, 1D, 1W'
          default: 1H
        fee_pct:
          anyOf:
          - type: number
            maximum: 0.01
            minimum: 0.0
          - type: 'null'
          title: Fee Pct
          description: Fee per side (0.0005 = 0.05%). None = use market_type default
        per_coin_usd:
          type: number
          maximum: 1000000.0
          minimum: 1.0
          title: Per Coin Usd
          description: 'USD per coin position (compounding=True: total portfolio capital)'
          default: 60.0
        leverage:
          type: integer
          maximum: 125.0
          minimum: 1.0
          title: Leverage
          description: Leverage multiplier
          default: 1
        max_concurrent_positions:
          type: integer
          maximum: 1000.0
          minimum: 1.0
          title: Max Concurrent Positions
          description: Max simultaneous open positions
          default: 100
        compounding:
          type: boolean
          title: Compounding
          description: True = reinvest profits (compound), False = fixed position size (simple)
          default: false
      type: object
      required:
      - entry
      title: BacktestRequest
      description: Custom strategy backtest request from Strategy Builder.
    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축이 «통과»로 읽힌다(실제로는 실행조차 안 된다)."
    EquityPoint:
      properties:
        time:
          type: string
          title: Time
        value:
          type: number
          title: Value
      type: object
      required:
      - time
      - value
      title: EquityPoint
    RegimeMetrics:
      properties:
        trades:
          type: integer
          title: Trades
        win_rate:
          type: number
          title: Win Rate
        total_return:
          type: number
          title: Total Return
        profit_factor:
          type: number
          title: Profit Factor
        avg_pnl:
          type: number
          title: Avg Pnl
      type: object
      required:
      - trades
      - win_rate
      - total_return
      - profit_factor
      - avg_pnl
      title: RegimeMetrics
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BacktestResponse:
      properties:
        name:
          type: string
          title: Name
        direction:
          type: string
          title: Direction
        executed:
          type: boolean
          title: Executed
          description: False when the strategy failed validation and nothing was run — every metric is a placeholder (0), NOT a 0-trade result. validation_errors says why. HTTP stays 200 (documented contract).
          default: true
        direction_source:
          type: string
          enum:
          - request
          - default_short
          title: Direction Source
          description: «request» = the request sent direction; «default_short» = it was omitted and this run is SHORT (the /backtest default — /simulate would use the strategy registry's direction instead).
          default: request
        sl_pct:
          type: number
          title: Sl Pct
        tp_pct:
          type: number
          title: Tp Pct
        max_bars:
          type: integer
          title: Max Bars
        indicators_used:
          items:
            type: string
          type: array
          title: Indicators Used
        conditions_count:
          type: integer
          title: Conditions Count
        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
        tp_count:
          type: integer
          title: Tp Count
        sl_count:
          type: integer
          title: Sl Count
        timeout_count:
          type: integer
          title: Timeout Count
        total_fees_pct:
          type: number
          title: Total Fees Pct
          default: 0.0
        total_funding_pct:
          type: number
          title: Total Funding Pct
          default: 0.0
        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: '#/components/schemas/EquityPoint'
          type: array
          title: Equity Curve
        coin_results:
          items:
            $ref: '#/components/schemas/CoinResult'
          type: array
          title: Coin Results
          default: []
        trades:
          items:
            $ref: '#/components/schemas/TradeItem'
          type: array
          title: Trades
          default: []
        compounding:
          type: boolean
          title: Compounding
          default: false
        ruin_index:
          anyOf:
          - type: integer
          - type: 'null'
          title: Ruin Index
        ruin_trade:
          anyOf:
          - $ref: '#/components/schemas/RuinTrade'
          - type: 'null'
        per_coin_usd:
          type: number
          title: Per Coin Usd
          default: 60.0
        leverage:
          type: integer
          title: Leverage
          default: 5
        initial_capital_usd:
          type: number
          title: Initial Capital Usd
          default: 0.0
        total_return_usd:
          type: number
          title: Total Return Usd
          default: 0.0
        total_return_pct_portfolio:
          type: number
          title: Total Return Pct Portfolio
          default: 0.0
        max_drawdown_usd:
          type: number
          title: Max Drawdown Usd
          default: 0.0
        expectancy:
          type: number
          title: Expectancy
          default: 0.0
        recovery_factor:
          type: number
          title: Recovery Factor
          default: 0.0
        payoff_ratio:
          type: number
          title: Payoff Ratio
          default: 0.0
        btc_hold_return_pct:
          type: number
          title: Btc Hold Return Pct
          default: 0.0
        eth_hold_return_pct:
          type: number
          title: Eth Hold Return Pct
          default: 0.0
        btc_hold_curve:
          items:
            $ref: '#/components/schemas/EquityPoint'
          type: array
          title: Btc Hold Curve
          default: []
        eth_hold_curve:
          items:
            $ref: '#/components/schemas/EquityPoint'
          type: array
          title: Eth Hold Curve
          default: []
        var_95:
          type: number
          title: Var 95
          default: 0.0
        cvar_95:
          type: number
          title: Cvar 95
          default: 0.0
        strategy_grade:
          type: string
          title: Strategy Grade
          default: ''
        grade_details:
          type: string
          title: Grade Details
          default: ''
        edge_p_value:
          anyOf:
          - type: number
          - type: 'null'
          title: Edge P Value
        warnings:
          items:
            type: string
          type: array
          title: Warnings
          default: []
        walk_forward_consistency:
          anyOf:
          - type: number
          - type: 'null'
          title: Walk Forward Consistency
        walk_forward_details:
          type: string
          title: Walk Forward Details
          default: ''
        profit_factor_ci:
          anyOf:
          - $ref: '#/components/schemas/MetricCI'
          - type: 'null'
        sharpe_ci:
          anyOf:
          - $ref: '#/components/schemas/MetricCI'
          - type: 'null'
        deflated_sharpe:
          anyOf:
          - type: number
          - type: 'null'
          title: Deflated Sharpe
        dsr_haircut_pct:
          anyOf:
          - type: number
          - type: 'null'
          title: Dsr Haircut Pct
        mc_p_value:
          anyOf:
          - type: number
          - type: 'null'
          title: Mc P Value
        mc_percentile:
          anyOf:
          - type: number
          - type: 'null'
          title: Mc Percentile
        jensens_alpha:
          anyOf:
          - type: number
          - type: 'null'
          title: Jensens Alpha
        avg_bars_held:
          type: number
          title: Avg Bars Held
          default: 0.0
        median_bars_held:
          type: number
          title: Median Bars Held
          default: 0.0
        positions_skipped:
          type: integer
          title: Positions Skipped
          default: 0
        pnl_distribution:
          items:
            type: integer
          type: array
          title: Pnl Distribution
          default: []
        pnl_buckets:
          items:
            type: string
          type: array
          title: Pnl Buckets
          default: []
        regime_performance:
          anyOf:
          - $ref: '#/components/schemas/RegimePerformance'
          - type: 'null'
        is_valid:
          type: boolean
          title: Is Valid
        validation_errors:
          items:
            type: string
          type: array
          title: Validation Errors
          default: []
        yearly_stats:
          items:
            $ref: '#/components/schemas/YearlyStat'
          type: array
          title: Yearly Stats
          default: []
        monthly_stats:
          items:
            $ref: '#/components/schemas/MonthlyStat'
          type: array
          title: Monthly Stats
          default: []
        compute_time_ms:
          type: integer
          title: Compute Time Ms
          default: 0
        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: '#/components/schemas/ReliabilityCheck'
          type: array
          title: Reliability Checks
          description: '축별 판정 레코드 — 이 응답의 «판정 SSoT». reliability_warning 은 파생물.


            ⚠ `verdict` 는 세 값이다. `not_evaluated` 를 «통과»로 세면 0거래 응답이

            「4개 축 통과」로 읽힌다 — 그 축들은 실행조차 안 됐다.'
          readOnly: true
        reliability_warning:
          anyOf:
          - type: string
          - type: 'null'
          title: Reliability Warning
          description: 계약은 build_reliability_warning 한 곳이 소유한다(룰3).
          readOnly: true
      type: object
      required:
      - name
      - direction
      - sl_pct
      - tp_pct
      - max_bars
      - indicators_used
      - conditions_count
      - total_trades
      - wins
      - losses
      - win_rate
      - total_return_pct
      - profit_factor
      - avg_win_pct
      - avg_loss_pct
      - max_drawdown_pct
      - max_consecutive_losses
      - tp_count
      - sl_count
      - timeout_count
      - coins_used
      - data_range
      - equity_curve
      - is_valid
      - scope_disclosure
      - reliability_checks
      - reliability_warning
      title: BacktestResponse
      description: Custom strategy backtest result.
    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;

        a trade table listed in entry order shows a different row at position N, so the trade is named, not only numbered.'
    MonthlyStat:
      properties:
        month:
          type: string
          title: Month
        trades:
          type: integer
          title: Trades
        wins:
          type: integer
          title: Wins
        win_rate:
          type: number
          title: Win Rate
        total_return_pct:
          type: number
          title: Total Return Pct
        profit_factor:
          type: number
          title: Profit Factor
      type: object
      required:
      - month
      - trades
      - wins
      - win_rate
      - total_return_pct
      - profit_factor
      title: MonthlyStat
      description: Per-month performance breakdown.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    YearlyStat:
      properties:
        year:
          type: integer
          title: Year
        trades:
          type: integer
          title: Trades
        wins:
          type: integer
          title: Wins
        win_rate:
          type: number
          title: Win Rate
        total_return_pct:
          type: number
          title: Total Return Pct
        profit_factor:
          type: number
          title: Profit Factor
      type: object
      required:
      - year
      - trades
      - wins
      - win_rate
      - total_return_pct
      - profit_factor
      title: YearlyStat
      description: Per-year performance breakdown.
    RegimePerformance:
      properties:
        bull:
          $ref: '#/components/schemas/RegimeMetrics'
        bear:
          $ref: '#/components/schemas/RegimeMetrics'
        sideways:
          $ref: '#/components/schemas/RegimeMetrics'
      type: object
      required:
      - bull
      - bear
      - sideways
      title: RegimePerformance
    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.
    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