> ## 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 Bond Yield to Maturity

> Solve for the yield to maturity (YTM) of a bond given its market price, coupon rate, and maturity. The YTM is the internal rate of return assuming the bond is held to maturity and all payments are made as scheduled. Uses iterative root-finding methods to solve the bond pricing equation. Essential for bond valuation, portfolio analysis, and comparing bonds with different characteristics. [Tier: STANDARD, Credits: 2]



## OpenAPI

````yaml api-specs/solver.json post /quantlib/solver/finance/bond-yield
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/bond-yield:
    post:
      tags:
        - quantlib-solver
      summary: Calculate Bond Yield to Maturity
      description: >-
        Solve for the yield to maturity (YTM) of a bond given its market price,
        coupon rate, and maturity. The YTM is the internal rate of return
        assuming the bond is held to maturity and all payments are made as
        scheduled. Uses iterative root-finding methods to solve the bond pricing
        equation. Essential for bond valuation, portfolio analysis, and
        comparing bonds with different characteristics. [Tier: STANDARD,
        Credits: 2]
      operationId: bond_yield
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - price
                - coupon
                - maturity
              properties:
                price:
                  type: number
                  description: Current market price of the bond (clean price)
                  example: 98.5
                face:
                  type: number
                  description: Face value (par value) of the bond
                  default: 100
                  example: 100
                coupon:
                  type: number
                  description: Annual coupon rate as a decimal (e.g., 0.05 for 5%)
                  example: 0.05
                maturity:
                  type: number
                  description: Time to maturity in years
                  example: 5
                frequency:
                  type: integer
                  description: >-
                    Coupon payment frequency per year (1=annual, 2=semi-annual,
                    4=quarterly, 12=monthly)
                  default: 2
                  enum:
                    - 1
                    - 2
                    - 4
                    - 12
                  example: 2
                guess:
                  type: number
                  description: Initial guess for the yield (used by the solver)
                  default: 0.05
                  example: 0.05
            example:
              price: 98.5
              face: 100
              coupon: 0.05
              maturity: 5
              frequency: 2
              guess: 0.05
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      yield_to_maturity:
                        type: number
                        description: The calculated yield to maturity as a decimal
                        example: 0.0538
                      price:
                        type: number
                        description: The input bond price
                        example: 98.5
                      coupon:
                        type: number
                        description: The input coupon rate
                        example: 0.05
              example:
                success: true
                data:
                  yield_to_maturity: 0.0538
                  price: 98.5
                  coupon: 0.05
        '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
              example:
                detail:
                  - loc:
                      - body
                      - price
                    msg: field required
                    type: value_error.missing
      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

````