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

Vibe-Trading Biweekly Fix Log: Gold Order Bugs, Fake Alpha Signals, and Fail-Closed Risk Controls

Forum topic · 小凯 · 2026-09-07

Summary

This post reviews two weeks of development (Aug 24 - Sep 7, 2026) on the open-source Vibe-Trading automated trading project, focusing on correctness and safety fixes rather than new features. Key fixes include: a multi-asset accounting bug that truncated a 50-ounce XAU/USD gold order to zero lots due to forex rounding rules; a futures contract multiplier bug where prefixed symbols like 6EZ4 fell back to a default multiplier of 50 instead of 125,000, understating exposure by 2,500x; strict NaN guards added to 82 Alpha101/GTJA factors to prevent missing data from being misread as constant +/-1 signals via Python ternary comparisons; pessimistic worst-case margin checks for limit orders; Fail-Closed audit behavior when zero verification points are found; and disk-based sentinel locking to prevent a Kill-Switch liquidation from re-opening opposite positions after restarts. New integrations cover India's Zerodha Kite, LSE GBX-to-GBP conversion, and Iranian Toman exchanges with 27 rotating data sources. Agent improvements include Anthropic prompt caching (75% token savings), an 8-round idling circuit breaker, and language-agnostic market-closed validation. New quant math includes Heston stochastic volatility pricing, Hierarchical Risk Parity, and VPIN order-flow toxicity detection.

Vibe-Trading Biweekly Fix Log: Exorcising Bugs from Matching, Factors, and Risk Control

> Review period: 2026-08-24 to 2026-09-07. A digest of merged PRs in the open-source Vibe-Trading automated trading project — no grand roadmap talk, just hardening patches.

Key points

  • Gold order truncated to zero (#1370): cross-asset backtests applied forex micro-lot rounding to a 50 oz XAU/USD order, wiping it to 0 lots. Multi-asset measurement is now fully decoupled.
  • Futures multiplier bug (#1369): prefixed symbols (e.g., 6EZ4, M2K) fell back to a default multiplier of 50 instead of the true 125,000 for Euro FX futures — understating exposure by ~2,500x. Fixed via longest-prefix-tree lookup.
  • 82 factors patched for NaN signals (#1371–#1376): Python ternaries like signal = 1 if (rolling_delta > 0) else -1 evaluated NaN > 0 as False, emitting constant -1 (strong short) fake signals during warm-up/suspensions. All 82 factors now use strict NaN guards with forward propagation.
  • Suspension-day handling (#1332): close prices on halted days were being reset to cost basis; replaced with forward-fill of fair value.
  • Limit-order margin check (#1361): capital verification now uses the worst side: max(P_limit, P_market) × qty × (1 + slippage buffer).
  • Fail-Closed audits (#1362): a zero verification-point audit log previously passed; now treated as a top-severity violation.
  • Kill-Switch double-liquidation fix (#1233, #1244): after a full liquidation, a service restart could lose in-memory state and open an opposite market order. A disk sentinel file now locks positions until manually unlocked.
  • Global market expansion

  • India — Zerodha Kite Connect (#1193): NSE/BSE market data plus simulated live matching.
  • London — LSE penny-stock trap (#1206): GBX quotes vs GBP settlement now auto-converted: GBP = GBX × shares / 100.
  • Iran — Nobitex/Wallex (#1231, #1263): Toman-denominated crypto pairs, with drag-and-drop prioritization across 27 auto-rotating data sources.
  • Agent guardrails

  • Anthropic prompt caching (#1366): static tool schemas and system prompts are cached — ~75% token cost reduction and roughly half the latency.
  • 8-round circuit breaker (#1363): identical tool parameters failing twice are rejected; 8 consecutive non-productive rounds trigger a hard stop and human alert.
  • Language-agnostic market-closed checks (#1349): the Chinese "市场已休市" string bypassed the English regex; validation moved to a language-independent state machine.
  • Quant math upgrades (#1195–#1198, #1203)

  • Heston (1993) stochastic volatility option pricing — variance follows a mean-reverting process with price-volatility correlation ρ, capturing the volatility smile.
  • Hierarchical Risk Parity (HRP) — replaces ill-conditioned covariance inversion with tree clustering on correlation distance D = sqrt((1 - ρ)/2).
  • VPIN order-flow toxicity — volume-bucketed buy/sell imbalance as an early-warning signal for flash crashes; market makers withdraw above threshold.

Closing assessment

| Dimension | Before (~08-24) | After (09-07) | Verdict | | :--- | :--- | :--- | :--- | | Backtest fidelity | Shrunk futures, halted-day gaps, zeroed gold | Strict adjustment, decoupled units | Squeezed dry | | Factor reliability | Missing data leaking as ±1 signals | Strict NaN guards on 82 factors | Clean signals | | Live safety | Restart could flip liquidation into a naked short | Disk sentinel + pessimistic margin checks | Solid wall | | Agent stability | Error loops, inflated token spend | Prompt cache + 8-round breaker | Reined in | | Math depth | Moving averages, static Black-Scholes | Heston, HRP, VPIN | Modernized |

A real trading system isn't proven by returns quoted in calm waters, but by code that survives the storm.

Tags

#vibe-trading#quantitative-trading#backtesting-bugs#risk-control#fail-closed#nan-guard#prompt-caching#heston-model

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/178634597