docs: create/update README.md for all 17 crates
Create 8 missing READMEs (config, ctrader-openapi, market-data, ml-data, model_loader, risk-data, trading-data, training_uploader). Update 9 existing READMEs to standard template format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,48 +1,24 @@
|
||||
# Backtesting Crate
|
||||
# backtesting
|
||||
|
||||
## Overview
|
||||
Strategy backtesting engine for simulating trading strategies against historical market data.
|
||||
|
||||
The `backtesting` crate provides a robust and configurable engine for simulating trading strategies against historical market data. It enables quantitative analysts and developers to evaluate strategy performance, optimize parameters, and validate hypotheses before live deployment.
|
||||
## Key Types
|
||||
|
||||
- `Backtester` — main backtesting engine
|
||||
- `BacktestConfig` — simulation configuration (time range, instruments, slippage, commissions)
|
||||
- `BacktestResults` — performance metrics (Sharpe, max drawdown, alpha, beta, Sortino)
|
||||
|
||||
## Features
|
||||
|
||||
* **Historical Data Replay:** Efficiently replays market data from Parquet files, supporting various data granularities (ticks, order book snapshots, candles).
|
||||
* **Comprehensive Performance Metrics:** Calculates key performance indicators such as Sharpe Ratio, Maximum Drawdown, Alpha, Beta, Sortino Ratio, and more.
|
||||
* **Realistic Slippage Modeling:** Configurable slippage models (e.g., fixed, percentage, volume-based) to accurately reflect real-world execution costs.
|
||||
* **Commission Modeling:** Supports various commission structures (e.g., fixed per trade, percentage of value, per share/contract) for accurate P&L calculation.
|
||||
* **Detailed Trade Analytics:** Generates in-depth reports on individual trades, cumulative P&L, win/loss ratios, and trade duration analysis.
|
||||
* **Pluggable Strategy Interface:** Defines a clear interface for users to implement and integrate their custom trading strategies seamlessly.
|
||||
- Historical data replay from Parquet files (ticks, order book snapshots, candles)
|
||||
- Configurable slippage models (fixed, percentage, volume-based)
|
||||
- Commission modeling (fixed, percentage, per-contract)
|
||||
- Pluggable strategy interface
|
||||
|
||||
## Usage
|
||||
|
||||
```rust
|
||||
use backtesting::{Backtester, BacktestConfig};
|
||||
use common::types::InstrumentId;
|
||||
use std::path::PathBuf;
|
||||
|
||||
let config = BacktestConfig {
|
||||
start_time: "2023-01-01T00:00:00Z".parse().unwrap(),
|
||||
end_time: "2023-01-02T00:00:00Z".parse().unwrap(),
|
||||
data_path: PathBuf::from("./historical_data/"),
|
||||
instruments: vec![InstrumentId::new("BTCUSD".to_string())],
|
||||
// ... other configuration like slippage, commissions
|
||||
};
|
||||
|
||||
// let mut backtester = Backtester::new(config);
|
||||
// let strategy = MySimpleStrategy::new(); // Initialize your strategy
|
||||
// backtester.run(&strategy).expect("Backtest failed");
|
||||
|
||||
// let results = backtester.get_results();
|
||||
// println!("Sharpe Ratio: {}", results.sharpe_ratio);
|
||||
// println!("Max Drawdown: {}", results.max_drawdown);
|
||||
let config = BacktestConfig { /* ... */ };
|
||||
let results = backtester.run(&strategy)?;
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
cargo test --package backtesting
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
Full API documentation is available at [docs.rs/backtesting](https://docs.rs/backtesting).
|
||||
|
||||
Reference in New Issue
Block a user