All Packages
Package Summary
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.Command-line entry point:
Main exposes
backtest, walkforward and report subcommands over
CSV bar files, so the library is usable without writing Java.Commodities: the asset class where the CURVE is the trade.
The central risk book — one netted view of the firm's risk across
desks and products, and the machinery that monetizes it.
Credit: the price of default.
Data in, out, and preparation — the bridge between real-world files/feeds
and the analytics stack:
CsvBarLoader (RFC-4180-tolerant CSV bars),
HttpBarFetcher (CSV over HTTP),
TickFileWriter/TickFileReader
(QFLT binary tick format with as-fast-as-possible or paced replay),
TickCapture (record the live bus for
deterministic replay), SeriesAligner
(timestamp intersection / union+forward-fill for ragged multi-asset data)
CorporateActions (split/dividend
back-adjustment) and PointInTimeUniverse
(as-of membership + delisting/merger terminal events — the engine half of
survivorship-bias-free backtesting, consumed by the universe-aware
PortfolioBacktester overload and StockScreener.membersAsOf)
with UniverseCsvLoader as its documented CSV
interchange format for user-supplied membership/lifecycle data.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.Runnable demonstrations and benchmarks (excluded from coverage — they are
run manually or by the
Benchmarks (Linux) workflow):
QuickStartDemo tours every capability on
synthetic data;
HftLatencyBenchmark measures the market
data hot path and HftOrderBenchmark the
order path (both print a HiccupMonitor summary to attribute tail
outliers to platform stalls).Execution strategy support:
SmartOrderRouter (fee-adjusted
multi-venue splitting, dark-first option), its zero-allocation
hot-lane sibling HftSor, and the
full-checklist AdaptiveSor
(expected-cost routing over displayed + hidden liquidity, fees/rebates,
latency, fill probability and a reliability veto, with contingent dark
probes) learning from VenueScorecard
(streaming per-venue fill rate, measured latency, realized dark fills),
TwapScheduler /
VwapScheduler (schedule design with
anti-gaming jitter and exact largest-remainder allocation),
PovTracker (streaming
percentage-of-volume participation),
ImplementationShortfallScheduler
(Almgren-Chriss-optimal slicing),
WmrFixingScheduler (benchmark-window
TWAP replication),
BenchmarkExecutor (the DYNAMIC
benchmark algo: one stateful executor tracking VWAP / TWAP / Arrival /
Implementation Shortfall / Closing / Opening / Participation, re-deciding
each interval from live spread, depth, volatility, volume curve, alpha
and liquidity — cross-asset),
LiquiditySeekingAlgo (the
opportunistic archetype: burst when the spread is under its
time-of-day forecast in a calm regime, guaranteed by a completion
floor over the final stretch),
PortfolioExecutor (multi-symbol
portfolio-level scheduling over per-symbol BenchmarkExecutor children:
leg-balance band for two-sided transitions, per-interval notional budget
allocated risk-weighted — overlays only ever damp a child's own due, so
per-symbol benchmark integrity holds),
IcebergOrder (display/reload state
machine), DarkPoolSimulator
(midpoint cross with minimum-execution-quantity),
MidPegTracker (peg repricing with
thresholds) and VenueBenchmark
(fill rate, effective spread, markout per venue).Live market data over WebSocket (pure JDK
java.net.http):
WebSocketFeed publishes parsed trades into the
HftMarketDataBus with automatic reconnection, and
BinanceTradeParser is the reference
FeedParser (one small class per additional
exchange).Zero-dependency FIX 4.4 engine.
FX-specific market machinery — spot conventions through NDFs:
CurrencyPair (pip/precision tables, T+1/T+2
spot lags, dual-calendar tenor dates with modified-following and end-end),
SwapPointsCurve (quoted forward points →
outrights, broken dates linear in days, covered-interest-parity carry),
FxSwap (near/far legs, points MTM, roll cost),
Ndf (fixing vs settlement lags per restricted
currency, USD-settled difference amounts),
FxVolSurface (delta-quoted smiles — ATM DNS,
RR/BF wings, premium-adjusted delta↔strike solving),
FixingRisk (WM/R-window TWAP/VWAP tracking
error and participation), and the hot-path pieces:
AggregatedBook (zero-alloc multi-venue BBO
with venue attribution), CrossRateEngine
(streaming synthetic crosses chained on the bus consumer thread),
FxTierBook (per-LP size-tier ladders:
sweep cost and full-amount quotes), LpScorecard
(streaming last-look analytics: reject rate, hold, post-reject markout),
LpRouter (expected-all-in routing that prices
rejects into the decision) and SyntheticCross
(direct-vs-legs execution arithmetic with spread composition).Hedging algorithms across asset classes:
DeltaHedger (dynamic delta hedging with
bands and costs) and HedgingSimulator
(Monte Carlo hedging-error distributions),
GreekHedger (delta-gamma-vega
neutralization), OptionsBook (book-level
Greeks, scenario grids, P&L explain),
MinimumVarianceHedge (optimal ratios,
futures sizing), FxHedger (exposure
netting, forward carry), PairsHedger
(spread construction, half-life),
CointegrationTest (Engle-Granger — the
statistical gate before a pairs trade) and
WhalleyWilmott (the OPTIMAL no-trade
band around delta — the width the band hedgers take as configuration
SHOULD come from here, with the hedge-to-nearest-edge policy).Technical analysis engine:
Indicators
(21 batch indicators over primitive arrays, NaN warm-ups) and
StreamingIndicators (O(1)-per-tick
incremental versions for live/HFT strategies).Market data transport, two lanes:
Market analytics across the public/private divide.
Market microstructure analytics:
MarketImpactModel (square-root law
+ Almgren-Chriss temporary/permanent decomposition),
AlmgrenChriss (closed-form optimal
execution trajectories on the cost/risk frontier),
QueueModel (fill probability from
queue position and latency advantage),
TransactionCostAnalyzer
(implementation shortfall, slippage vs VWAP, effective spread per fill),
TickSizeSchedule (banded price
grids) and Auction (call uncross).Statistical learning for markets, all pure Java:
GradientBoostedRegressor (stump boosting),
VolatilityForecaster (forward realized vol +
0-100 risk score), RegimeDetector (2-state
Gaussian Markov-switching model via Baum-Welch EM),
MarketImpactPredictor (learned impact + sweep
probability), IntradayLiquidityForecaster
(session volume profiles) and AnomalyDetector
(quote stuffing, price spikes).Portfolio construction:
PortfolioOptimizer (max Sharpe, min
volatility, efficient frontier — derivative-free and deterministic),
RiskParityOptimizer (equal risk
contribution), BlackLitterman
(equilibrium returns blended with confidence-weighted views) and
ConstrainedPortfolioOptimizer
(position caps/floors and turnover penalties against current holdings).Limit order book modeling, in two deliberate lanes:
OrderBook is the research-grade model
(price-time-priority matching with cancels, partial fills, queue-position
queries and order-to-trade counters — readable TreeMap/object internals);
HftOrderBook is the venue-grade core
(dense integer-tick price ladder with occupancy bitmaps, pooled intrusive
order nodes, primitive open-addressing id map, zero allocation —
~204 ns/op, 10M+ fills/sec measured by HftBookBenchmark).Multi-day persistence of learned state:
Checkpoint — one binary file of named
sections, written at end of day (atomic temp-then-rename, so a crash
mid-save never corrupts yesterday's file) and restored at session start.Fair value and derivatives pricing:
BlackScholes (Greeks with continuous
carry — equities and Garman-Kohlhagen FX — plus implied vol),
BinomialTree (CRR American/European),
VolSurface (pillar smiles, total-variance
term interpolation), SabrModel (Hagan 2002
+ calibration), FairValueEngine
(microprice and latency-adjusted true mid),
TriangularArbitrage (executable FX
round-trip edge), ForwardCurve
(FX forwards with covered-interest-parity checks), the exotics
(DigitalOption,
TouchOption,
BarrierOption,
VannaVolga) and
Autocallable (the flagship equity
structured product: memory coupons, autocall observations, European
knock-in — Monte Carlo with antithetic variates under documented GBM
simplifications; RFQ market structure for trading it lives in
rfq).Fixed income with real market conventions:
YieldCurve (zero curve, discount factors,
implied forwards, bootstrap from annual par swaps),
BondPricer (price/yield, duration, convexity,
DV01 — both whole-period and date-based with accrued interest),
DayCount (ACT/360, ACT/365, 30/360,
ACT/ACT ISDA), BusinessCalendar
(holidays, roll conventions, T+n settlement, coupon schedules),
ShortRateModels (Vasicek, CIR and
curve-fitted Hull-White: closed-form zero-coupon bonds plus the
simulation steps a rates-factor Monte Carlo needs) and
KeyRateDurations (WHERE on the curve a
bond's DV01 lives — per-node bumps whose slices sum back to the
parallel move, tested).Benchmark and regulatory metrics:
FixAnalyzer (WM/Reuters-style fix
calculation and "banging the close" screening),
BestExecutionAnalyzer (MiFID II-style
slippage, latency-to-fill and per-venue reporting) and
MarketQualityMetrics
(quoted/effective/realized spread, price impact, order-to-trade ratio).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.RFQ market structure for equity derivatives — structured products have
no order book; they trade by request-for-quote against a dealer panel:
RfqAuction (one auction: best price by the
client's direction, the industry-standard cover price, spread to a
model fair-value anchor such as
pricing.Autocallable.price) and
RfqDealerScorecard (streaming per-dealer
quality across auctions — quote rate, response time, spread to fair,
win rate — the panel-selection input, persistable via
persist.Checkpoint).Risk: measurement, decomposition, credit/limits, and model validation.
SBE-style binary wire codecs and channel adapters — the professional-grade
alternative to the text edges (JSON WebSocket in, FIX tag-value out):
TradeFlyweight,
OrderFlyweight and
QuoteFlyweight encode/decode at fixed buffer
offsets with zero allocation, zero parsing and zero copying;
BinaryMarketDataClient feeds the
HftMarketDataBus from a binary stream and
BinaryOrderPublisher/BinaryOrderReceiver
carry gateway orders over a binary channel.Stock screening:
StockScreener applies
composable ScreenFilters —
TechnicalFilters (RSI, moving averages,
MACD, ADX, VWAP, SuperTrend, Bollinger, Ichimoku, breakouts, volume
spikes, gaps, 52-week levels) and
FundamentalFilters (market cap, P/E, P/B,
EPS, ROE, dividend yield, leverage) — then ranks survivors with the
weighted min-max RankingEngine and
exports to CSV.Monte Carlo simulation:
MonteCarloSimulator runs GBM scenarios
(single portfolio or correlated multi-asset via Cholesky) in parallel
across cores, deterministic per seed;
SimulationResult provides the outcome
analytics — probability of profit/loss, VaR/CVaR, confidence intervals,
best/worst/expected/median terminal values.Order entry, two lanes (mirroring
marketdata):Shared numerics and measurement primitives:
MathUtils (statistics, percentiles, Cholesky,
matrix solve/inverse, normal distribution),
LatencyRecorder (zero-allocation log-linear
nanosecond histogram) and HiccupMonitor
(jHiccup-style platform stall attribution — GC/safepoint/scheduler pauses
versus code latency).Volatility models:
EwmaVolatility
(RiskMetrics exponentially-weighted variance, λ = 0.94),
Garch11 (Gaussian MLE with variance
targeting; conditional variances and mean-reverting k-step forecasts)
and GjrGarch11 (the leverage-effect
asymmetry equity indices demand — a down move raises tomorrow's
variance by α + γ, an up move by only α; fitting γ ≈ 0 is itself the
finding that the series is symmetric),
Egarch11 (Nelson's log-variance
dynamics: leverage as a SIGN — γ < 0 — with no positivity
constraints by construction; one-step forecasts exact, multi-step
deliberately refused since the log recursion forecasts the median,
not the mean), and
HarRv (Corsi's heterogeneous
autoregressive realized-vol model — daily/weekly/monthly horizons by
plain OLS, the forecasting benchmark GARCH papers have to beat; pair
it with microstructure.JumpRobustVolatility's bipower
variance to keep jumps out of the forecast).