Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:TA Lib Ta lib python Abstract Data Input

From Leeroopedia
Revision as of 18:10, 16 February 2026 by Admin (talk | contribs) (Auto-imported from principles/TA_Lib_Ta_lib_python_Abstract_Data_Input.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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

Overview

A data input pattern for the Abstract API where OHLCV price data is provided as a dictionary of arrays, a pandas DataFrame, or a polars DataFrame with named price series keys.

Description

The Abstract API accepts input data in a structured format with named price series. Unlike the Function API which takes individual arrays, the Abstract API expects a single data structure with keys matching the required price series names: open, high, low, close, and volume.

Supported input types:

  • dict of numpy arrays: {'open': np.array(...), 'close': np.array(...)}
  • pandas.DataFrame: Columns accessed by name
  • polars.DataFrame: Columns accessed by name

The default price series mapping is defined in __INPUT_PRICE_SERIES_DEFAULTS which maps abstract input names to concrete price series keys.

Usage

Use this pattern when working with the Abstract API (talib.abstract.Function). Prepare your data as a dict with the standard OHLCV keys, or pass a DataFrame directly.

Theoretical Basis

The Abstract API uses named input mapping:

# Abstract input mapping concept
__INPUT_PRICE_SERIES_DEFAULTS = {
    'price':   'close',
    'price0':  'high',
    'price1':  'low',
    'prices':  ['open', 'high', 'low', 'close'],
    'periods': ['periods'],
}

# Each indicator declares which input names it uses
# e.g., SMA uses 'price' -> resolves to 'close'
# e.g., ATR uses 'prices' -> resolves to ['open', 'high', 'low', 'close']

The input validation checks that all required keys exist in the provided dict/DataFrame before computation.

Related Pages

Implemented By

Page Connections

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