rangebar-cli

Crates.iorangebar-cli
lib.rsrangebar-cli
version6.1.1
created_at2025-11-12 06:20:23.890983+00
updated_at2026-01-10 12:50:54.202236+00
descriptionCommand-line tools for range bar processing and analysis
homepagehttps://github.com/terrylica/rangebar
repositoryhttps://github.com/terrylica/rangebar
max_upload_size
id1928866
size230,005
Terry Li (terrylica)

documentation

README

rangebar

Crates.io Documentation License: MIT

Non-lookahead range bar construction for cryptocurrency and forex trading.

Crates.io Documentation License: MIT

This crate provides algorithms for constructing range bars from tick data with temporal integrity guarantees, ensuring no lookahead bias in financial backtesting.

Installation

Add to your Cargo.toml:

[dependencies]
rangebar = "6.1"

Meta-Crate

This is a meta-crate that re-exports all rangebar sub-crates for backward compatibility with v4.0.0. New code should depend on specific sub-crates directly:

  • rangebar-core - Core algorithm and types
  • rangebar-providers - Data providers (Binance, Exness)
  • rangebar-config - Configuration management
  • rangebar-io - I/O operations and Polars integration
  • rangebar-streaming - Real-time streaming processor
  • rangebar-batch - Batch analytics engine
  • rangebar-cli - Command-line tools

Features

  • core - Core algorithm (always enabled)
  • providers - Data providers (Binance, Exness)
  • config - Configuration management
  • io - I/O operations and Polars integration
  • streaming - Real-time streaming processor
  • batch - Batch analytics engine
  • full - Enable all features

Basic Usage

use rangebar::{RangeBarProcessor, AggTrade, FixedPoint};

// Create processor with 25 basis points threshold (0.25%)
let mut processor = RangeBarProcessor::new(250).unwrap();

// Create sample aggTrade
let trade = AggTrade {
    agg_trade_id: 1,
    price: FixedPoint::from_str("50000.0").unwrap(),
    volume: FixedPoint::from_str("1.0").unwrap(),
    first_trade_id: 1,
    last_trade_id: 1,
    timestamp: 1609459200000,
    is_buyer_maker: false,
    is_best_match: None,
};

// Process aggTrade records into range bars
let agg_trade_records = vec![trade];
let bars = processor.process_agg_trade_records(&agg_trade_records).unwrap();

Dual-Path Architecture

Streaming Mode (Real-time)

use rangebar::streaming::StreamingProcessor;

let threshold_decimal_bps = 250; // 25 bps = 0.25% range bars
let processor = StreamingProcessor::new(threshold_decimal_bps);
// Real-time processing with bounded memory

Batch Mode (Analytics)

use rangebar::batch::BatchAnalysisEngine;
use rangebar::core::types::RangeBar;

let range_bars: Vec<RangeBar> = vec![]; // Your range bar data
let engine = BatchAnalysisEngine::new();
// let result = engine.analyze_single_symbol(&range_bars, "BTCUSDT").unwrap();

Links

License

MIT license. See LICENSE for details.

Commit count: 0

cargo fmt