Tuning Philosophy
The bot uses a multi-model system (Black-Scholes + momentum + reversion) combined in logit space. Each component has tunable parameters, and they interact in non-obvious ways:- EWMA lambda controls volatility estimation smoothness
- Logit weights control how momentum and reversion adjust base probability
- Abstention thresholds control when the model has enough edge to trade
- Risk parameters control position sizing and drawdown protection
EWMA Lambda (Volatility Estimation)
What It Does
The EWMA lambda parameter (engine.ewma.lambda) controls the decay rate for exponentially weighted volatility estimation. Higher lambda = more weight on recent observations = smoother volatility that reacts slowly to shocks.
Formula: variance = lambda * variance + (1 - lambda) * (r^2 / dt)
Default Value
Tuning Range
| Lambda | Behavior | When to Use |
|---|---|---|
| 0.90-0.92 | Fast adaptation, noisy | High-frequency volatility regime (flash crashes, major news) |
| 0.93-0.94 | Balanced (default) | Normal market conditions |
| 0.95-0.96 | Slow adaptation, smooth | Low-frequency trends, stable markets |
Tuning Process
- Collect tick data over at least 100 intervals (8+ hours)
- Compute realized volatility per interval
- Run backtests with lambda in [0.90, 0.92, 0.94, 0.96]
- Evaluate:
- Brier Score (calibration quality)
- Sharpe Ratio (risk-adjusted returns)
- Volatility outlier frequency (how often sigma exceeds
sigmaMultiplier * meanSigma)
Example
Logit Weights (Momentum & Reversion)
What They Do
The logit weights control how momentum ROC and mean reversion signals adjust the Black-Scholes base probability in log-odds space. Formula:finalProb = sigmoid(logit(baseProb) + w_momentum * ROC + w_reversion * deviation)
See src/engine/predictor.js:128-132.
Default Values
Parameter Interaction
These weights are not independent. The ratio between them determines the model’s behavior:| Ratio | Behavior | Risk |
|---|---|---|
w_momentum / w_reversion > 2.5 | Trend-following (chases momentum) | Misses reversals, gets whipsawed |
w_momentum / w_reversion ≈ 2.0 | Balanced (default: 150/80 = 1.875) | Good for mixed markets |
w_momentum / w_reversion < 1.5 | Mean-reversion (fades moves) | Misses breakouts, fights trends |
Tuning Range
| Parameter | Range | Default |
|---|---|---|
logitMomentumWeight | 50 - 300 | 150 |
logitReversionWeight | 40 - 150 | 80 |
Tuning Process
-
Fix one weight, sweep the other
-
Evaluate on held-out intervals:
- Brier Score (lower is better)
- Log Loss (lower is better)
- Early 1m accuracy (higher is better, target >80%)
- EV per trade (higher is better)
-
Check calibration:
Look for low resolution loss (MRES) and low calibration loss (MCAL).
Recommended Starting Points
Abstention Thresholds
The abstention system prevents trading when the model has no edge. There are 6 configurable conditions:Critical Thresholds
Most impactful parameter. Controls the minimum edge before making a prediction.
- Decrease (0.05-0.08) → Trade more often, accept smaller edges, higher risk of false signals
- Increase (0.12-0.15) → Trade less often, require stronger edges, miss opportunities
(EV per trade) * (trade frequency)Minimum expected value to place a bet. Works in conjunction with
minMargin.Formula: EV = (p / q) - 1- Decrease (0.03) → Accept smaller edges, more trades
- Increase (0.08-0.10) → Only trade high-EV opportunities
Minimum edge in percentage points (
|p - q| >= minMargin).- Decrease (0.10-0.12) → Trade on smaller edges
- Increase (0.18-0.20) → Require wider edges, fewer trades
Tuning Process
- Start with defaults (deadZone=0.10, minEV=0.05, minMargin=0.15)
- Collect 200+ intervals of live data
- Analyze abstention reasons:
- Compute realized performance by condition:
- If many
insufficient_marginabstentions and high Brier Score → increase minMargin - If few trades and model is well-calibrated → decrease deadZone or minMargin
- If many trades with negative EV → increase minEV
- If many
Example Analysis
Risk Parameters
Brier Tiers (Kelly Fraction)
The bot uses dynamic Kelly fractions based on calibration quality:- Tier 0: No trading until 100 predictions collected
- Tier 1: Poor calibration (Brier > 0.26) → 10% Kelly (very conservative)
- Tier 2: Decent calibration (0.22-0.26) → 20% Kelly
- Tier 3: Good calibration (0.18-0.22) → 25% Kelly
- Tier 4: Excellent calibration (< 0.18) → 40% Kelly
Tuning Alpha Values
If your model achieves Brier < 0.18 consistently:- Conservative: Keep alpha at 0.40 (default tier 4)
- Moderate: Increase to 0.50
- Aggressive: Consider 0.60, but monitor drawdown closely
Max Bet Percentage
- Conservative: 0.03 (3% max bet)
- Default: 0.05 (5% max bet)
- Aggressive: 0.08 (8% max bet, not recommended)
Drawdown Thresholds
- Yellow (10%): Warning only, no bet sizing impact
- Red (20%): Alpha multiplier = 0.5 (half-size bets)
- Critical (30%): Trading suspended
- If you hit red frequently: Lower alpha tiers or increase abstention thresholds
- If you never hit yellow: Your bet sizing may be too conservative (missing edge)
Practical Tuning Workflow
Phase 1: Collect Baseline Data (Days 1-7)
Run the bot with default parameters for at least 7 days.Phase 2: Analyze Performance (Day 8)
Generate daily reports and identify weaknesses:- Brier Score: Should be < 0.22 to justify trading
- Early 1m accuracy: Target > 80%
- Trade frequency: 40-60% of intervals (not too selective, not too loose)
- EV per trade: Target > 0.05 (5%)
Phase 3: Tune One Dimension (Days 8-14)
Pick one parameter group to tune:- If Brier > 0.22
- If accuracy < 75%
- If trade frequency < 30%
- If hitting red drawdown
Problem: Poor calibrationTune: Logit weights
- Try reducing
logitMomentumWeightto 120 (less aggressive) - Try reducing
logitReversionWeightto 60 (less mean reversion) - Monitor Brier Score daily
Phase 4: Validate (Days 15-21)
Run with tuned parameters for 7 more days. Do not look at results daily (avoid overfitting). After 7 days, compare:- Brier Score (should improve by 0.02-0.05)
- Sharpe Ratio (should improve)
- Drawdown (should be shallower)
Advanced: Multi-Parameter Optimization
Once you have 30+ days of data, consider grid search:Quick Reference
Conservative (High Accuracy, Low Frequency)
Aggressive (Higher Frequency, Moderate Accuracy)
Next Steps
Config Reference
Full reference for all configuration parameters.
Environment Setup
Set up data directories and logging for production.