> ## 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 Markov Chain Entropy Rate

> Calculates the entropy rate of a Markov chain, measuring the long-run average uncertainty per time step. The entropy rate characterizes the complexity and predictability of a stochastic process governed by Markov transitions, useful for modeling regime-switching markets and state-dependent strategies.

**Use Cases:**
- Measure predictability of market regime transitions
- Characterize complexity of state-based trading strategies
- Analyze credit rating transition dynamics
- Model path-dependent risk scenarios
- Assess information generation rate in stochastic processes

**Formula:** H_rate = -ΣΣ π_i P_ij log(P_ij), where π is stationary distribution

**Credits:** 5 credits per request (Pro Tier) [Tier: ENTERPRISE, Credits: 10]



## OpenAPI

````yaml api-specs/physics.json post /quantlib/physics/entropy/markov-rate
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Physics Module
  description: >-
    Physics and Information Theory module for FinceptQuantLib API. Includes
    Shannon/Renyi/Tsallis entropy, KL/JS divergence, mutual information,
    transfer entropy, Fisher information, Boltzmann distribution, Ising model,
    maximum entropy, thermodynamics (free energy, Carnot cycle, van der Waals
    equation), and Maxwell relations. **Pro Tier required. 5 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-physics
    description: Physics and Information Theory module for FinceptQuantLib API
    x-displayName: Physics
paths:
  /quantlib/physics/entropy/markov-rate:
    post:
      tags:
        - quantlib-physics
      summary: Calculate Markov Chain Entropy Rate
      description: >-
        Calculates the entropy rate of a Markov chain, measuring the long-run
        average uncertainty per time step. The entropy rate characterizes the
        complexity and predictability of a stochastic process governed by Markov
        transitions, useful for modeling regime-switching markets and
        state-dependent strategies.


        **Use Cases:**

        - Measure predictability of market regime transitions

        - Characterize complexity of state-based trading strategies

        - Analyze credit rating transition dynamics

        - Model path-dependent risk scenarios

        - Assess information generation rate in stochastic processes


        **Formula:** H_rate = -ΣΣ π_i P_ij log(P_ij), where π is stationary
        distribution


        **Credits:** 5 credits per request (Pro Tier) [Tier: ENTERPRISE,
        Credits: 10]
      operationId: markov_entropy_rate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - transition_matrix
              properties:
                transition_matrix:
                  type: array
                  items:
                    type: array
                    items:
                      type: number
                  description: Markov transition probability matrix (rows must sum to 1)
                  example:
                    - - 0.7
                      - 0.2
                      - 0.1
                    - - 0.3
                      - 0.5
                      - 0.2
                    - - 0.1
                      - 0.3
                      - 0.6
                stationary_dist:
                  type: array
                  items:
                    type: number
                  description: >-
                    Stationary distribution (optional - will be computed if not
                    provided)
                  nullable: true
                  example:
                    - 0.35
                    - 0.35
                    - 0.3
                base:
                  type: number
                  description: Logarithm base for entropy calculation
                  default: 2.718281828459045
                  example: 2.718281828459045
            examples:
              market_regimes:
                summary: Three-state market regime model
                value:
                  transition_matrix:
                    - - 0.8
                      - 0.15
                      - 0.05
                    - - 0.2
                      - 0.7
                      - 0.1
                    - - 0.1
                      - 0.2
                      - 0.7
                  base: 2.718281828459045
              credit_transitions:
                summary: Credit rating transitions
                value:
                  transition_matrix:
                    - - 0.9
                      - 0.08
                      - 0.02
                    - - 0.05
                      - 0.85
                      - 0.1
                    - - 0.02
                      - 0.13
                      - 0.85
                  stationary_dist:
                    - 0.4
                    - 0.35
                    - 0.25
                  base: 2
      responses:
        '200':
          description: Markov entropy rate calculated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      entropy_rate:
                        type: number
                        description: Entropy rate (bits or nats per step)
                        example: 0.6547
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientCreditsError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  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
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Insufficient credits. This endpoint requires 5 credits.
    ValidationError:
      description: Request validation error
      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

````