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

# Batch Year Fraction

> Calculate year fractions for multiple date pairs in a single request using the same day count convention. Efficient for processing multiple coupon periods, calculating accruals for a portfolio of bonds, or batch interest calculations. Returns results in the same order as input. [Tier: FREE, Credits: 0]



## OpenAPI

````yaml api-specs/scheduling.json post /quantlib/scheduling/daycount/batch-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/batch-year-fraction:
    post:
      tags:
        - quantlib-scheduling
      summary: Batch Year Fraction
      description: >-
        Calculate year fractions for multiple date pairs in a single request
        using the same day count convention. Efficient for processing multiple
        coupon periods, calculating accruals for a portfolio of bonds, or batch
        interest calculations. Returns results in the same order as input.
        [Tier: FREE, Credits: 0]
      operationId: >-
        batch_year_fraction_quantlib_scheduling_daycount_batch_year_fraction_post
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - date_pairs
              properties:
                date_pairs:
                  type: array
                  items:
                    type: array
                    items:
                      type: string
                      format: date
                    minItems: 2
                    maxItems: 2
                  description: >-
                    Array of date pairs [[start1, end1], [start2, end2], ...] in
                    ISO format
                  example:
                    - - '2024-01-01'
                      - '2024-07-01'
                    - - '2024-07-01'
                      - '2025-01-01'
                    - - '2025-01-01'
                      - '2025-07-01'
                convention:
                  type: string
                  description: Day count convention to apply to all date pairs
                  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: 30/360
            example:
              date_pairs:
                - - '2024-01-01'
                  - '2024-07-01'
                - - '2024-07-01'
                  - '2025-01-01'
                - - '2025-01-01'
                  - '2025-07-01'
              convention: 30/360
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      convention:
                        type: string
                        description: The day count convention used for all calculations
                        example: 30/360
                      results:
                        type: array
                        items:
                          type: object
                          properties:
                            start_date:
                              type: string
                              format: date
                              description: Start date of this period
                            end_date:
                              type: string
                              format: date
                              description: End date of this period
                            year_fraction:
                              type: number
                              format: float
                              description: Calculated year fraction for this period
                        description: Array of results in the same order as input date pairs
                        example:
                          - start_date: '2024-01-01'
                            end_date: '2024-07-01'
                            year_fraction: 0.5
                          - start_date: '2024-07-01'
                            end_date: '2025-01-01'
                            year_fraction: 0.5
                          - start_date: '2025-01-01'
                            end_date: '2025-07-01'
                            year_fraction: 0.5
              example:
                success: true
                data:
                  convention: 30/360
                  results:
                    - start_date: '2024-01-01'
                      end_date: '2024-07-01'
                      year_fraction: 0.5
                    - start_date: '2024-07-01'
                      end_date: '2025-01-01'
                      year_fraction: 0.5
                    - start_date: '2025-01-01'
                      end_date: '2025-07-01'
                      year_fraction: 0.5
        '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
                      - date_pairs
                    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

````