rustrade_backtest/lib.rs
1#![warn(missing_docs)]
2
3//! # rustrade-backtest
4//!
5//! Deterministic backtest engine for [`rustrade_core::Brain`]s. The same
6//! `Brain` trait used by `rustrade` for live trading drives the backtest —
7//! no special "backtest-mode" code paths in the strategy, no duplicate
8//! decision logic to keep in sync.
9//!
10//! See the crate-level [`README.md`](https://github.com/nuniesmith/rustrade/blob/main/crates/rustrade-backtest/README.md)
11//! for a quickstart.
12//!
13//! # Determinism
14//!
15//! Given the same `(Brain, Vec<Candle>, BacktestConfig)` inputs the engine
16//! produces the same [`BacktestResult`] every run. There is no random
17//! number source and no thread interleaving — the loop is single-threaded
18//! and synchronous through every step that affects state.
19//!
20//! # Status
21//!
22//! Phase 4b — adds CSV candle loader, Sharpe/Sortino metrics, and
23//! multi-symbol replay. Parquet loaders and book-walk slippage remain
24//! deferred. See the workspace `TODO.md`.
25
26pub mod config;
27pub mod engine;
28pub mod error;
29pub mod fees;
30pub mod loaders;
31pub mod metrics;
32pub mod result;
33pub mod slippage;
34
35pub use config::{BacktestConfig, BacktestConfigBuilder};
36pub use engine::Backtest;
37pub use error::{Error, Result};
38pub use fees::FeeModel;
39pub use loaders::{load_csv, load_csv_str, sort_chronological};
40pub use metrics::TradeOutcome;
41pub use result::BacktestResult;
42pub use slippage::SlippageModel;