Kokoro

Quant

The mathematics I actually ship — filters, factor research, volatility models, options pricers, risk metrics, microstructure. Implemented in Rust and Python across kokoro-alpha-lab and kokoro-pricing-service.

Filters & State Estimation

Kalman Filter

Linear-Gaussian state-space estimator; used for token-level price/velocity tracking.

Unscented Kalman Filter

Sigma-point nonlinear filtering with automatic warm-up for non-Gaussian dynamics.

Particle Filter

Sequential importance resampling with distribution snapshots for multimodal posteriors.

H-infinity Filter

Robust state-space filter with measurement gating and velocity inflation under adversarial noise.

Conformal Prediction

Distribution-free calibrated prediction intervals around any point forecaster.

Signal Processing

Fourier Analysis

Frequency-domain decomposition for cycle detection and harmonic extraction.

Continuous Wavelet Transform

Multi-scale time-frequency decomposition with regime-change detection.

Hilbert Transform

Analytic signal yielding instantaneous phase and frequency.

L1 Trend Filtering

Nonparametric trend isolation via L1-penalised smoothing.

Volatility & Time-Series

GARCH(1,1)

Conditional variance forecasting with grid-search fit and variance targeting.

EWMA (RiskMetrics λ=0.94)

Exponentially-weighted variance estimator for short-horizon vol.

Bipower Variation

Barndorff-Nielsen & Shephard decomposition isolating jumps from realised variance.

Hurst Exponent (R/S)

Multi-scale rescaled-range analysis distinguishing trend persistence from mean reversion.

Augmented Dickey-Fuller

OLS-based stationarity test with MacKinnon critical values.

Risk Metrics

Parametric & Historical VaR

Quantile loss estimators from both fitted normals and empirical distributions.

Conditional VaR (Expected Shortfall)

Tail-mean loss beyond the VaR threshold.

Maximum Drawdown

Peak-to-trough underwater analysis on equity curves.

Annualised Sharpe

Risk-adjusted return with √252 scaling; the standard hurdle metric.

Greeks-Based Portfolio Risk

Aggregated Δ / Γ / Vega for options inventory.

Options & Derivatives

Black-Scholes

Closed-form European pricer plus analytical Δ / Γ / Θ / Vega / ρ.

Newton-Raphson IV Solver

Implied-volatility extraction via gradient descent on Vega.

Cox-Ross-Rubinstein Tree

Discrete binomial pricer with backward induction for American features.

Monte Carlo Pricer

GBM path simulation with Box-Muller draws and confidence intervals.

Portfolio Optimisation

Markowitz Mean-Variance

Unconstrained (analytical) and constrained (projected gradient / SLSQP) weight allocation.

Efficient Frontier

Risk-return locus swept across the target-return space.

Kelly Criterion

Log-optimal bet sizing for repeated edges.

Market Microstructure

Order Flow Imbalance

L2-based ΔBid − ΔAsk with level-improvement logic; classified into directional pressure.

VWAP & Median Aggregation

Volume-weighted and outlier-robust price blends across DEX sources.

Slippage Curves

Depth-profiled execution cost from quote-API ladder sweeps.

Hawkes Self-Exciting Process

Baseline / excitation / decay cascade model for event clustering.

Stochastic Methods

Gaussian & Student-t Copulas

Cholesky-sampled dependence with heavy-tailed variants for joint scenarios.

Importance Sampling

Biased-distribution reweighting for rare-event variance reduction.

Antithetic & Control Variates

Negatively-correlated path pairing and proxy-variable correction.

Stratified Sampling

Uniform bucket coverage for Monte Carlo integrators.

Statistical Learning

K-Means + Silhouette

Euclidean clustering with cohesion / separation quality scoring.

Mahalanobis Distance

Covariance-weighted distance for anomaly and regime discrimination.

Mechanism Design

LMSR

Logarithmic Market Scoring Rule — the cost-function AMM for prediction markets.

Alpha Factor Library

Twenty-four distinct factors, each its own crate with bespoke calibration — not re-skinned momentum.

Swap MomentumPrice TrendOrder FlowRegime DetectionCluster ActivityDepth QualityWhale FlowSmart MoneyAMM StateHierarchical FilterConsensusHawkes CascadeAI EnsembleSocial SentimentEquity MomentumEquity Mean-ReversionPairs / CointegrationSector RotationForex CarryOptions Vol SurfaceOptions SkewGamma ScalpingCalendar SpreadComposer Roles

Numerical Methods

  • Newton-Raphson for implied vol and root finding
  • Projected gradient descent for constrained mean-variance
  • SLSQP (Python / SciPy) for equality- and inequality-constrained portfolios
  • Box-Muller normal-deviate generation for path simulators
  • Cholesky decomposition for correlated copula sampling
  • OLS closed-form regression for slope / intercept estimators