> ## 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 Optimal Hedge Ratio

> Computes the minimum variance hedge ratio - the optimal proportion of hedging instrument to hold per unit of exposure. Based on the ratio of covariance between asset and hedge to variance of hedge. Essential for futures hedging, currency hedging, and portfolio insurance strategies. [Tier: PRO, Credits: 5]



## OpenAPI

````yaml api-specs/risk.json post /quantlib/risk/portfolio-risk/optimal-hedge
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/portfolio-risk/optimal-hedge:
    post:
      tags:
        - quantlib-risk
      summary: Calculate Optimal Hedge Ratio
      description: >-
        Computes the minimum variance hedge ratio - the optimal proportion of
        hedging instrument to hold per unit of exposure. Based on the ratio of
        covariance between asset and hedge to variance of hedge. Essential for
        futures hedging, currency hedging, and portfolio insurance strategies.
        [Tier: PRO, Credits: 5]
      operationId: optimal_hedge
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - returns
                - hedge_returns
              properties:
                returns:
                  type: array
                  description: Historical returns of asset to be hedged
                  items:
                    type: number
                  example:
                    - 0.02
                    - -0.03
                    - 0.01
                    - -0.02
                hedge_returns:
                  type: array
                  description: Historical returns of hedging instrument
                  items:
                    type: number
                  example:
                    - -0.018
                    - 0.028
                    - -0.009
                    - 0.019
            example:
              returns:
                - 0.015
                - -0.022
                - 0.018
                - -0.025
                - 0.012
                - -0.015
              hedge_returns:
                - -0.012
                - 0.019
                - -0.015
                - 0.021
                - -0.01
                - 0.013
      responses:
        '200':
          description: Optimal hedge ratio
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      optimal_hedge_ratio:
                        type: number
                        description: >-
                          Optimal hedge ratio (negative values indicate short
                          hedge)
                        example: -0.87
              example:
                success: true
                data:
                  optimal_hedge_ratio: -0.87
        '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

````