Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:TA Lib Ta lib python Abstract Function Execution

From Leeroopedia


Knowledge Sources
Domains Technical_Analysis, Software_Architecture
Last Updated 2026-02-09 22:00 GMT

Overview

An execution pattern for computing indicator values through a Function object interface, supporting both explicit method calls and implicit callable invocation.

Description

The Abstract API provides three ways to execute a configured Function and retrieve results:

  1. outputs property: Returns cached results (recomputes if inputs/parameters changed)
  2. run(input_arrays): Sets input arrays and returns outputs in one call
  3. __call__(*args, **kwargs): Allows calling the Function object like a function with the same signature as the Function API

The execution caches results and only recomputes when inputs or parameters change (tracked via the outputs_valid flag). Output format adapts to input type — pandas DataFrame input yields pandas Series/DataFrame output.

Usage

Use this principle when you need to execute indicators through the Abstract API. Choose between the three execution methods based on your workflow:

  • outputs — when data and params are already set
  • run() — when you want to set data and execute in one step
  • __call__() — when you want the same syntax as the Function API

Theoretical Basis

The execution pattern implements lazy evaluation with caching:

# Abstract execution pattern
if not outputs_valid:
    results = call_c_function(input_arrays, parameters)
    cache_results(results)
    outputs_valid = True
return cached_results

Output conversion preserves input types:

  • dict input → numpy array/list output
  • pandas.DataFrame input → pandas.Series/DataFrame output
  • polars.DataFrame input → polars.Series/DataFrame output

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment