Skip to main content

rangebar_core/
lib.rs

1//! Core range bar processing algorithms
2//!
3//! Non-lookahead bias range bar construction with temporal integrity guarantees.
4//!
5//! ## Features
6//!
7//! - Non-lookahead bias: Thresholds computed only from bar open price
8//! - Breach inclusion: Breaching trade included in closing bar
9//! - Fixed thresholds: Never recalculated during bar lifetime
10//! - Temporal integrity: Guaranteed correct historical simulation
11//! - **Cross-file checkpoints**: Seamless continuation across file boundaries (v6.1.0+)
12//! - **Arrow export**: Zero-copy streaming to Python via Arrow RecordBatch (v8.0.0+)
13
14pub mod checkpoint;
15pub mod errors;
16pub mod export_processor; // Export-oriented processor (extracted Phase 2d)
17pub mod fixed_point;
18pub mod interbar; // Issue #59: Inter-bar microstructure features (lookback window BEFORE bar)
19pub(crate) mod interbar_math; // Issue #59: Inter-bar math helpers (extracted Phase 2e)
20pub mod interbar_types; // Issue #59: Inter-bar type definitions (extracted Phase 2b)
21pub mod intrabar; // Issue #59: Intra-bar features (trades WITHIN bar)
22pub mod processor;
23pub mod timestamp;
24pub mod trade; // Trade/DataSource types (extracted Phase 2c)
25pub mod types;
26
27// Arrow export (only available with arrow feature)
28#[cfg(feature = "arrow")]
29pub mod arrow_export;
30
31// Test utilities (only available in test builds or with test-utils feature)
32#[cfg(any(test, feature = "test-utils"))]
33pub mod test_utils;
34
35#[cfg(any(test, feature = "test-utils"))]
36pub mod test_data_loader;
37
38/// Feature manifest TOML, embedded at compile time.
39/// SSoT for all microstructure feature metadata (Issue #95).
40/// Exposed to Python via PyO3 `get_feature_manifest_raw()`.
41pub const FEATURE_MANIFEST_TOML: &str = include_str!("../data/feature_manifest.toml");
42
43// Re-export commonly used types
44pub use checkpoint::{AnomalySummary, Checkpoint, CheckpointError, PositionVerification};
45pub use fixed_point::FixedPoint;
46pub use interbar::{InterBarConfig, InterBarFeatures, LookbackMode, TradeHistory, TradeSnapshot};
47pub use intrabar::{IntraBarFeatures, compute_intra_bar_features};
48pub use processor::{ExportRangeBarProcessor, ProcessingError, RangeBarProcessor};
49pub use timestamp::{
50    create_aggtrade_with_normalized_timestamp, normalize_timestamp, validate_timestamp,
51};
52pub use types::{AggTrade, DataSource, RangeBar};
53
54// Arrow export re-exports (only available with arrow feature)
55#[cfg(feature = "arrow")]
56pub use arrow_export::{
57    ArrowImportError,
58    aggtrade_schema,
59    aggtrades_to_record_batch,
60    rangebar_schema,
61    rangebar_vec_to_record_batch,
62    // Issue #88: Arrow-native input path
63    record_batch_to_aggtrades,
64};