A Chinese forum post documents two weeks (2026-08-24 to 2026-09-07) of hardening work on the open-source Vibe-Trading quantitative trading project. The theme: automated trading systems fail not because models predict poorly, but because low-level code keeps false books. Below is a full translation of the post's engineering review.
Key points
- Gold orders silently rounded to zero: cross-market backtests applied forex micro-lot rounding rules to XAU/USD, wiping a 50-ounce gold position to
0lots. Fixed by fully decoupling multi-asset unit models (#1370). - Futures multiplier fallback bug: contracts with numeric month prefixes (
6EZ4,M2K) failed single-character matching and fell back to a default multiplier of 50 instead of 125,000 — understating real exposure by ~2,500x. Replaced with longest-prefix-tree lookup (#1369). - 82 Alpha factors poisoned by NaN: Python ternaries like
signal = 1 if (rolling_delta > 0) else -1evaluateNaN > 0asFalse, emitting strong short (-1) fake signals during warm-up or suspension gaps. All 82 factors (Alpha101/GTJA) now use a strict NaN guard that propagates NaN instead of branching (#1371–#1376). - Suspension-day handling (#1332): suspended-day closes no longer reset to cost basis; fair values are forward-filled.
- India: Zerodha Kite Connect (#1193) — full NSE/BSE market data plus paper-trading execution.
- LSE penny-stock trap (#1206) — GBX quotes settled as GBP caused ~100x account misvaluation; automatic
GBP = GBX × shares / 100conversion added. - Iranian exchanges (#1231, #1263) — Nobitex and Wallex with Toman pairs, plus a UI for rotating priority across 27 data sources with automatic failover on rate limits or outages.
- Anthropic Prompt Caching (#1366): static tool schemas and rules are cached — ~75% token cost reduction and nearly half the latency.
- 8-turn circuit breaker (#1363): identical tool errors are rejected on the 2nd attempt; 8 consecutive no-progress rounds trip a hard breaker and page a human.
- Language-agnostic market-closed checks (#1349): English "Market Closed" blocked orders, but the Chinese equivalent leaked through a regex; replaced with a locale-independent state-machine check.
- Heston (1993) stochastic volatility option pricing with mean-reverting variance and price–volatility correlation ρ, capturing the volatility smile.
- Hierarchical Risk Parity (HRP) — cluster-based allocation avoiding ill-conditioned covariance inversion.
- VPIN volume-bucket order-flow toxicity metric as a flash-crash early warning for market-making strategies.
Risk-control hardening (Fail-Closed everywhere)
1. Limit-order margin check (#1361): validation previously used the current market price, letting far-above-market limit buys pass only to blow margin at the exchange. Now uses pessimistic pricing: freeze max(P_limit, P_market) × qty × (1 + slippage buffer).
2. Auditor Fail-Closed (#1362): a zero verification count (parse timeout/malformed logs) used to PASS. Zero evidence now triggers a highest-severity violation and veto.
3. Kill-Switch double-liquidation guard (#1233, #1244): if the service restarts mid-liquidation, in-memory state loss caused the daemon to re-issue market sells — flipping a flat long account into a large naked short. A disk sentinel file now locks liquidation targets until a manual unlock.
Global market expansion
Agent reliability and cost
Quant math upgrades (#1195–#1198, #1203)
Closing assessment
| Dimension | Before (~08.24) | After (09.07) | | :--- | :--- | :--- | | Backtest fidelity | shrunken futures, suspension gaps, gold zeroed out | strict adjustment, decoupled units | | Factor credibility | NaN leaking through ternaries | strict NaN guards on 82 factors | | Live-trading safety | restart could flip liquidation to short | disk sentinel + worst-case margin check | | Agent stability | error loops, inflated tokens | prompt cache + 8-turn breaker | | Math depth | moving averages, static Black-Scholes | Heston, HRP, VPIN |
The author's conclusion: a real trading system is proven not by returns quoted in calm markets, but by code that survives the storm.