Class AlphaBacktester

java.lang.Object
com.quantfinlib.alpha.AlphaBacktester

public final class AlphaBacktester extends Object
Execution-aware factor backtest: runs a factor through a construction pipeline into weights, holds them between rebalances, and charges the four costs that separate paper alpha from real alpha:
  • Commission — flat bps on traded notional;
  • Bid-ask spread — half-spread bps paid on every trade (crossing the spread once per side);
  • Slippage — additional fixed bps of implementation noise (latency, partial fills, venue fees);
  • Market impact — the size-dependent cost, via the square-root law in microstructure.MarketImpactModel, with per-symbol ADV and daily vol estimated from the trailing window. This is the term that grows with capital: the same signal that nets 8% on $10m can net zero on $1b.

The simulation is weight-based (fractional book, returns compound multiplicatively from 1.0): simpler and adequate for factor research. For share-level accounting with lifecycle events, feed the constructed weights into backtest.portfolio.PortfolioBacktester's survivorship-aware overload with Config.withCostModel(TradeCostModel.institutional(...)) — since both engines share the same impact estimator (MarketImpactModel.estimate) and cost decomposition, a run over there is execution-aware AND survivorship-aware at once; this engine's added value is the per-component cost drag breakdown.

Both gross and net curves are tracked, plus the cumulative drag of each cost component — "which cost kills this signal" is the actionable output of an execution-aware backtest.