Skip to content

Batch & Streaming Examples

QuantWave allows you to use the same logic for both batch processing and streaming.

Batch Processing (Polars)

import polars as pl
from quantwave import ta

df = pl.read_parquet("data.parquet")
df = df.with_columns(ta.rsi("close", 14).alias("rsi"))
use polars::prelude::*;
use quantwave_polars::TA;

let df = df.lazy().ta().rsi("close", 14).collect()?;

Streaming Processing

from quantwave import RSI

rsi = RSI(14)
for price in prices:
    print(rsi.next(price))
use quantwave_core::indicators::RSI;
use quantwave_core::traits::Next;

let mut rsi = RSI::new(14);
for price in prices {
    println!("{:?}", rsi.next(price));
}