Uses of Interface
com.quantfinlib.alpha.AlphaFactor
Packages that use AlphaFactor
Package
Description
Cross-sectional alpha research: signal generation, evaluation,
validation, execution-aware backtesting, portfolio construction and
reporting, each a separate step.
-
Uses of AlphaFactor in com.quantfinlib.alpha
Classes in com.quantfinlib.alpha that implement AlphaFactorModifier and TypeClassDescriptionstatic final classFitted weights and the combined factor.Methods in com.quantfinlib.alpha that return AlphaFactorModifier and TypeMethodDescriptionstatic AlphaFactorFactors.bollinger(int period, double stdDevs) Bollinger mean reversion:−(close − SMA) / (k·σ)— the negative band position, +1 at the lower band, −1 at the upper.static AlphaFactorFactors.lowVolatility(int lookback) Low-volatility anomaly:−σ(returns)over the lookback, calm names scoring high.static AlphaFactorFactors.macd(int fast, int slow, int signal) MACD histogram normalized by price:(macdLine − signalLine) / close.static AlphaFactorFactors.meanReversion(int lookback) Plain mean reversion:−(close / SMA − 1)— how far the price sits below its own average, as a fraction.static AlphaFactorFactors.momentum(int lookback, int skip) Cross-sectional momentum:close[i−skip] / close[i−lookback] − 1.static AlphaFactorFactors.movingAverageCrossover(int fast, int slow) Moving-average crossover:(SMA_fast − SMA_slow) / SMA_slow.static AlphaFactorFactors.prepared(AlphaFactor factor, double p, Map<String, String> sectorBySymbol) The standard preparation chain:Factors.winsorized(AlphaFactor, double)atp, thenFactors.standardized(AlphaFactor), thenFactors.sectorNeutralized(AlphaFactor, Map)(skipped whensectorBySymbolis null).static AlphaFactorFactors.quality()Quality composite: profitability minus leverage —ROE − 0.1 × debt/equity.static AlphaFactorFactors.rsi(int period) Contrarian RSI:(50 − RSI) / 50, in [−1, +1].static AlphaFactorFactors.sectorNeutralized(AlphaFactor factor, Map<String, String> sectorBySymbol) Demeans scores within each sector per date, so the factor ranks names against their sector peers.static AlphaFactorFactors.standardized(AlphaFactor factor) Cross-sectional z-score per date:(s − mean)/sdover the scored names (population sd); all-zero when the scores have no dispersion.static AlphaFactorFactors.value()Value composite: the average of earnings yield and book yield (1/PB).static AlphaFactorFactors.winsorized(AlphaFactor factor, double p) Clips each date's scores to the cross-sectionalpand1 − pquantiles (linear interpolation between order statistics), NaN entries untouched.Methods in com.quantfinlib.alpha with parameters of type AlphaFactorModifier and TypeMethodDescriptionstatic CapacityCurveCapacityCurve.compute(AlphaContext ctx, AlphaFactor factor, AlphaBacktester.Config base, AlphaBacktester.RiskOptions options, double[] capitals, double maxParticipation) AsCapacityCurve.compute(AlphaContext, AlphaFactor, AlphaBacktester.Config, AlphaBacktester.WeightBuilder, double[], double)with the risk-model construction.static CapacityCurveCapacityCurve.compute(AlphaContext ctx, AlphaFactor factor, AlphaBacktester.Config base, AlphaBacktester.WeightBuilder builder, double[] capitals, double maxParticipation) Runs the backtest at each capital (ascending, each > 0) with the given construction.AlphaValidation.crossValidate(AlphaContext ctx, AlphaFactor factor, int horizon, int startIndex, int k) Splits the evaluation range intokcontiguous blocks and recomputes the mean IC inside each.static AlphaReport.DecayAlphaReport.decayProfile(AlphaContext ctx, AlphaFactor factor, int startIndex, int[] horizons) Mean IC against cumulative forward returns(t, t+h]at each horizon (non-overlapping grid per horizon).static SignalEvaluator.ReportSignalEvaluator.evaluate(AlphaContext ctx, AlphaFactor factor, int startIndex, int horizon) Evaluates a factor at every bar in[startIndex, ctx.bars() − horizon)against overlappinghorizon-bar forward returns (see the class doc for each metric).static doubleSignalEvaluator.factorExposure(AlphaContext ctx, AlphaFactor a, AlphaFactor b, int startIndex, int step) Mean cross-sectional rank correlation between two factors' scores — how much of factor B is already inside factor A.static AlphaReport.LagDecayAlphaReport.lagIcProfile(AlphaContext ctx, AlphaFactor factor, int startIndex, int maxLag) IC of the scores attagainst the one-bar return over(t+h−1, t+h]forh = 1..maxLag, averaged over every bartfromstartIndexwith the whole window in sample, then fitted by least squares toIC(h) = IC₀·exp(−(h−1)/τ)(for fixed τ the optimal IC₀ is closed-form; τ is found by golden-section search onlog τover [0.05, 10⁵] bars, and reported as+∞when the best fit sits at the upper bound).static double[]FactorReturns.longShort(AlphaContext ctx, AlphaFactor factor, int startIndex, int quantiles, int rebalanceEvery) Per-bar long-short factor returns over(t, t+1]fort = startIndex .. bars−2, so the result hasbars − 1 − startIndexentries.AlphaValidation.monteCarloRobustness(AlphaContext ctx, AlphaFactor factor, int horizon, int startIndex, int trials, long seed) AlphaValidation.monteCarloRobustness(AlphaContext, AlphaFactor, int, int, int, long, NullModel)with the cross-sectional null.AlphaValidation.monteCarloRobustness(AlphaContext ctx, AlphaFactor factor, int horizon, int startIndex, int trials, long seed, AlphaValidation.NullModel model) Permutation test of the mean rank IC on the non-overlapping grid (startIndex, stepping byhorizon).static AlphaFactorFactors.prepared(AlphaFactor factor, double p, Map<String, String> sectorBySymbol) The standard preparation chain:Factors.winsorized(AlphaFactor, double)atp, thenFactors.standardized(AlphaFactor), thenFactors.sectorNeutralized(AlphaFactor, Map)(skipped whensectorBySymbolis null).SignalEvaluator.quantileReturns(AlphaContext ctx, AlphaFactor factor, int startIndex, int horizon, int quantiles) Buckets each evaluation date's cross-section intoquantilesscore-ranked groups and averages forward returns per group.static AlphaBacktester.ResultAlphaBacktester.run(AlphaContext ctx, AlphaFactor factor, AlphaBacktester.Config config) Runs with the standard z-score construction (gross 1.0, 5% name cap).static AlphaBacktester.ResultAlphaBacktester.run(AlphaContext ctx, AlphaFactor factor, AlphaBacktester.Config config, AlphaBacktester.RiskOptions options) Runs with the risk-model-driven turnover-aware optimiser as the construction (seeAlphaBacktester.RiskOptions).static AlphaBacktester.ResultAlphaBacktester.run(AlphaContext ctx, AlphaFactor factor, AlphaBacktester.Config config, AlphaBacktester.WeightBuilder builder) Runs with a caller-supplied construction pipeline.static AlphaBacktester.TracedAlphaBacktester.runTraced(AlphaContext ctx, AlphaFactor factor, AlphaBacktester.Config config, AlphaBacktester.RiskOptions options) AlphaBacktester.run(AlphaContext, AlphaFactor, Config, RiskOptions)with the per-bar trace.static AlphaBacktester.TracedAlphaBacktester.runTraced(AlphaContext ctx, AlphaFactor factor, AlphaBacktester.Config config, AlphaBacktester.WeightBuilder builder) AlphaBacktester.run(AlphaContext, AlphaFactor, Config, WeightBuilder)with the per-bar trace.static AlphaFactorFactors.sectorNeutralized(AlphaFactor factor, Map<String, String> sectorBySymbol) Demeans scores within each sector per date, so the factor ranks names against their sector peers.static AlphaFactorFactors.standardized(AlphaFactor factor) Cross-sectional z-score per date:(s − mean)/sdover the scored names (population sd); all-zero when the scores have no dispersion.static AlphaFactorFactors.winsorized(AlphaFactor factor, double p) Clips each date's scores to the cross-sectionalpand1 − pquantiles (linear interpolation between order statistics), NaN entries untouched.Method parameters in com.quantfinlib.alpha with type arguments of type AlphaFactorModifier and TypeMethodDescriptionstatic AlphaCombiner.CombinationAlphaCombiner.fit(AlphaContext ctx, List<AlphaFactor> factors, int fromIndex, int toIndex, AlphaCombiner.Settings settings) Fits the combination on IC datesfromIndex, fromIndex + step, …up totoIndex − horizon.static StringAlphaReport.formatIcTable(AlphaContext ctx, List<AlphaFactor> factors, int startIndex, int[] horizons) AlphaReport.icTable(AlphaContext, List, int, int[])as plain text, one row per factor.static double[][]AlphaReport.icTable(AlphaContext ctx, List<AlphaFactor> factors, int startIndex, int[] horizons) Mean IC of each factor at each forward horizon ([factor][horizon]), the same statistic asAlphaReport.decayProfile(AlphaContext, AlphaFactor, int, int[])for one factor.AlphaValidation.parameterSensitivity(AlphaContext ctx, List<AlphaFactor> sweep, int horizon, int startIndex) Evaluates each candidate of an ordered sweep (neighbours in the list are neighbours in parameter space) and reports how far the IC falls when the chosen parameter moves one step.AlphaValidation.walkForward(AlphaContext ctx, List<AlphaFactor> candidates, int horizon, int startIndex, int trainBars, int testBars) Rolls a train/test split across the sample: each fold picks the candidate with the best training-window mean IC and scores it on the nexttestBarsbars.