> ## 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 Modified Duration

> Calculate the modified duration of a bond - an approximation of the percentage price change for a 1% change in yield. Modified duration is derived from Macaulay duration and directly measures interest rate risk. Used extensively for hedging, DV01 calculations, and measuring portfolio sensitivity to parallel yield curve shifts. [Tier: STANDARD, Credits: 2]



## OpenAPI

````yaml api-specs/solver.json post /quantlib/solver/finance/modified-duration
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Solver
  description: >-
    Solver module endpoints for FinceptQuantLib API. The Solver module (Basic
    Tier, 1 credit per request) provides advanced financial solvers including
    bond analytics (yield, duration, convexity), implied volatility
    calculations, spread computations (Z-spread, ASW, OAS), curve bootstrapping,
    interest rate conversions, and model calibration (Vasicek, CIR). Essential
    for fixed income analysis, derivatives pricing, and risk management.
  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-solver
    description: >-
      Advanced financial solvers for bond analytics, implied volatility, spread
      calculations, and model calibration
    x-displayName: Solver
paths:
  /quantlib/solver/finance/modified-duration:
    post:
      tags:
        - quantlib-solver
      summary: Calculate Modified Duration
      description: >-
        Calculate the modified duration of a bond - an approximation of the
        percentage price change for a 1% change in yield. Modified duration is
        derived from Macaulay duration and directly measures interest rate risk.
        Used extensively for hedging, DV01 calculations, and measuring portfolio
        sensitivity to parallel yield curve shifts. [Tier: STANDARD, Credits: 2]
      operationId: mod_duration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - coupon
                - maturity
                - ytm
              properties:
                face:
                  type: number
                  description: Face value of the bond
                  default: 100
                  example: 100
                coupon:
                  type: number
                  description: Annual coupon rate as a decimal
                  example: 0.06
                maturity:
                  type: number
                  description: Time to maturity in years
                  example: 10
                ytm:
                  type: number
                  description: Yield to maturity as a decimal
                  example: 0.05
                frequency:
                  type: integer
                  description: Coupon payment frequency per year
                  default: 2
                  enum:
                    - 1
                    - 2
                    - 4
                    - 12
                  example: 2
            example:
              face: 100
              coupon: 0.06
              maturity: 10
              ytm: 0.05
              frequency: 2
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      modified_duration:
                        type: number
                        description: >-
                          Modified duration (approximation of % price change per
                          1% yield change)
                        example: 7.66
              example:
                success: true
                data:
                  modified_duration: 7.66
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientTierError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
      security:
        - APIKeyHeader: []
components:
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientTierError:
      description: API tier insufficient for this endpoint
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Endpoint requires Basic tier or higher
  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

````