Principle:TA Lib Ta lib python Stream Event Integration
| Knowledge Sources | |
|---|---|
| Domains | Real_Time_Processing, Technical_Analysis |
| Last Updated | 2026-02-09 22:00 GMT |
Overview
An integration pattern for incorporating streaming indicator values into event-driven systems with transparent pandas/polars Series support.
Description
Streaming functions can be accessed through the main talib module (as talib.stream_SMA, talib.stream_RSI, etc.) where they benefit from the same _wrapper decorator that handles pandas/polars type conversion for the Function API.
The wrapper detects that streaming results are scalars (not arrays) by checking hasattr(result, '__len__') and returns them as-is, without attempting to convert them to Series objects.
Usage
Use this principle when integrating streaming indicators into systems that use pandas or polars as their data layer. The wrapper handles type conversion transparently.
Theoretical Basis
The streaming wrapper integration follows a detection pattern:
# Streaming result detection in _wrapper
result = func(*numpy_args)
first_result = result[0] if isinstance(result, tuple) else result
is_streaming = not hasattr(first_result, '__len__')
if is_streaming:
return result # Return scalar as-is, skip Series conversion