> ## 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 Transfer Entropy

> Calculates the transfer entropy from time series X to Y, measuring the reduction in uncertainty about Y's future when conditioning on X's past, beyond what Y's own history provides. Transfer entropy is asymmetric and detects directional information flow, making it ideal for causality detection in financial time series.

**Use Cases:**
- Detect lead-lag relationships between assets
- Identify directional information flow between markets
- Measure predictive causality in trading signals
- Analyze contagion effects across markets
- Study cross-market dependencies and spillovers

**Formula:** TE(X→Y) = I(Y_future; X_past | Y_past)

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



## OpenAPI

````yaml api-specs/physics.json post /quantlib/physics/entropy/transfer
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/transfer:
    post:
      tags:
        - quantlib-physics
      summary: Calculate Transfer Entropy
      description: >-
        Calculates the transfer entropy from time series X to Y, measuring the
        reduction in uncertainty about Y's future when conditioning on X's past,
        beyond what Y's own history provides. Transfer entropy is asymmetric and
        detects directional information flow, making it ideal for causality
        detection in financial time series.


        **Use Cases:**

        - Detect lead-lag relationships between assets

        - Identify directional information flow between markets

        - Measure predictive causality in trading signals

        - Analyze contagion effects across markets

        - Study cross-market dependencies and spillovers


        **Formula:** TE(X→Y) = I(Y_future; X_past | Y_past)


        **Credits:** 5 credits per request (Pro Tier) [Tier: ENTERPRISE,
        Credits: 10]
      operationId: transfer_entropy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - x_history
                - y_history
              properties:
                x_history:
                  type: array
                  items:
                    type: number
                  description: Historical time series for variable X (source)
                  example:
                    - 0.12
                    - 0.15
                    - 0.11
                    - 0.18
                    - 0.14
                    - 0.16
                    - 0.13
                    - 0.17
                    - 0.15
                    - 0.19
                y_history:
                  type: array
                  items:
                    type: number
                  description: Historical time series for variable Y (target)
                  example:
                    - 0.1
                    - 0.13
                    - 0.09
                    - 0.16
                    - 0.12
                    - 0.14
                    - 0.11
                    - 0.15
                    - 0.13
                    - 0.17
                lag:
                  type: integer
                  description: Time lag for transfer entropy calculation (number of steps)
                  default: 1
                  example: 1
                n_bins:
                  type: integer
                  description: >-
                    Number of bins for discretization (higher = finer resolution
                    but needs more data)
                  default: 10
                  example: 10
            examples:
              market_lead:
                summary: Test if X leads Y (e.g., futures leading spot)
                value:
                  x_history:
                    - 100.5
                    - 101.2
                    - 100.8
                    - 102.1
                    - 101.5
                    - 102.8
                    - 102.3
                    - 103.5
                    - 103.1
                    - 104.2
                  y_history:
                    - 100
                    - 100.7
                    - 100.3
                    - 101.5
                    - 101
                    - 102.2
                    - 101.8
                    - 102.9
                    - 102.5
                    - 103.5
                  lag: 1
                  n_bins: 8
              sentiment_returns:
                summary: Sentiment impact on returns
                value:
                  x_history:
                    - 0.5
                    - 0.6
                    - 0.4
                    - 0.7
                    - 0.5
                    - 0.8
                    - 0.6
                    - 0.7
                    - 0.5
                    - 0.9
                  y_history:
                    - 0.01
                    - 0.02
                    - -0.01
                    - 0.03
                    - 0.01
                    - 0.04
                    - 0.02
                    - 0.03
                    - 0.01
                    - 0.05
                  lag: 1
                  n_bins: 5
      responses:
        '200':
          description: Transfer entropy calculated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      transfer_entropy:
                        type: number
                        description: >-
                          Transfer entropy from X to Y (higher = stronger
                          information flow)
                        example: 0.1245
                      lag:
                        type: integer
                        description: Time lag used
                        example: 1
        '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

````