1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Bit-faithful Rust port of the **Lorentzian Classification** indicator.
//!
//! This crate is a direct, forward-indexed port of the PineScript v6 reference
//! (and the parity-tested Python port under `ports/python`). Series use index
//! `0` as the oldest bar, and missing Pine `na` values are represented as
//! [`f64::NAN`] ([`MISSING`]).
//!
//! The implementation is deliberately allocation-simple and dependency-light so
//! it stays easy to audit against the reference. Floating-point operations
//! mirror the Python port's accumulation order and rounding (banker's rounding
//! via [`f64::round_ties_even`], libm `powf`/`exp`), which makes the two ports
//! bit-for-bit equal and keeps the crate within `1e-6` of the TradingView gold
//! baselines.
//!
//! # Cargo features
//!
//! * **`csv`** (default): TradingView CSV input ([`read_tradingview_csv`]) and
//! Pine-export parity checking (the [`parity`] module), via the established
//! `csv` crate so valid quoted CSV behaves like Python's standard `csv`
//! parser. Disable it (`default-features = false`) for a zero-dependency
//! numeric core when you feed [`Bar`] values from your own data pipeline.
//!
//! # Example
//! ```
//! use lorentzian_classification_core::{calculate, Bar, Settings};
//!
//! let bars: Vec<Bar> = (0..32)
//! .map(|i| {
//! let c = 100.0 + f64::from(i);
//! Bar { time: i.to_string(), open: c, high: c + 1.0, low: c - 1.0, close: c }
//! })
//! .collect();
//! let rows = calculate(&bars, &Settings::default(), 0.0);
//! assert_eq!(rows.len(), bars.len());
//! ```
// Published crate: every public item must be documented.
// Numeric casts are pervasive in this index-heavy numeric port and are always
// within range for realistic bar counts; flagging each one adds noise.
// The following pedantic lints conflict with this crate's stated goal of a
// 1:1, line-faithful translation of the PineScript / Python reference:
// `Settings`/`ResultRow` mirror the Pine inputs and outputs (many bools);
// paired bindings like `is_ema_up`/`is_sma_up` are intentionally parallel; the
// `x != 0.0 ? a : b` divide-by-zero guards mirror the reference expressions.
// doc_markdown flags every product name (PineScript, TradingView, …); not worth
// the backtick churn for prose.
pub use AnnState;
pub use detect_price_scale;
pub use ;
pub use ;
pub use ;
pub use ;