Skip to content

armeya25/fin-streamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Fin-Streamer

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.


✨ Features

  • ⚡ Blazing Fast: Core engine written in Rust with LTO and target-cpu=native optimizations.
  • 📊 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.

🛠️ Installation & Building

The project includes an advanced build script that handles environment setup, dependency synchronization, and maximum compression.

1. Build Optimized Wheels

To build the most optimized version of the streamer for your current system:

chmod +x helpers/create-wheels.sh
./helpers/create-wheels.sh

This will:

  1. Create/Sync a .venv.
  2. Compile the Rust core with maximum release optimizations.
  3. Apply Zopfli-level re-compression (if advzip is available) to the final wheel.
  4. Place the resulting .whl in the root wheels/ directory.

2. Manual Installation

Alternatively, if you have maturin installed:

cd src-streamer
maturin develop --release

🚀 Quick Start

from 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))

🏗️ Project Structure

  • 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.

🏎️ Performance Configuration

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

📄 License

MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors