tickbar 0.1.0

High-performance tick-to-bar aggregator for market data
Documentation

tickbar

Crates.io PyPI Rust 2024

High-performance tick-to-bar aggregator for financial market data.

Converts raw trade/quote ticks into OHLCV bars with configurable time alignment, gap filling, VWAP, and corporate action adjustments. One-pass state machine — 119M ticks/s native Rust, 6.7M ticks/s from Python (PEP 3118 buffer protocol).


Features

  • Fast — 119M ticks/s (Rust), 6.7M ticks/s (Python zero-copy)
  • One-pass streaming — no windowing, no sorting
  • VWAP per bar
  • Gap filling + forward fill
  • Multi-symbol parallel (rayon)
  • Time alignment — UTC or custom offset
  • Corporate actions — split/dividend backward adjustment
  • Export — CSV, Arrow IPC, Polars DataFrame
  • Memory-mapped I/OMmapTickReader
  • Python bindings — zero-copy via PEP 3118 buffer protocol

Quick start

Rust

use std::time::Duration;
use tickbar::{TickAggregator, Tick};

let mut agg = TickAggregator::builder()
    .interval(Duration::from_secs(60))
    .symbol("AAPL")
    .build()?;

agg.push_tick(Tick::from_trade(0, 100.0, 1000.0))?;
agg.push_tick(Tick::from_trade(1_000_000_000, 100.5, 500.0))?;
let bars = agg.finalize();

Python

from tickbar import TickAggregator, Tick

agg = TickAggregator(interval_secs=60)
agg.push_tick(Tick(0, 100.0, 1000.0))
agg.push_tick(Tick(1_000_000_000, 100.5, 500.0))
bars = agg.finalize()

Performance

Path Throughput vs pandas
Rust native 119M ticks/s 25×
Python buffer (PEP 3118) 6.7M ticks/s 1.4×
pandas resample 4.7M ticks/s 1.0×

Documentation

Installation

[dependencies]
tickbar = "0.1"
pip install tickbar

License

MIT