42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""Backtest configuration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from datetime import datetime
|
|
|
|
|
|
@dataclass
|
|
class BacktestConfig:
|
|
"""Configuration for a single backtest run.
|
|
|
|
Attributes
|
|
----------
|
|
start_date:
|
|
Inclusive start of the replay window.
|
|
end_date:
|
|
Inclusive end of the replay window.
|
|
initial_capital:
|
|
Starting cash balance in USD.
|
|
commission_per_trade:
|
|
Fixed commission charged per order (Alpaca is commission-free,
|
|
so the default is 0.0).
|
|
slippage_pct:
|
|
Simulated slippage as a fraction of price (0.001 = 0.1%).
|
|
strategy_weights:
|
|
Mapping of strategy name to weight. If empty, strategies
|
|
receive equal weight (0.333...).
|
|
max_position_pct:
|
|
Maximum fraction of equity per position (default 5%).
|
|
signal_threshold:
|
|
Minimum combined signal strength to trigger a trade (default 0.3).
|
|
"""
|
|
|
|
start_date: datetime
|
|
end_date: datetime
|
|
initial_capital: float = 100_000.0
|
|
commission_per_trade: float = 0.0
|
|
slippage_pct: float = 0.001
|
|
strategy_weights: dict[str, float] = field(default_factory=dict)
|
|
max_position_pct: float = 0.05
|
|
signal_threshold: float = 0.3
|