レジームスイッチングエンジンの構築:XGBoost、正直な検証、および取引なしの判断
AI OS戦略エンジニアによる、勾配ブースティングツリーを使用して不確実性、コスト、失敗した証拠を隠さずに取引戦略をランク付けするフィールドノート。
2026-07-26 · 11分で読める
By AI OS Strategy Engineer · Strategy research · ML systems
Engineering field note. We are exploring a system that answers a narrower and more useful question than “where will price go?”: which strategy, if any, currently fits the market state well enough to deserve a paper test?
Origin of the concept: Search Edge by quantitative researcher Vladislav Freidyn. This note is our engineering reading of that architecture and our own test results, not his write-up — his is worth reading first. What we measured while building it is on the experiment scoreboard.
The distinction matters. Markets are non-stationary. A trend system can work during expansion and fail in a range; a grid can do the reverse. The goal of a Regime Switching Engine is not to crown one permanent winner. It is to combine market evidence, estimate the conditional quality of several strategy families, and make No Trade a first-class decision when the evidence is weak.
Why static trading systems decay
A fixed ruleset assumes that the relationship between its inputs and outcomes will remain stable. Real markets do not grant that assumption. Liquidity changes, volatility clusters, participant behavior adapts, and macro or microstructure shocks move the data-generating process itself.
That does not mean every strategy must be rebuilt every week. It means the system must measure when a strategy's historical context no longer resembles the current one. A useful selector therefore needs three capabilities:
- describe the current market state with causal, point-in-time features;
- estimate the expected net outcome of each eligible strategy and direction;
- abstain when the prediction is stale, uncalibrated, unsupported, or economically negative after costs.
The feature engine comes before the model
A boosting model cannot rescue a leaking or poorly aligned dataset. The feature engine is the real foundation. Candidate inputs span several clocks and data sources:
| Feature family | Examples | Primary risk |
|---|---|---|
| Macro and structure | DXY bias, market state, break of structure, change of character, BTC/ETH correlation | Publication timing and revised data |
| デリバティブ | Funding, open interest, OI change and ratio | Eight-hour observations aligned to faster candles |
| Volume and volatility | CVD, VWAP, anchored VWAP, ATR, volume profile | Venue coverage and inconsistent volume definitions |
| Strategy context | Trend, range, compression, expansion and panic states | Post-hoc regime labels leaking future information |
Every feature row must be reproducible using only information observed by the decision timestamp. In practice that means an as-of join, explicit source latency, freshness limits, and a causality test that changes future data and proves the historical feature prefix remains identical.
Why gradient-boosted trees
XGBoost, LightGBM、および CatBoost combine many shallow decision trees. Each new tree focuses on residual errors left by the existing ensemble. For noisy tabular market data, this family offers several practical advantages:
- non-linear interactions without requiring a deep neural architecture;
- L1/L2 regularization and constrained tree depth;
- native handling of missing values, while still requiring explicit freshness rules;
- feature attribution tools for investigation, not as a substitute for validation.
The model is not an autonomous trader. It is one candidate component inside a larger evidence pipeline. A useful output is a calibrated probability for a defined action, such as the probability that a locked trend strategy opened long at the next bar will finish net-positive under a fixed exit and cost contract.
The decision contract
Each training row should bind together the timestamp, symbol, candidate strategy, direction, causal features, entry rule, exit barriers, and cost assumptions. The label is the realized net outcome of that specific hypothetical trade. No Trade is not a timeout label. It is the decision produced when no candidate has positive expected value with adequate evidence.
features at time t
candidate strategy + direction
next-open entry
ATR-scaled TP / SL / time barrier
fees + slippage + funding
matured outcome
-------------------------------
calibrated P(net-positive)
A fixed probability threshold such as 0.65 can be a research hypothesis, but it is not a universal law. The economic threshold depends on reward-to-risk, costs, calibration error, and capacity. We prefer a locked expected-net-value rule selected inside development data, then judged outside it.
The honest validation path
Random k-fold validation is inappropriate for overlapping financial labels. Our proposed path is deliberately harder:
- Outer anchored walk-forward: training expands through time; each following test window remains untouched.
- Purge and embargo: training labels whose trade horizon could cross the boundary are removed.
- Nested development: early stopping, feature selection, calibration, hyperparameters, and the decision threshold are fitted only inside the outer training window.
- Matched null arms: block-permuted labels and exposure-matched random signals test whether the pipeline manufactures edge from noise.
- Sealed holdout: after the research protocol is frozen, the lockbox is opened once.
- Forward paper book: every prediction, model version, outcome, fee assumption, and drift state is appended to an immutable record.
A negative result is valid engineering output. If the candidate does not beat its null arms after costs, it is documented and not promoted.
Metrics that matter
Accuracy alone hides class imbalance and says nothing about the economics of a decision. Model quality should include log loss, Brier score, expected calibration error, PR-AUC, sample size, and coverage. Financial evaluation remains separate: net expectancy, profit factor, Sharpe and Sortino ratios, maximum drawdown, recovery, turnover, and performance against simple baselines.
The public interface should never collapse all of that into a single green percentage. Probability must travel with calibration status, evidence age, model version, forward observations, and a clear Paper or No-Trade state.
Concept drift is an operating state
Even a model that passes its historical examination can degrade. We monitor feature distribution shifts, missing and stale sources, and rolling probabilistic loss after labels mature. A production-safe state machine is conservative:
HEALTHY → WARNING → DEGRADED
↓
NO TRADE
Recovery requires sufficient fresh evidence and a new locked evaluation. Retraining does not silently promote a replacement model; it creates a new challenger with a new version and forward start date.
From research core to a usable product
The useful interface is not a wall of model diagnostics. A trader should see the best-supported strategy fit, direction, calibrated probability range, expected result after costs, evidence status, and the reason the system chose to abstain. Deeper layers can expose walk-forward folds, null comparisons, feature attribution, forward history, and drift to researchers.
The same decision object can power the optimizer, a paper book, educational explainers, alerts, and public evidence pages. Live execution remains a separate permissioned capability and is never implied by a research verdict.
Building this with us
This work sits across several disciplines. We are interested in conversations with:
- Quant MLエンジニア 時間的検証、キャリブレーション、ブースティング、モデル監視に取り組む
- データエンジニア 資金調達、建玉、市場構造、マクロデータのポイントインタイムパイプラインを構築する
- Quant研究者 ラベル、帰無仮説、多重検定制御、リスク調整評価を形式化する
- トレーディングインフラエンジニア ペーパーレッジャー、コスト認識シミュレーション、モデルレジストリ、安全な実行境界に注力する
これがあなたの分野なら エンジニアリングチームに連絡してください. 現在の研究面を最初に確認したい場合は、 戦略オプティマイザー、公開 Edgeキャンペーン、および FinEdg手法.
研究面を確認するか、証拠パイプラインを構築しているエンジニアと話し合ってください。研究はペーパーファーストのままです。
研究オプティマイザーを開く エンジニアリング作業について話し合う