Uses of Class
com.quantfinlib.alpha.AlphaContext
Packages that use AlphaContext
Package
Description
Cross-sectional alpha research: signal generation, evaluation,
validation, execution-aware backtesting, portfolio construction and
reporting, each a separate step.
-
Uses of AlphaContext in com.quantfinlib.alpha
Methods in com.quantfinlib.alpha that return AlphaContextModifier and TypeMethodDescriptionstatic AlphaContextPanel without fundamentals (technical factors only).static AlphaContextPanel with a static fundamentals snapshot.AlphaContext.withFundamentalsHistory(FundamentalsHistory history) The same panel with point-in-time fundamentals attached.AlphaContext.withUniverse(PointInTimeUniverse universe) The same panel with a point-in-time universe attached (see the class doc).Methods in com.quantfinlib.alpha with parameters of type AlphaContextModifier and TypeMethodDescriptionstatic BacktestAttributionBacktestAttribution.attribute(AlphaContext ctx, AlphaBacktester.Traced traced, String[] sectors, AlphaRiskModels.Spec spec) Attributes a traced run.static 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 FactorRiskModelAlphaRiskModels.estimate(AlphaContext ctx, int index, String[] sectors, AlphaRiskModels.Spec spec) Estimates the model on thespec.window()periods ending atindex, forecasting the period after it.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 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.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).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.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.double[]AlphaCombiner.Combination.scores(AlphaContext ctx, int index) Combined score:Σ w_k z'_kwith the same per-date orthogonalisation as the fit; NaN where any factor has no score.double[]AlphaFactor.scores(AlphaContext ctx, int index) Raw scores atindex, aligned with the context's symbols.static double[]PortfolioConstruction.sectorNeutralize(AlphaContext ctx, double[] weights, Map<String, String> sectorBySymbol) PortfolioConstruction.sectorNeutralize(double[], String[])with alignment by construction: sector labels come as a map keyed by symbol and are resolved against the context's frozen (sorted!)static double[]PortfolioConstruction.trailingBetas(AlphaContext ctx, int index, int lookback) Trailing OLS betas against a leave-one-out equal-weight market: for symbolithe market return is the mean of the other names' returns.static double[]PortfolioConstruction.trailingBetas(AlphaContext ctx, int index, int lookback, BarSeries market) Trailing OLS betas against an external market series aligned with the panel (same bar count and timestamps), for example an index.static double[]PortfolioConstruction.trailingVols(AlphaContext ctx, int index, int lookback) Trailing return volatilities per symbol atindex(sample sd of the close-to-close returns ending at barsindex−lookback+1 .. index), the standard input toPortfolioConstruction.inverseVolBudget(double[], double[], double).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.double[]AlphaBacktester.WeightBuilder.weights(AlphaContext ctx, double[] scores, int index)