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

# Year Fraction

> Calculate the year fraction between two dates using a specified day count convention. The year fraction is used to calculate accrued interest, coupon payments, and discount factors. Different conventions are used in different markets (money markets use ACT/360, bonds use 30/360, etc.). [Tier: FREE, Credits: 0]



## OpenAPI

````yaml api-specs/scheduling.json post /quantlib/scheduling/daycount/year-fraction
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Scheduling
  description: Scheduling module endpoints for FinceptQuantLib API
  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-scheduling
    description: API endpoints for scheduling operations
paths:
  /quantlib/scheduling/daycount/year-fraction:
    post:
      tags:
        - quantlib-scheduling
      summary: Year Fraction
      description: >-
        Calculate the year fraction between two dates using a specified day
        count convention. The year fraction is used to calculate accrued
        interest, coupon payments, and discount factors. Different conventions
        are used in different markets (money markets use ACT/360, bonds use
        30/360, etc.). [Tier: FREE, Credits: 0]
      operationId: year_fraction_quantlib_scheduling_daycount_year_fraction_post
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - start_date
                - end_date
              properties:
                start_date:
                  type: string
                  format: date
                  description: Start date of the period in ISO format (YYYY-MM-DD)
                  example: '2024-01-15'
                end_date:
                  type: string
                  format: date
                  description: End date of the period in ISO format (YYYY-MM-DD)
                  example: '2024-07-15'
                convention:
                  type: string
                  description: >-
                    Day count convention to use. Common conventions: ACT/360
                    (money markets), ACT/365 (UK gilts), 30/360 (US corporate
                    bonds), ACT/ACT ISDA (US Treasury)
                  default: ACT/360
                  enum:
                    - ACT/360
                    - ACT/365
                    - ACT/365 Actual
                    - ACT/ACT ISDA
                    - 30/360
                    - 30E/360
                    - 30E/360 ISDA
                    - 30/360 European
                    - Business/252
                  example: ACT/360
            example:
              start_date: '2024-01-15'
              end_date: '2024-07-15'
              convention: ACT/360
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      start_date:
                        type: string
                        format: date
                        description: The start date
                        example: '2024-01-15'
                      end_date:
                        type: string
                        format: date
                        description: The end date
                        example: '2024-07-15'
                      convention:
                        type: string
                        description: The day count convention used
                        example: ACT/360
                      year_fraction:
                        type: number
                        format: float
                        description: The calculated year fraction
                        example: 0.5055555555555555
              example:
                success: true
                data:
                  start_date: '2024-01-15'
                  end_date: '2024-07-15'
                  convention: ACT/360
                  year_fraction: 0.5055555555555555
        '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
                      - start_date
                    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

````