Uses of Package
com.quantfinlib.backtest
Packages that use com.quantfinlib.backtest
Package
Description
The alpha research pipeline — signal to evaluated, validated, cost-aware,
constructed, reported strategy, with each stage a separate, composable
step:
Signal generation —
Factors:
nine standard factors (MA crossover, contrarian RSI, MACD,
Bollinger reversion, mean reversion, 12-1 momentum, value, quality,
low volatility) producing raw cross-sectional scores over an
AlphaContext panel;
Evaluation — SignalEvaluator:
rank IC, IR, t-stat, hit rate, turnover, cross-factor exposure —
the cheap filter before any backtest;
Validation — AlphaValidation:
walk-forward selection with OOS efficiency, blocked k-fold
consistency, Monte Carlo permutation p-values, parameter
sensitivity — the overfitting defense;
Execution-aware backtest —
AlphaBacktester: commission, bid-ask
spread, slippage and square-root market impact
(microstructure.MarketImpactModel), with gross-vs-net cost
decomposition;
Portfolio construction —
PortfolioConstruction: z-score
sizing with caps, inverse-vol risk budgeting, sector and beta
neutralization, mean-variance tilt;
Reporting — AlphaReport:
alpha decay with half-life, OLS factor attribution, drawdown
curves, rolling Sharpe, and the shared ratio set from
backtest.PerformanceAnalytics.
Bar-based backtesting.
Multi-asset backtesting:
PortfolioBacktester rebalances
long/short weight targets from a
PortfolioStrategy with
commission and turnover tracking (input series must be index-aligned —
see data.SeriesAligner), and in its survivorship-aware overload
consumes a data.PointInTimeUniverse (delistings terminate at the
delisting return, mergers convert at deal terms, index drops force sales)
plus explicit ex-date cash dividends;
CrossSectionalMomentum is the
built-in point-in-time factor strategy (12-1 momentum ranked over the
members alive at each rebalance);
PositionSizing supplies Kelly,
fixed-fractional risk, inverse-volatility weights and vol-target leverage.Built-in
TradingStrategy implementations:
SMA/EMA crossovers, RSI mean reversion, MACD signal-line cross, and
Bollinger band reversion.Event-driven tick-level backtesting — the level below bars, where queue
position decides whether a passive order actually trades:
TickBacktester replays QFLT tick
files through a TickStrategy with
microstructure-aware fills (market orders pay half the spread; limit
orders fill on trade-through or earn fills print-by-print against a
simulated queue; optional tick-size grid for real-world prices; no fills
against the triggering print).The defense against overfit backtests:
ParameterGrid +
GridSearchOptimizer enumerate
and rank parameter combinations;
WalkForwardAnalyzer optimizes
on rolling train windows and evaluates on unseen test windows, stitching
out-of-sample equity (capital carries across folds) and reporting the
walk-forward efficiency ratio;
SharpeValidation applies the
Bailey/López de Prado probabilistic and deflated Sharpe — the
multiple-testing haircut for grid-picked winners — plus the minimum
track record length (how many periods before the record MEANS
something, in closed form);
BlockBootstrap hands the
backtest Sharpe its sampling DISTRIBUTION (stationary Politis-Romano
blocks — an iid resample destroys the autocorrelation and understates
the uncertainty, the classic route to false confidence): the honest
question is whether the 5th percentile is still positive, not whether
1.2 is a good number.Strategy Builder DSL: compose
Rules (built via
Rules factories over indicator arrays, with
and/or/not combinators) into a backtestable strategy through
StrategyBuilder — entry/exit rules, stop loss
and take profit in a fluent chain.Professional report generation, all writers hand-rolled on the JDK:
ReportGenerator assembles portfolio,
performance, risk, allocation, trade, Monte Carlo and technical sections
into a Report, exported as HTML (with
inline SvgCharts equity/drawdown charts),
CSV, PDF, or XLSX.-
Classes in com.quantfinlib.backtest used by com.quantfinlib.alpha
-
Classes in com.quantfinlib.backtest used by com.quantfinlib.backtestClassDescriptionBacktest execution parameters.Result of a backtest run: full equity curve (one point per bar), completed trade history, and derived performance metrics.One peak-to-recovery episode.The TCA-style verdict for one parent worked over one session.Result of an execution-aware backtest: the standard
BacktestResult(equity curve, trades, performance metrics) plus the full parent-order / child-fill history, with one-call TCA per parent order.How parent orders turn into fills in an execution-aware backtest (ExecutionAwareBacktester).Baseline execution model: the full quantity fills at the bar close with commission and slippage folded into the all-in price — equivalent to the classicBacktesterfill assumption.One parent order worked by theExecutionAwareBacktester: the signal that created it, the arrival price (close at signal time — the TCA benchmark), and the child fills with the bar index each filled on.Strategy performance analytics.Trading signal emitted by a strategy for a single bar.A completed round-trip trade.A pluggable per-trade cost model — the ONE definition of "what a trade costs" shared by the backtest engines, so an execution-aware number and a survivorship-aware number can come out of the same run:TradeCostModel.flat(double)— a fixed all-in bps (the classic commission assumption, and the exact equivalent of the legacycommissionRateconfigs);TradeCostModel.institutional(double, double, double, int)— commission + half-spread + slippage + square-root market impact, with per-symbol ADV/vol estimated from the trailing bars viaMarketImpactModel.estimate(com.quantfinlib.core.BarSeries, int, int).A bar-driven trading strategy. -
Classes in com.quantfinlib.backtest used by com.quantfinlib.backtest.portfolioClassDescriptionStrategy performance analytics.A pluggable per-trade cost model — the ONE definition of "what a trade costs" shared by the backtest engines, so an execution-aware number and a survivorship-aware number can come out of the same run:
TradeCostModel.flat(double)— a fixed all-in bps (the classic commission assumption, and the exact equivalent of the legacycommissionRateconfigs);TradeCostModel.institutional(double, double, double, int)— commission + half-spread + slippage + square-root market impact, with per-symbol ADV/vol estimated from the trailing bars viaMarketImpactModel.estimate(com.quantfinlib.core.BarSeries, int, int). -
Classes in com.quantfinlib.backtest used by com.quantfinlib.backtest.strategiesClassDescriptionTrading signal emitted by a strategy for a single bar.A bar-driven trading strategy.
-
Classes in com.quantfinlib.backtest used by com.quantfinlib.backtest.tick
-
Classes in com.quantfinlib.backtest used by com.quantfinlib.backtest.validationClassDescriptionBacktest execution parameters.Strategy performance analytics.A completed round-trip trade.A bar-driven trading strategy.
-
Classes in com.quantfinlib.backtest used by com.quantfinlib.dslClassDescriptionBacktest execution parameters.Result of a backtest run: full equity curve (one point per bar), completed trade history, and derived performance metrics.Trading signal emitted by a strategy for a single bar.A bar-driven trading strategy.
-
Classes in com.quantfinlib.backtest used by com.quantfinlib.reportClassDescriptionResult of a backtest run: full equity curve (one point per bar), completed trade history, and derived performance metrics.Strategy performance analytics.A completed round-trip trade.