Vibe-Trading: Four Weeks of Architecture Evolution and Hardcore Quant Advancement
Over the past four weeks (early September to early October 2026), the open-source autonomous quantitative trading system Vibe-Trading underwent its most dramatic engineering leap since its inception. From v0.1.15's "Data that says what it is" to v0.1.16's "A number that can show where it came from," through continued work on the main branch, the repository has merged over 1,000+ commits, completing a systematic rebuild spanning anti-hallucination grounding, long-report resilience, mathematical foundations, a global multi-country data platform, and multi-broker asset management.
Four-Week Evolution Overview
| Core Area | Major Theme | Key Modules | Improvements |
| :--- | :--- | :--- | :--- |
| 🛡️ Reasoning & Anti-Hallucination | Grounding Gate 2.0 | agent/src/agent/grounding/ | Replaced fuzzy NL matching with shape recognition plus figures declaration blocks; unverified values gracefully omitted rather than full refusal; one-round correction |
| 🧠 Long-Report Resilience | Real window & tiered compaction | agent/src/agent/loop.py | Adapts to real GPT-6 / DeepSeek context sizes; tiered pruning of stale tool data at 80%/90%/100% thresholds, ending multi-asset report dead loops |
| 📐 Quant Math Foundations | Quant Library: 15 models | agent/src/quantlib/ | Heston stochastic volatility pricing, Hierarchical Risk Parity (HRP), microstructure metrics (VPIN/Roll/Kyle/Amihud), purged cross-validation |
| 🦁 Factor Library | Alpha Zoo: 59 factors debugged | agent/src/factors/ | Fixed arithmetic bias and NaN contagion from suspensions and gaps; corrected Carhart momentum skip-month rule |
| 🌐 Data Platform & Assets | Global assets & health checks | agent/backtest/ | Added UK (LSE) and Argentina (BYMA) markets; one-sided SDRT stamp duty modeling; weekly automated probes of 15 unauthenticated sources |
| 💼 Trading & Aggregation | Broker matrix & Portfolio v3 | agent/src/trading/ | Connectors grew to 18 brokers (adding KIS, Upbit, Toss, Scalable, etc.); multi-broker read-only aggregation with explicit errors on data-source anomalies |
| 📱 Interaction & Architecture | IM integration & decoupling | agent/src/channels/ | Web UI manages Feishu, DingTalk, WeCom, Email, etc.; removed 4x MCP redundancy; main loop decoupled from tool parsing |
---
1. Agent Grounding Defense and Long-Range Reasoning Resilience
Financial agents writing research reports must avoid "fabricated metrics" and blind hallucination. Prior versions guessed number meanings from natural-language context, and long reports repeatedly re-fetched data as context budgets overflowed. Recent fixes:
1.1 Grounding Gate 2.0
- Shape inference replaces semantic guessing: abolished fragile logic relying on 65 regex patterns; numbers are now classified by their own form (percentages, currency symbols, decimals, table layout).
- Structured
figuresdeclaration block: the model declaresvalue | role | note | refat the end of answers, across five roles: observed: must be traced exactly to a tool output field in the current session;derived: must include a parseable arithmetic expression (ratios, multiples, percentage-point differences);proposed/cited/count: verified separately for order ranges, external public citations, and integer parameters.- Graceful omission (cut rather than refuse): if a number fails verification, the system masks it as
(omitted※)with a note instead of discarding the whole report; correction rounds reduced from 4 to 1. - Backtest self-evidence: Run Cards, metric tables (Sortino, Turnover, Monte Carlo p-values, etc.) are fully injected into the evidence pool, eliminating fabricated backtest analysis.
- Breaking the 40k truncation constraint: old logic crudely cleared tool memory at an estimated 40k tokens, causing multi-asset comparison tasks to re-fetch the same filings until hitting
no_progressstalls. - Three-tier dynamic progressive compaction: senses the underlying model's real window capacity (e.g., DeepSeek V4 1M, GPT-6 Sol 272K) and prunes stale raw data bottom-up at 80%, 90%, and 100% token consumption, multiplying long-task stability.
- Transparent out-of-bounds path guidance: when the model explores outside permitted files, it receives the canonical root directory instead of probing nonexistent paths.
- Heston (1993) stochastic volatility option pricing: abandons Black-Scholes constant variance in favor of a mean-reverting square-root (CIR) variance process, solving European option prices via characteristic-function inversion:
- Hierarchical Risk Parity (López de Prado, 2016): tree-structures the asset correlation matrix via unsupervised hierarchical clustering, then recursively allocates inverse-variance weights across subtrees, avoiding numerical ill-conditioning and high turnover from inverting high-dimensional covariance matrices.
- Market microstructure and liquidity metrics:
- VPIN (order-flow toxicity over fixed volume buckets):
- Amihud (2002) illiquidity:
- Kyle (1985) Lambda and Roll (1984) effective bid-ask spread.
- Purged K-Fold Cross-Validation (López de Prado, 2018): enforces purging and embargo at train/test boundaries for labels with serial autocorrelation, eliminating lookahead bias.
- Carhart (1997) momentum fix:
academic_carhart_momnow strictly skips the most recent month when computing trailing 12-month returns (t-252 to t-21 trading days), never using today's close, removing short-term reversal contamination: - Missing-value reconstruction across 59 factors: fixed 24 factors producing false signals from comparison operators returning False at suspension gaps; removed 20 factors that padded suspension days with constants; fixed
qlib158'sCNTP/CNTN/CNTDandWVMAnumerator absolute returns; corrected Guotai Junangtja191extreme-day ranking. - 🇬🇧 UK (LSE): full coverage of
.L/.ILquotes, filings, and backtests. Crucially, the system now models the UK's unique SDRT stamp duty (0.5% charged only on the buyer; sales exempt), correcting prior double-sided taxation that doubled transaction cost estimates. - 🇦🇷 Argentina (BYMA):
.BAstocks and CEDEARs added, priced uniformly in ARS and hard-isolated from USD asset pools. - ⏱️ Candlestick resampling engine: unified weekly (
1W) and monthly (1M) resampling keeps technical analysis and backtest periods aligned across data sources. - 🩺 Weekly probes (
loader_health): every Monday, 15 unauthenticated public sources (Yahoo, Eastmoney, Tencent, BaoStock, etc.) are checked with real data requests in a sandbox; stale or malformed data triggers circuit-breaker alerts. - 🇨🇳 A-share additive adjustment calibration: clarified that Tencent/Eastmoney sources use "split_dividend_additive" adjustment, preventing Sharpe distortion from mixing with total-return scaling.
- ⏳ BaoStock blocking watchdog: a 30-second timeout circuit breaker prevents infinite hangs and CPU spin after disconnection.
- 🛡️ Red Line Policy: for broker APIs lacking strict sandbox isolation or live-trading auth flags (e.g., Zerodha, Toss, Upbit), live order functions are completely sealed at the code level; only paper trading and read-only access are permitted.
- 📑 Code-native capability matrix: a README interaction matrix is generated directly from 55 Profile registries, validated in CI so docs always match code.
- Upgraded to version 3 with cross-account unified aggregation. Any failing data source raises an explicit error and is isolated — stale caches are never used, eliminating "phantom shrinkage" of displayed assets.
- ⚙️ Unified Web settings center: DingTalk, WeCom, QQ, Feishu/Lark, Email, and WebSocket fully configurable via the interface.
- 🔐 Secret masking and lossless probing: form data shows only the last four characters (
**1234); connectivity can be checked without restarting the bot. - 📬 Chinese mailbox pass-through: the Email channel now sends an RFC 2971 IMAP
IDhandshake, passing security checks of NetEase 163 and similar providers. - ⚡ MCP tool de-duplication: eliminated redundant 4x re-transmission of MCP structured data to the agent, substantially saving token compute.
- 🧩
loop.pysplit begins: tool dispatch functions extracted from the core loop into an independenttool_results.py. - 🌐 Localization: added Bahasa Indonesia and Português do Brasil, bringing the multilingual system to 9 languages.
> Grounding Gate: a strict fact-checking firewall deployed before the LLM emits its final financial research report, forcing every financial metric, asset price, and forecast return to be traced back to actual tool-call outputs.
1.2 Real Window Awareness and Tiered Compaction
> Tiered Context Compaction: a memory-cleaning strategy that senses the model's real context capacity and removes stale raw tool outputs bottom-up at 80/90/100% thresholds, preserving key decision trajectories while preventing window-overflow hallucinations and dead loops.
---
2. Quant Library and Alpha Zoo
This release adds 15 peer-reviewed frontier financial models under agent/src/quantlib/, adhering to a "one formula, one source" engineering principle.
2.1 Frontier Derivatives Pricing and Asset Allocation
> Captures the volatility smile and fat-tailed skewness of option markets.
2.2 Alpha Zoo: 59 Factors Debugged
---
3. Global Multi-Country Market Data Platform
3.1 Global Market Expansion
> SDRT (Stamp Duty Reserve Tax): a UK-specific tax on listed share transfers — 0.5% charged only on the buy side; symmetric modeling overestimates strategy costs by 2x.
3.2 Automated Data Reliability Watchdogs
> Additive Adjustment: a forward-adjustment method that directly subtracts historical per-share cash dividends from pre-ex-dividend prices rather than scaling proportionally — can drive distant historical prices negative and must be strictly distinguished from total-return adjustment.
---
4. Broker Connectors and Multi-Broker Portfolio v3
4.1 18 Broker Connectors and the Red Line Policy
4.2 Multi-Broker Portfolio v3
---
5. UI, IM Channels, and Architecture Refactoring
5.1 IM Channel Management and Hot Reload
> RFC 2971 IMAP ID extension: lets the client declare its name and version after authentication. Some major Chinese mailboxes (NetEase 163/126) require this handshake before allowing folder selection.
5.2 Core Decoupling and De-duplication
Conclusion and Outlook
Vibe-Trading's past four weeks focused not on flashy claims but on rigorous foundations — from calibrating every basis point of transaction tax to tracing every metric in multi-thousand-word research reports back to its source. The path forward for open-source quant and financial agents is built line by line of exacting code.
---
References and Theoretical Foundations
1. Carhart, M. M. (1997)**. On persistence in mutual fund performance. *The Journal of Finance*, 52(1), 57–82. 2. Heston, S. L. (1993). A closed-form solution for options with stochastic volatility with applications to bond and currency options. *The Review of Financial Studies*, 6(2), 327–343. 3. López de Prado, M. (2016). Building diversified portfolios that outperform out-of-sample. *The Journal of Portfolio Management*, 42(4), 59–69. 4. López de Prado, M. (2018). *Advances in Financial Machine Learning*. John Wiley & Sons. 5. Kyle, A. S. (1985). Continuous auctions and informed trader. *Econometrica*, 53(6), 1315–1335. 6. Amihud, Y. (2002). Illiquidity and stock returns: cross-section and time-series effects. *Journal of Financial Markets*, 5(1), 31–56. 7. Easley, D., López de Prado, M. M., & O'Hara, M. (2012). Flow toxicity and liquidity in a high-frequency world. *The Review of Financial Studies*, 25(5), 1457–1493. 8. Patell, J. M. (1976). Corporate forecasts of earnings per share and stock price behavior: Empirical tests. *Journal of Accounting Research*, 14(2), 246–276.