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
//! Backtesting engine for strategy validation on historical data.
//!
//! This module provides an event-driven backtesting engine that simulates
//! strategy execution on historical market data.
//!
//! # Overview
//!
//! The backtesting module includes:
//!
//! - **Data types**: `MarketTick`, `OHLCVBar` for market data
//! - **Data sources**: `HistoricalDataSource` trait and `VecDataSource` implementation
//! - **Strategy trait**: `BacktestStrategy` for strategy integration
//! - **Engine**: `BacktestEngine` for running simulations
//! - **Results**: `BacktestResult` with comprehensive metrics
//! - **Fill models**: Realistic fill simulation with queue position and market impact
//! - **Performance metrics**: Comprehensive metrics calculation (Sharpe, Sortino, etc.)
//!
//! # Example
//!
//! ```rust
//! use market_maker_rs::backtest::{
//! BacktestConfig, BacktestEngine, MarketTick, VecDataSource, SlippageModel
//! };
//! use market_maker_rs::dec;
//!
//! // Create sample market data
//! let ticks = vec![
//! MarketTick::new(1000, dec!(100.0), dec!(1.0), dec!(100.1), dec!(1.0)),
//! MarketTick::new(1001, dec!(100.1), dec!(1.0), dec!(100.2), dec!(1.0)),
//! ];
//!
//! let data_source = VecDataSource::new(ticks);
//! let config = BacktestConfig::default();
//!
//! // In practice, you would implement BacktestStrategy for your strategy
//! // let mut engine = BacktestEngine::new(config, strategy, data_source);
//! // let result = engine.run();
//! ```
/// Data types for market data.
/// Backtesting engine implementation.
/// Realistic fill models for backtesting.
/// Performance metrics calculator.
pub use ;
pub use ;
pub use ;
pub use ;