> ## 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.

# Calculate Historical VaR

> Calculates Value at Risk using the historical simulation method. This approach uses actual historical return data to estimate VaR without assuming any distribution. More accurate for non-normal distributions and captures tail risk better than parametric methods. Requires historical return time series data. [Tier: PRO, Credits: 5]



## OpenAPI

````yaml api-specs/risk.json post /quantlib/risk/var/historical
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/var/historical:
    post:
      tags:
        - quantlib-risk
      summary: Calculate Historical VaR
      description: >-
        Calculates Value at Risk using the historical simulation method. This
        approach uses actual historical return data to estimate VaR without
        assuming any distribution. More accurate for non-normal distributions
        and captures tail risk better than parametric methods. Requires
        historical return time series data. [Tier: PRO, Credits: 5]
      operationId: historical_var
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - returns
              properties:
                returns:
                  type: array
                  description: Historical returns as decimals (e.g., 0.01 for 1% return)
                  items:
                    type: number
                  minItems: 100
                  example:
                    - -0.03
                    - 0.02
                    - -0.01
                    - 0.015
                    - -0.005
                confidence:
                  type: number
                  description: Confidence level for VaR calculation
                  example: 0.99
                  default: 0.99
                  minimum: 0.5
                  maximum: 0.999
                portfolio_value:
                  type: number
                  description: Total portfolio value in currency units
                  example: 1000000
                  default: 1000000
            example:
              returns:
                - -0.025
                - 0.018
                - -0.012
                - 0.031
                - -0.008
                - 0.022
                - -0.015
                - 0.009
                - -0.005
                - 0.014
              confidence: 0.95
              portfolio_value: 5000000
      responses:
        '200':
          description: Successful VaR calculation
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      var:
                        type: number
                        description: Historical Value at Risk amount
                        example: 87500
                      confidence:
                        type: number
                        example: 0.95
              example:
                success: true
                data:
                  var: 87500
                  confidence: 0.95
        '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

````