Skip to main content

quant_primitives/
lib.rs

1#![cfg_attr(
2    test,
3    allow(
4        clippy::expect_used,
5        clippy::unwrap_used,
6        clippy::panic,
7        clippy::indexing_slicing
8    )
9)]
10
11//! Pure trading primitives — cross-cutting value objects for quantitative finance.
12//!
13//! Leaf crate: no internal dependencies. Only external: chrono, rust_decimal, serde, thiserror.
14//!
15//! # Provided types
16//!
17//! - [`Candle`] — OHLCV bar with timestamp
18//! - [`Interval`] — time granularity (minute, hour, day, week)
19//! - [`Symbol`] — trading pair (e.g., BTC/USDT)
20//! - [`Ticker`] — universal asset identifier with venue/asset class metadata
21//! - [`Currency`] — currency code (e.g., USD, BTC)
22//! - [`PositionConfig`] — position sizing rules
23//! - [`precision_boundary`] — canonical `Decimal ↔ f64` crossings with rich error enum
24
25mod bps;
26mod candle;
27pub mod crypto_classifier;
28mod currency;
29mod fraction;
30mod interval;
31mod percentage;
32mod position_config;
33pub mod precision_boundary;
34mod symbol;
35pub mod taxonomy;
36
37pub use bps::{Bps, BpsError};
38pub use candle::{Candle, CandleError, CandleQuality, CandleRange, VolumeSource};
39pub use currency::Currency;
40pub use fraction::{Fraction, FractionError};
41pub use interval::{interval_duration, Interval, IntervalError};
42pub use percentage::{Percentage, PercentageError};
43pub use position_config::{PositionConfig, PositionConfigError};
44pub use precision_boundary::{
45    decimal_to_f64_checked, f64_to_decimal_checked, NonFiniteKind, PrecisionBoundaryError,
46};
47pub use symbol::{Symbol, SymbolError};
48pub use taxonomy::{AssetClass, AssetType, Derivative, Ticker, TickerError, Underlying, VenueType};