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

# Backtest VaR Model

> Validates VaR model accuracy by comparing VaR estimates against actual realized losses. Performs Kupiec POF test, Christoffersen independence test, and Basel traffic light test. Essential for model validation, regulatory compliance, and ensuring risk models remain accurate over time. [Tier: PRO, Credits: 5]



## OpenAPI

````yaml api-specs/risk.json post /quantlib/risk/backtest
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Risk Module
  description: >-
    Professional-grade risk management endpoints including Value at Risk (VaR),
    stress testing, copulas, extreme value theory (EVT), XVA calculations,
    sensitivities, and portfolio hedging. Part of the Pro Tier (5 credits per
    request).
  version: 3.0.0
  contact:
    name: Fincept API Support
    url: https://fincept.in
    email: support@fincept.in
servers:
  - url: https://api.fincept.in
    description: Fincept API Production Server
security:
  - APIKeyHeader: []
tags:
  - name: quantlib-risk
    description: Risk Management Module - Pro Tier (5 credits/request)
    x-displayName: Risk
paths:
  /quantlib/risk/backtest:
    post:
      tags:
        - quantlib-risk
      summary: Backtest VaR Model
      description: >-
        Validates VaR model accuracy by comparing VaR estimates against actual
        realized losses. Performs Kupiec POF test, Christoffersen independence
        test, and Basel traffic light test. Essential for model validation,
        regulatory compliance, and ensuring risk models remain accurate over
        time. [Tier: PRO, Credits: 5]
      operationId: var_backtest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - actual_returns
                - var_estimates
              properties:
                actual_returns:
                  type: array
                  description: Historical actual portfolio returns
                  items:
                    type: number
                  minItems: 250
                  example:
                    - -0.02
                    - 0.01
                    - -0.015
                var_estimates:
                  type: array
                  description: >-
                    Corresponding VaR estimates (positive values representing
                    losses)
                  items:
                    type: number
                  example:
                    - 0.025
                    - 0.025
                    - 0.025
                confidence:
                  type: number
                  description: Confidence level used for VaR estimates
                  example: 0.99
                  default: 0.99
            example:
              actual_returns:
                - -0.008
                - 0.012
                - -0.018
                - 0.005
                - -0.032
                - 0.009
                - -0.015
              var_estimates:
                - 0.025
                - 0.025
                - 0.025
                - 0.025
                - 0.025
                - 0.025
                - 0.025
              confidence: 0.95
      responses:
        '200':
          description: Backtest results with statistical tests
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      exceptions:
                        type: integer
                        description: Number of VaR breaches (actual loss > VaR)
                        example: 12
                      total_observations:
                        type: integer
                        example: 252
                      exception_rate:
                        type: number
                        description: Observed breach rate
                        example: 0.0476
                      expected_exceptions:
                        type: number
                        example: 12.6
                      kupiec_lr_stat:
                        type: number
                        description: Kupiec likelihood ratio test statistic
                        example: 0.342
                      kupiec_p_value:
                        type: number
                        example: 0.558
                      christoffersen_stat:
                        type: number
                        description: Christoffersen independence test statistic
                        example: 1.234
                      christoffersen_p_value:
                        type: number
                        example: 0.266
                      traffic_light:
                        type: string
                        description: Basel traffic light zone (green/yellow/red)
                        example: green
              example:
                success: true
                data:
                  exceptions: 12
                  total_observations: 252
                  exception_rate: 0.0476
                  expected_exceptions: 12.6
                  kupiec_lr_stat: 0.342
                  kupiec_p_value: 0.558
                  christoffersen_stat: 1.234
                  christoffersen_p_value: 0.266
                  traffic_light: green
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientCreditsError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientCreditsError:
      description: Insufficient API credits for this request
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Insufficient credits. This endpoint requires 5 credits.
    ValidationError:
      description: Request validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: array
                items:
                  type: object
                  properties:
                    loc:
                      type: array
                      items:
                        type: string
                    msg:
                      type: string
                    type:
                      type: string
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get your key at
        https://api.fincept.in/auth/register

````