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

# Binomial Tree Barrier Option

> Price barrier options using binomial trees. Barrier options activate (knock-in) or terminate (knock-out) when the underlying crosses a barrier level.

**Barrier Types:**
- **Down-and-Out**: Terminates if S drops below barrier (is_down=true, is_knock_in=false)
- **Down-and-In**: Activates if S drops below barrier (is_down=true, is_knock_in=true)
- **Up-and-Out**: Terminates if S rises above barrier (is_down=false, is_knock_in=false)
- **Up-and-In**: Activates if S rises above barrier (is_down=false, is_knock_in=true)

**Rebate:** Fixed payment if knock-out occurs.

**Use Cases:**
- Price structured products with barriers
- Reduce option premium with knock-out features
- Create path-dependent payoffs
- Manage risk with barrier structures

**Tier:** Standard (2 credits/request) [Tier: PRO, Credits: 5]



## OpenAPI

````yaml api-specs/pricing.json post /quantlib/pricing/binomial/barrier
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Pricing Module
  description: >-
    Advanced options pricing models including Black-Scholes, Black76, Bachelier,
    Kirk spread options, and binomial trees. Standard Tier access required (2
    credits per request).
  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-pricing
    description: Advanced options pricing models and Greeks calculation
    x-displayName: Pricing
paths:
  /quantlib/pricing/binomial/barrier:
    post:
      tags:
        - quantlib-pricing
      summary: Binomial Tree Barrier Option
      description: >-
        Price barrier options using binomial trees. Barrier options activate
        (knock-in) or terminate (knock-out) when the underlying crosses a
        barrier level.


        **Barrier Types:**

        - **Down-and-Out**: Terminates if S drops below barrier (is_down=true,
        is_knock_in=false)

        - **Down-and-In**: Activates if S drops below barrier (is_down=true,
        is_knock_in=true)

        - **Up-and-Out**: Terminates if S rises above barrier (is_down=false,
        is_knock_in=false)

        - **Up-and-In**: Activates if S rises above barrier (is_down=false,
        is_knock_in=true)


        **Rebate:** Fixed payment if knock-out occurs.


        **Use Cases:**

        - Price structured products with barriers

        - Reduce option premium with knock-out features

        - Create path-dependent payoffs

        - Manage risk with barrier structures


        **Tier:** Standard (2 credits/request) [Tier: PRO, Credits: 5]
      operationId: binomial_barrier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BinomialBarrierRequest'
            example:
              spot: 100
              strike: 105
              risk_free_rate: 0.05
              dividend_yield: 0.02
              volatility: 0.25
              time_to_maturity: 1
              n_steps: 100
              option_type: call
              barrier: 95
              is_knock_in: false
              is_down: true
              rebate: 2
              method: CRR
      responses:
        '200':
          description: Successful calculation
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      price:
                        type: number
                        description: Barrier option price
                        example: 6.234
                      barrier:
                        type: number
                        description: Barrier level
                        example: 95
                      is_knock_in:
                        type: boolean
                        description: True for knock-in, false for knock-out
                        example: false
                      is_down:
                        type: boolean
                        description: True for down barrier, false for up barrier
                        example: true
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientCreditsError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    BinomialBarrierRequest:
      type: object
      required:
        - spot
        - strike
        - risk_free_rate
        - volatility
        - time_to_maturity
        - barrier
        - is_knock_in
        - is_down
      properties:
        spot:
          type: number
          description: Current price of the underlying asset
          example: 100
        strike:
          type: number
          description: Strike price of the option
          example: 105
        risk_free_rate:
          type: number
          description: Risk-free interest rate (annualized, decimal format)
          example: 0.05
        dividend_yield:
          type: number
          description: Continuous dividend yield (annualized, decimal format)
          example: 0.02
          default: 0
        volatility:
          type: number
          description: Annualized volatility (decimal format)
          example: 0.25
        time_to_maturity:
          type: number
          description: Time to expiration in years
          example: 1
        n_steps:
          type: integer
          description: Number of time steps in the binomial tree
          example: 100
          default: 100
        option_type:
          type: string
          enum:
            - call
            - put
          description: Type of option
          example: call
          default: call
        barrier:
          type: number
          description: Barrier level that triggers knock-in or knock-out
          example: 95
        is_knock_in:
          type: boolean
          description: True for knock-in barrier, false for knock-out barrier
        is_down:
          type: boolean
          description: True for down barrier, false for up barrier
        rebate:
          type: number
          description: Rebate paid if barrier option is knocked out
          example: 0
          default: 0
        method:
          type: string
          enum:
            - CRR
            - JR
            - LR
            - TIAN
          description: Binomial tree method
          example: CRR
          default: CRR
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientCreditsError:
      description: Insufficient API credits for this request
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: >-
                  Insufficient credits. This endpoint costs 2 credits per
                  request.
    ValidationError:
      description: Request validation failed
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: array
                items:
                  type: object
                  properties:
                    loc:
                      type: array
                      items:
                        type: string
                    msg:
                      type: string
                    type:
                      type: string
  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

````