> ## Documentation Index
> Fetch the complete documentation index at: https://docs.terrapinfinance.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Price To Yield

> Calculate yield metrics for municipal securities based on price and settlement date.



## OpenAPI

````yaml post /api/v1/muni_price_to_yield
openapi: 3.0.0
info:
  title: Terrapin API
  version: 1.0.0
servers:
  - url: https://terrapinfinance.com
    variables: {}
security:
  - authorization: []
tags: []
paths:
  /api/v1/muni_price_to_yield:
    post:
      tags: []
      summary: Municipal price to yield conversion
      description: >-
        Calculate yield metrics for municipal securities based on price and
        settlement date.
      operationId: post_muni_price_to_yield
      parameters: []
      requestBody:
        content:
          application/json:
            example:
              - isin: US005824LP01
                trade_data:
                  - price: 101.78
                    settlement_date: '2025-01-01'
            schema:
              items:
                additionalProperties: false
                properties:
                  isin:
                    description: >-
                      International Securities Identification Number (ISIN),
                      unique 12-character code for the security.
                    maxLength: 12
                    minLength: 12
                    nullable: false
                    type: string
                    x-check: valid_check_digit
                    x-check-error: Invalid ISIN check digit
                    x-struct: null
                    x-transform: upcase
                    x-validate: null
                  trade_data:
                    items:
                      additionalProperties: false
                      properties:
                        price:
                          description: >
                            Price at which to calculate metrics, expressed as a
                            percentage of the bond's face value.
                          minimum: 0
                          type: number
                          x-struct: null
                          x-validate: null
                        settlement_date:
                          description: >
                            Settlement date at which to calculate metrics in
                            ISO-8601 format (YYYY-MM-DD).
                          format: date
                          type: string
                          x-struct: null
                          x-validate: null
                      required:
                        - price
                        - settlement_date
                      type: object
                      x-struct: null
                      x-validate: null
                    type: array
                    x-struct: null
                    x-validate: null
                required:
                  - isin
                  - trade_data
                type: object
                x-struct: null
                x-validate: null
              type: array
              x-struct: null
              x-validate: null
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                data:
                  - isin: US005824LP01
                    trade_data:
                      - price: 101.78
                        settlement_date: '2025-01-01'
                        ytc_continuous: 4.6472
                        ytc_money_market: null
                        ytc_semi_annual: 4.7017
                        ytm_continuous: 4.71611
                        ytm_money_market: null
                        ytm_semi_annual: 4.7722
                total: 1
              schema:
                additionalProperties: false
                properties:
                  data:
                    description: List of response data objects, often capped to 1000.
                    items:
                      additionalProperties: false
                      properties:
                        isin:
                          description: >-
                            International Securities Identification Number
                            (ISIN), unique 12-character code for the security.
                          example: US005824LP01
                          maxLength: 12
                          minLength: 12
                          nullable: false
                          type: string
                          x-struct: null
                          x-validate: null
                        trade_data:
                          items:
                            additionalProperties: false
                            properties:
                              price:
                                description: >
                                  Price at which to calculate metrics:


                                  The price is expressed as a percentage of the
                                  bond's face value:


                                  - `100`: Calculate at par (100% of face
                                  value).

                                  - `101.78`: Calculate at a premium (101.78% of
                                  face value).

                                  - `99.25`: Calculate at a discount (99.25% of
                                  face value).
                                minimum: 0
                                nullable: false
                                type: number
                                x-struct: null
                                x-validate: null
                              settlement_date:
                                description: >
                                  Settlement date at which to calculate metrics
                                  in ISO-8601 format (YYYY-MM-DD).
                                format: date
                                nullable: false
                                type: string
                                x-struct: null
                                x-validate: null
                              ytc_continuous:
                                description: Yield to call (continuous compounding).
                                nullable: true
                                type: number
                                x-struct: null
                                x-validate: null
                              ytc_money_market:
                                description: Yield to call (money market convention).
                                nullable: true
                                type: number
                                x-struct: null
                                x-validate: null
                              ytc_semi_annual:
                                description: Yield to call (semi-annual convention).
                                nullable: true
                                type: number
                                x-struct: null
                                x-validate: null
                              ytm_continuous:
                                description: Yield to maturity (continuous compounding).
                                nullable: true
                                type: number
                                x-struct: null
                                x-validate: null
                              ytm_money_market:
                                description: Yield to maturity (money market convention).
                                nullable: true
                                type: number
                                x-struct: null
                                x-validate: null
                              ytm_semi_annual:
                                description: Yield to maturity (semi-annual convention).
                                nullable: true
                                type: number
                                x-struct: null
                                x-validate: null
                            type: object
                            x-struct: null
                            x-validate: null
                          type: array
                          x-struct: null
                          x-validate: null
                      required:
                        - isin
                        - trade_data
                      type: object
                      x-struct: null
                      x-validate: null
                    type: array
                    x-struct: null
                    x-validate: null
                  total:
                    description: >-
                      Total number of results in the database that match the
                      query filters.
                    type: integer
                    x-struct: null
                    x-validate: null
                required:
                  - data
                  - total
                title: MuniPriceToYieldResponse
                type: object
                x-struct: null
                x-validate: null
          description: Calculated yield metrics
        '401':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  errors:
                    items:
                      additionalProperties: false
                      properties:
                        detail:
                          example: Unauthorized
                          type: string
                          x-struct: null
                          x-validate: null
                        reason:
                          example: >-
                            Your account tier does not allow this operation.
                            Contact team@terrapinfinance.com for an upgrade.
                          type: string
                          x-struct: null
                          x-validate: null
                      required:
                        - detail
                      type: object
                      x-struct: null
                      x-validate: null
                    type: array
                    x-struct: null
                    x-validate: null
                required:
                  - errors
                type: object
                x-struct: null
                x-validate: null
          description: Unauthorized
        '402':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  errors:
                    items:
                      additionalProperties: false
                      properties:
                        detail:
                          example: Payment Required
                          type: string
                          x-struct: null
                          x-validate: null
                        reason:
                          example: >-
                            You have run out of your granted quota for this
                            resource as defined by your account tier. Contact
                            team@terrapinfinance.com for an upgrade.
                          type: string
                          x-struct: null
                          x-validate: null
                      required:
                        - detail
                      type: object
                      x-struct: null
                      x-validate: null
                    type: array
                    x-struct: null
                    x-validate: null
                required:
                  - errors
                type: object
                x-struct: null
                x-validate: null
          description: Payment Required
        '403':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  errors:
                    items:
                      additionalProperties: false
                      properties:
                        detail:
                          example: Forbidden
                          type: string
                          x-struct: null
                          x-validate: null
                        reason:
                          example: >-
                            Your account tier does not allow this operation.
                            Contact team@terrapinfinance.com for an upgrade.
                          type: string
                          x-struct: null
                          x-validate: null
                      required:
                        - detail
                      type: object
                      x-struct: null
                      x-validate: null
                    type: array
                    x-struct: null
                    x-validate: null
                required:
                  - errors
                type: object
                x-struct: null
                x-validate: null
          description: Forbidden
        '422':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      properties:
                        detail:
                          example: 'Invalid string. Got: integer'
                          type: string
                          x-struct: null
                          x-validate: null
                        source:
                          properties:
                            pointer:
                              example: /isins/0
                              type: string
                              x-struct: null
                              x-validate: null
                          required:
                            - pointer
                          type: object
                          x-struct: null
                          x-validate: null
                        title:
                          example: Invalid value
                          type: string
                          x-struct: null
                          x-validate: null
                      required:
                        - detail
                        - source
                        - title
                      type: object
                      x-struct: null
                      x-validate: null
                    type: array
                    x-struct: null
                    x-validate: null
                required:
                  - errors
                type: object
                x-struct: null
                x-validate: null
          description: Unprocessable Entity
        '429':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  errors:
                    items:
                      additionalProperties: false
                      properties:
                        detail:
                          example: Too Many Requests
                          type: string
                          x-struct: null
                          x-validate: null
                        reason:
                          type: string
                          x-struct: null
                          x-validate: null
                      required:
                        - detail
                      type: object
                      x-struct: null
                      x-validate: null
                    type: array
                    x-struct: null
                    x-validate: null
                required:
                  - errors
                type: object
                x-struct: null
                x-validate: null
          description: Too Many Requests
        '500':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  errors:
                    items:
                      additionalProperties: false
                      properties:
                        detail:
                          example: Internal Server Error
                          type: string
                          x-struct: null
                          x-validate: null
                        reason:
                          type: string
                          x-struct: null
                          x-validate: null
                      required:
                        - detail
                      type: object
                      x-struct: null
                      x-validate: null
                    type: array
                    x-struct: null
                    x-validate: null
                required:
                  - errors
                type: object
                x-struct: null
                x-validate: null
          description: Internal Server Error
      callbacks: {}
components:
  securitySchemes:
    authorization:
      scheme: bearer
      type: http

````