A high-performance, Rust-powered streaming engine for financial data with idiomatic Python bindings. Built on top of Polars for lightning-fast data manipulation and PyO3 for seamless Python integration.
- ⚡ Blazing Fast: Core engine written in Rust with LTO and
target-cpu=nativeoptimizations. - 📊 Polars Powered: First-class support for Polars DataFrames, enabling O(1) lookups and highly efficient aggregations.
- 🕒 Intelligent Timeframes: Sophisticated candle-closing logic that handles market hours, holiday gaps, and diverse timeframes (1m to 1y).
- 📦 Production Ready: Automated build scripts that produce highly-compressed,
manylinux-compatible Python wheels. - 🐍 Pythonic API: Easy-to-use Python interface that feels native.
The project includes an advanced build script that handles environment setup, dependency synchronization, and maximum compression.
To build the most optimized version of the streamer for your current system:
chmod +x helpers/create-wheels.sh
./helpers/create-wheels.shThis will:
- Create/Sync a
.venv. - Compile the Rust core with maximum release optimizations.
- Apply Zopfli-level re-compression (if
advzipis available) to the final wheel. - Place the resulting
.whlin the rootwheels/directory.
Alternatively, if you have maturin installed:
cd src-streamer
maturin develop --releasefrom streamer import Streamer
import polars as pl
# Initialize the streamer
streamer = Streamer()
# Load source data (e.g., 1-minute CSV or Parquet)
streamer.set_stream_data("market_data.csv", input_tf="1m")
# Iterate through the stream row by row
for dt in streamer:
print(f"Current Time: {dt}")
# Check if a higher-level candle has closed
if streamer.is_closed("5m"):
forming = streamer.get_forming_candle("5m")
print(f"🟢 5m Candle Closed! High: {forming['high']}")
# Get the latest aggregated chart data as a Polars DataFrame
if streamer.is_closed("15m"):
df_15m = streamer.get_chart_data("15m")
print(df_15m.tail(5))src-streamer/: Rust source code and PyO3 bindings.helpers/: Production build and maintenance scripts.wheels/: Centralized directory for compiled Python wheels.examples/: Python scripts demonstrating core functionality.
The Rust core is tuned for maximum throughput in Cargo.toml:
| Feature | Optimization | Benefit |
|---|---|---|
opt-level |
3 |
Maximum compiler optimizations |
lto |
true |
Full Link-Time Optimization |
codegen-units |
1 |
Deeper cross-functional analysis |
panic |
abort |
Smaller binary and faster execution |
strip |
true |
Removes debug symbols for production |
MIT License. See LICENSE for details.