Skip to main content

backtest

Function backtest 

Source
pub async fn backtest<MarketData, SummaryInterval, Strategy, Risk, GlobalData, InstrumentData>(
    args_constant: Arc<BacktestArgsConstant<MarketData, SummaryInterval, EngineState<GlobalData, InstrumentData>>>,
    args_dynamic: BacktestArgsDynamic<Strategy, Risk>,
) -> Result<BacktestSummary<SummaryInterval>, BarterError>
where MarketData: BacktestMarketData<Kind = InstrumentData::MarketEventKind>, SummaryInterval: TimeInterval, Strategy: AlgoStrategy<State = EngineState<GlobalData, InstrumentData>> + ClosePositionsStrategy<State = EngineState<GlobalData, InstrumentData>> + OnTradingDisabled<HistoricalClock, EngineState<GlobalData, InstrumentData>, MultiExchangeTxMap, Risk> + OnDisconnectStrategy<HistoricalClock, EngineState<GlobalData, InstrumentData>, MultiExchangeTxMap, Risk> + Send + 'static, <Strategy as OnTradingDisabled<HistoricalClock, EngineState<GlobalData, InstrumentData>, MultiExchangeTxMap, Risk>>::OnTradingDisabled: Debug + Clone + Send, <Strategy as OnDisconnectStrategy<HistoricalClock, EngineState<GlobalData, InstrumentData>, MultiExchangeTxMap, Risk>>::OnDisconnect: Debug + Clone + Send, Risk: RiskManager<State = EngineState<GlobalData, InstrumentData>> + Send + 'static, GlobalData: for<'a> Processor<&'a MarketEvent<InstrumentIndex, InstrumentData::MarketEventKind>> + for<'a> Processor<&'a AccountEvent> + Debug + Clone + Default + Send + 'static, InstrumentData: InstrumentDataState + Send + 'static,
Expand description

Run a single backtest with the given parameters.

Simulates a trading strategy using historical market data and generates performance metrics.