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

Vibe-Trading, an open-source autonomous quantitative trading system, merged over 1,000 commits between early September and early October 2026, spanning releases v0.1.15 ("data that says what it is") and v0.1.16 ("a number that can show where it came from"). This retrospective from the zhichai.net forum details seven major workstreams: (1) Grounding Gate 2.0, which replaces fuzzy natural-language matching with morphology-based numeric attribution and structured `figures` declaration blocks, gracefully masking unverified numbers instead of rejecting entire reports; (2) tiered context compaction that adapts to real model windows (e.g., DeepSeek 1M, GPT-6 272K) with 80/90/100% thresholds; (3) a Quant Library of 15 peer-reviewed models including Heston stochastic volatility, Hierarchical Risk Parity, VPIN, Amihud, Kyle's Lambda, and Purged K-Fold cross-validation; (4) fixes to 59 Alpha Zoo factors, including Carhart momentum's skip-month rule and suspension-gap NaN propagation; (5) new UK (LSE) and Argentina (BYMA) market support with correct one-way SDRT stamp duty modeling, plus weekly probes of 15 public data sources; (6) expansion to 18 broker connectors with a red-line policy blocking live orders on unvetted APIs, and multi-broker Portfolio v3 aggregation; (7) IM channel management (DingTalk, Feishu, WeCom, Email) via Web UI, MCP de-duplication, and main-loop decoupling.

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

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 sweeping engineering leap since inception. From v0.1.15 ("*Data that says what it is*") to v0.1.16 ("*A number that can show where it came from*") and ongoing work on the main branch, the repository merged over 1,000+ commits, completing a systematic rework spanning anti-hallucination attribution, long-form research report resilience, mathematical foundations, a global multi-country data platform, and multi-broker asset management.

