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

# Portfolio Value at Risk (VaR)

> Calculates portfolio Value at Risk (VaR) - the maximum expected loss over a given time horizon at a specified confidence level. Supports parametric (variance-covariance) method.

**Use Cases:**
- Risk limit monitoring and compliance
- Capital allocation and reserve requirements
- Stress testing and scenario analysis
- Regulatory reporting (Basel III, Solvency II)

**Method:**
- **parametric**: Assumes normal distribution of returns. Fast and suitable for linear portfolios.

**Interpretation:**
VaR of $50,000 at 95% confidence means there's a 5% chance of losing more than $50,000 over the horizon.

**Credits:** 5 per request [Tier: PRO, Credits: 5]



## OpenAPI

````yaml api-specs/portfolio.json post /quantlib/portfolio/risk/var
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Portfolio
  description: >-
    Portfolio optimization and risk management module for institutional-grade
    portfolio construction, analysis, and monitoring. Includes mean-variance
    optimization, Black-Litterman, risk parity, and comprehensive risk metrics.


    **Tier:** Pro (5 credits per request)


    **Key Features:**

    - Mean-variance optimization (minimum variance, maximum Sharpe, target
    return)

    - Efficient frontier construction with tangency portfolio identification

    - Black-Litterman model for Bayesian view incorporation

    - Risk parity strategies (ERC, HRP, inverse volatility)

    - Comprehensive risk metrics (VaR, CVaR, tracking error, information ratio)

    - Advanced portfolio analytics (risk contribution, drawdown,
    diversification)
  version: 3.0.0
  contact:
    name: Fincept API Support
    url: https://fincept.in
servers:
  - url: https://api.fincept.in
    description: Fincept API Production Server
security:
  - APIKeyHeader: []
tags:
  - name: quantlib-portfolio
    description: Portfolio optimization and risk management endpoints
    x-displayName: Portfolio
paths:
  /quantlib/portfolio/risk/var:
    post:
      tags:
        - quantlib-portfolio
      summary: Portfolio Value at Risk (VaR)
      description: >-
        Calculates portfolio Value at Risk (VaR) - the maximum expected loss
        over a given time horizon at a specified confidence level. Supports
        parametric (variance-covariance) method.


        **Use Cases:**

        - Risk limit monitoring and compliance

        - Capital allocation and reserve requirements

        - Stress testing and scenario analysis

        - Regulatory reporting (Basel III, Solvency II)


        **Method:**

        - **parametric**: Assumes normal distribution of returns. Fast and
        suitable for linear portfolios.


        **Interpretation:**

        VaR of $50,000 at 95% confidence means there's a 5% chance of losing
        more than $50,000 over the horizon.


        **Credits:** 5 per request [Tier: PRO, Credits: 5]
      operationId: portfolio_var
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - weights
                - covariance_matrix
              properties:
                weights:
                  type: array
                  items:
                    type: number
                  description: Portfolio weights (should sum to 1.0)
                  example:
                    - 0.3
                    - 0.25
                    - 0.25
                    - 0.2
                covariance_matrix:
                  type: array
                  items:
                    type: array
                    items:
                      type: number
                  description: Asset covariance matrix (annualized)
                  example:
                    - - 0.04
                      - 0.006
                      - 0.008
                      - 0.01
                    - - 0.006
                      - 0.09
                      - 0.012
                      - 0.015
                    - - 0.008
                      - 0.012
                      - 0.0625
                      - 0.018
                    - - 0.01
                      - 0.015
                      - 0.018
                      - 0.16
                confidence:
                  type: number
                  description: Confidence level (e.g., 0.95 for 95% VaR)
                  default: 0.95
                  example: 0.95
                  minimum: 0.5
                  maximum: 0.999
                horizon:
                  type: number
                  description: >-
                    Time horizon in years (e.g., 1/252 for daily, 1/12 for
                    monthly)
                  default: 1
                  example: 0.00396825
                  minimum: 0.001
                  maximum: 10
                portfolio_value:
                  type: number
                  description: Current portfolio value in currency units
                  default: 1000000
                  example: 1000000
                  minimum: 0
                method:
                  type: string
                  enum:
                    - parametric
                  description: VaR calculation method
                  default: parametric
                  example: parametric
      responses:
        '200':
          description: VaR successfully calculated
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      var:
                        type: number
                        description: Value at Risk in currency units
                        example: 52345.67
                      confidence:
                        type: number
                        description: Confidence level used
                        example: 0.95
                      method:
                        type: string
                        description: Calculation method used
                        example: parametric
        '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
      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
          example:
            detail:
              - loc:
                  - body
                  - expected_returns
                msg: field required
                type: value_error.missing
  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

````