English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Vibe-Trading: Four Weeks of Architecture Evolution in an Open-Source Quant Trading System

Forum topic · QianXun · 2026-10-02

Summary

The open-source autonomous quantitative trading system Vibe-Trading completed its largest engineering overhaul to date between early September and early October 2026, merging over 1,000 commits from v0.1.15 through v0.1.16 and beyond. Key advances include a Grounding Gate 2.0 that replaces fuzzy natural-language matching with shape-based number recognition and structured figures declaration blocks, gracefully masking unverified values instead of rejecting entire reports; tiered context compaction at 80/90/100% token thresholds that ends no-progress loops in long research reports; a Quant Library of 15 peer-reviewed models including Heston stochastic volatility pricing, Hierarchical Risk Parity, and VPIN/Amihud/Kyle liquidity metrics; fixes across 59 Alpha Zoo factors including the Carhart momentum skip-month rule; support for UK (LSE) and Argentine (BYMA) markets with correct one-sided SDRT stamp duty modeling; automated weekly health probes across 15 unauthenticated data sources; expansion to 18 broker connectors with a Red Line Policy blocking live orders for unisolated APIs; and multi-broker Portfolio v3 aggregation with explicit error reporting. The system also added IM channel management (DingTalk, WeCom, Feishu, Email), MCP tool de-duplication, and Indonesian and Brazilian Portuguese localization, bringing total language support to nine.

Vibe-Trading: Four Weeks of Architecture Evolution and Hardcore Quant Advancement

VibeTrading.svg

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 figures declaration block: the model declares value | role | note | ref at 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.
  • > 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

  • 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_progress stalls.
  • 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.
  • > 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

  • 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:
  • \[\begin{aligned} dS_t &= \mu S_t dt + \sqrt{V_t} S_t dW_t^S \\ dV_t &= \kappa (\theta - V_t) dt + \xi \sqrt{V_t} dW_t^V \\ d\langle W^S, W^V \rangle_t &= \rho dt \end{aligned}\]

    > Captures the volatility smile and fat-tailed skewness of option markets.

  • 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):
  • \[VPIN = \frac{\sum_{\tau=1}^N |V_\tau^B - V_\tau^S|}{N \cdot V}\]
  • Amihud (2002) illiquidity:
  • \[ILLIQ_{i,t} = \frac{1}{D_t} \sum_{d=1}^{D_t} \frac{|R_{i,d}|}{P_{i,d} \cdot V_{i,d}}\]
  • 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.
  • 2.2 Alpha Zoo: 59 Factors Debugged

  • Carhart (1997) momentum fix: academic_carhart_mom now 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:
  • \[MOM_{t} = \prod_{\tau=t-252}^{t-21} (1 + R_{\tau}) - 1\]
  • 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's CNTP/CNTN/CNTD and WVMA numerator absolute returns; corrected Guotai Junan gtja191 extreme-day ranking.
  • ---

    3. Global Multi-Country Market Data Platform

    3.1 Global Market Expansion

  • 🇬🇧 UK (LSE): full coverage of .L / .IL quotes, 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): .BA stocks 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.
  • > 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

  • 🩺 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.
  • > 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

  • 🛡️ 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.
  • 4.2 Multi-Broker Portfolio v3

  • 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.
  • ---

    5. UI, IM Channels, and Architecture Refactoring

    5.1 IM Channel Management and Hot Reload

  • ⚙️ 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 ID handshake, passing security checks of NetEase 163 and similar providers.
  • > 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

  • ⚡ MCP tool de-duplication: eliminated redundant 4x re-transmission of MCP structured data to the agent, substantially saving token compute.
  • 🧩 loop.py split begins: tool dispatch functions extracted from the core loop into an independent tool_results.py.
  • 🌐 Localization: added Bahasa Indonesia and Português do Brasil, bringing the multilingual system to 9 languages.
---

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.

Tags

#open-source#quantitative-trading#llm-agents#hallucination-prevention#financial-models#backtesting#broker-integration#market-data

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/178635489