Key points

  • Grounding Gate 2.0 (agent/src/agent/grounding/): replaced fuzzy natural-language regex matching (65 regex rules) with morphology-based numeric classification plus a structured figures declaration block (value | role | note | ref) with five roles: observed, derived, proposed, cited, count. Unverified numbers are now gracefully masked as (omitted※) instead of rejecting the whole report; correction rounds cut from 4 to 1.
  • Real context-window awareness & tiered compaction (agent/src/agent/loop.py): dropped the crude 40k-token truncation that caused multi-ticker report dead loops (no_progress stalls). Now adapts to actual model windows (e.g., DeepSeek V4 1M, GPT-6 Sol 272K) and progressively prunes stale tool data at 80%/90%/100% thresholds.
  • Quant Library: 15 peer-reviewed models (agent/src/quantlib/): Heston stochastic volatility pricing, Hierarchical Risk Parity (HRP), microstructure metrics (VPIN, Roll, Kyle's Lambda, Amihud), and Purged K-Fold cross-validation.
  • Alpha Zoo: 59 factors debugged (agent/src/factors/): fixed suspension-gap arithmetic bias and NaN contagion; corrected the Carhart momentum skip-month rule (t-252 to t-21) to remove short-term reversal contamination.
  • Global market data: added UK (LSE) and Argentina (BYMA) markets; correct one-way SDRT stamp duty (0.5% buyer-only); weekly automated health probes of 15 unauthenticated data sources.
  • Brokers & Portfolio v3: connector count grew to 18 (KIS, Upbit, Toss, Scalable, etc.); a "Red Line Policy" hard-blocks live order placement on brokers lacking sandbox isolation; multi-broker read-only aggregation with explicit errors on data-source anomalies (no "fake shrinkage" from stale caches).
  • UI & architecture: Web UI manages DingTalk, WeCom, QQ, Feishu/Lark, Email, and WebSocket channels; MCP tool payloads de-duplicated (4x redundancy removed); main loop and tool parsing decoupled (tool_results.py); localization added Indonesian and Brazilian Portuguese (9 languages total).
  • 1. Grounding & Long-Context Resilience

    Financial agents' worst failures are fabricated metrics and hallucination. Previously, numeric meaning was guessed from surrounding natural-language vocabulary; long reports repeatedly refetched data due to context-budget overruns.

    Grounding Gate 2.0

  • Morphology over semantics: numbers are judged by their form (percentages, currency symbols, decimals, table layout), not regex guesses.
  • Structured figures block: the model declares every figure at the end of its answer with value | role | note | ref:
  • observed: must trace exactly to a tool output for the given ticker/field in the current session;
  • derived: must carry a parseable arithmetic expression (ratios, multiples, percentage-point differences);
  • proposed / cited / count: verified for order price ranges, external citations, and integer parameters respectively.
  • Cut rather than refuse: on verification failure, numbers are masked as (omitted※) with a footnote instead of discarding the whole report; correction rounds reduced from 4 to 1.
  • Backtest self-verification: Run Cards and metric tables (Sortino, Turnover, Monte Carlo p-values) are injected into the evidence pool, eliminating fabricated backtest analysis.
  • Tiered Context Compaction

  • Real-time awareness of the underlying model's actual window; stale raw tool data is pruned bottom-up at 80%/90%/100% token consumption.
  • Out-of-bounds file exploration returns a canonical root path instead of letting the model exhaustively probe non-existent directories.
  • 2. Quant Library & Alpha Zoo

    Derivatives pricing and allocation

  • Heston (1993) stochastic volatility: CIR mean-reverting variance process, 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}\]
  • Hierarchical Risk Parity (López de Prado, 2016): hierarchical clustering on the correlation matrix with recursive inverse-variance allocation, avoiding ill-conditioned covariance inversion.
  • Microstructure: VPIN, Amihud (2002) illiquidity, Kyle (1985) Lambda, Roll (1984) effective spread:
  • \[VPIN = \frac{\sum_{\tau=1}^N |V_\tau^B - V_\tau^S|}{N \cdot V}, \qquad ILLIQ_{i,t} = \frac{1}{D_t} \sum_{d=1}^{D_t} \frac{|R_{i,d}|}{P_{i,d} \cdot V_{i,d}}\]
  • Purged K-Fold Cross-Validation (López de Prado, 2018): purging and embargo at train/test boundaries to eliminate lookahead bias.
  • Alpha Zoo fixes (59 factors)

  • Carhart (1997) momentum correction: academic_carhart_mom now strictly skips the most recent month (t-252 to t-21 trading days), never referencing today's close:
  • \[MOM_{t} = \prod_{\tau=t-252}^{t-21} (1 + R_{\tau}) - 1\]
  • Fixed 24 factors producing false signals from comparison operators on suspension gaps, 20 factors padding suspension days with constants, qlib158 CNTP/CNTN/CNTD and WVMA numerator issues, and gtja191 extreme-day ranking.
  • 3. Global Market Data Platform

  • UK (LSE): full support for .L / .IL tickers; precise SDRT modeling — 0.5% charged on the buyer only, halving previously overstated transaction costs.
  • Argentina (BYMA): .BA stocks and CEDEARs in ARS, hard-isolated from USD asset pools.
  • Resampling engine: unified weekly (1W) and monthly (1M) candle synthesis across data sources.
  • Reliability watchdog (loader_health): weekly sandboxed probes against 15 unauthenticated public sources (Yahoo, Eastmoney, Tencent, BaoStock, etc.) with circuit-breaker alerts; A-share data classified as split_dividend_additive adjustment to prevent Sharpe distortion; 30-second timeout watchdog for BaoStock.
  • 4. Brokers & Portfolio v3

  • Red Line Policy: brokers without strict sandbox isolation or live-auth flags (e.g., Zerodha, Toss, Upbit) have live order placement hard-blocked at the code level — paper trading and read-only only.
  • Capability matrix: README matrix generated from 55 Profile registries, validated in CI.
  • Portfolio v3: cross-account aggregation with explicit, isolated errors on source failures — never falls back to stale caches.
  • 5. UI, IM Channels & Architecture

  • IM channel management: DingTalk, WeCom, QQ, Feishu/Lark, Email, and WebSocket configured via Web UI; secrets shown as last-four-only (**1234) with live connectivity probing (no restart).
  • Email: RFC 2971 IMAP ID handshake added to pass Netease 163/126 security checks.
  • De-duplication & decoupling: MCP structured data previously passed to the agent 4 times redundantly — removed; large tool-dispatch functions split out of loop.py into tool_results.py.
  • Localization**: +Indonesian and Brazilian Portuguese (9 languages total).

References

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

#quantitative-trading#open-source#llm-agents#hallucination-mitigation#stochastic-volatility#factor-investing#market-data#broker-integration

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