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
//! # Finmoney
//!
//! A precise, panic-free money library for Rust. It provides safe monetary arithmetic,
//! currency-aware values, configurable rounding strategies, and exchange-grade tick handling.
//! Designed for trading systems, bots, and financial apps where correctness and determinism matter.
//!
//! ## Features
//!
//! - **Precise arithmetic**: Built on `rust_decimal` for exact decimal calculations
//! - **Currency safety**: Prevents mixing different currencies in operations
//! - **Configurable rounding**: Multiple rounding strategies for different use cases
//! - **Tick handling**: Exchange-grade price/quantity rounding to valid tick sizes
//! - **Zero panics**: All operations return `Result` types for error handling
//! - **Serde support**: Optional serialization/deserialization (feature-gated)
//!
//! ## Quick Start
//!
//! ```rust
//! use finmoney::{FinMoney, FinMoneyCurrency, FinMoneyRoundingStrategy};
//! use rust_decimal_macros::dec;
//!
//! // Create a currency
//! let usd = FinMoneyCurrency::new(1, "USD", Some("US Dollar"), 2)?;
//!
//! // Create money values
//! let price = FinMoney::new(dec!(10.50), usd);
//! let quantity = FinMoney::new(dec!(3), usd);
//!
//! // Perform arithmetic
//! let total = (price + quantity)?;
//! println!("{}", total); // 13.50 USD
//!
//! // Round to tick size
//! let rounded = price.to_tick_nearest(dec!(0.25))?;
//! # Ok::<(), finmoney::FinMoneyError>(())
//! ```
pub use FinMoneyCurrency;
pub use FinMoneyError;
pub use FinMoney;
pub use FinMoneyRoundingStrategy;
// Re-export commonly used types from dependencies
pub use Decimal;
pub use dec;