TL;DR

HKUDS (HKU Data Science Lab) phát hành Vibe-Trading - một AI multi-agent financial workspace open-source, MIT license. Bạn mô tả ý tưởng đầu tư bằng tiếng Anh (hoặc Trung), agent tự load skill, gọi data loader, viết strategy, backtest, rồi export sang TradingView/MetaTrader 5. Stack hiện tại: 77 finance skill, 29 swarm preset, 452 alpha factor, 7 backtest engine, 36 MCP tool, 10 broker connector, 13 LLM provider. Cài bằng pip install vibe-trading-ai là chạy.

Vấn đề Vibe-Trading muốn giải

Quant tooling truyền thống vỡ ra thành nhiều lớp rời nhau: bạn fetch data bằng Tushare hoặc yfinance, viết signal bằng pandas, backtest bằng vnpy hay backtrader, rồi nếu muốn chạy live phải port sang Pine Script hoặc MQL5 bằng tay. Mỗi lớp một thư viện, mỗi thị trường một bộ adapter, và không ai chịu trách nhiệm cho cái pipeline tổng.

Vibe-Trading kéo toàn bộ chuỗi đó vào một workspace duy nhất, để LLM agent điều phối. Input là câu hỏi tự nhiên dạng "backtest momentum strategy trên top 50 cổ A-share 5 năm qua, walk-forward 6 tháng", output là run card có metric, biểu đồ và file Pine Script chạy ngay được trên TradingView.

Kiến trúc 77 skill chia 8 nhóm

Mỗi skill là một capability riêng được agent load khi cần. Phân nhóm:

  • Data Source (7): tushare, yfinance, okx-market, akshare, mootdx, ccxt, data-routing.
  • Strategy (17): technical-basic, candlestick, ichimoku, elliott-wave, smc, multi-factor, ml-strategy, cross-market-strategy...
  • Analysis (17): factor-research, macro-analysis, valuation-model, earnings-forecast, credit-analysis, dividend-analysis.
  • Asset Class (9): options-strategy, options-advanced, convertible-bond, etf-analysis, asset-allocation, sector-rotation.
  • Crypto (7): perp-funding-basis, liquidation-heatmap, stablecoin-flow, defi-yield, onchain-analysis.
  • Flow (7): hk-connect-flow, us-etf-flow, edgar-sec-filings, financial-statement.
  • Tool (11): backtest-diagnose, pine-script export, vnpy-export, alpha-zoo, doc-reader.
  • Risk (1): ashare-pre-st-filter.

Swarm: 29 preset team multi-agent

Thay vì gọi single agent, Vibe-Trading cho phép spawn nguyên một desk: investment_committee, global_equities_desk, crypto_trading_desk, earnings_research_desk, macro_rates_fx_desk, quant_strategy_desk, technical_analysis_panel, risk_committee... DAG được orchestrate sẵn, các agent debate với nhau, có live reconcile và MCP keepalive. Bạn có thể list bằng vibe-trading swarm list rồi run preset trực tiếp.

Alpha Zoo 452, backtest curves, broker connector va export target
Bốn trụ chính của Vibe-Trading: Alpha Zoo, backtest curve, broker connector và export target.

Alpha Zoo: 452 factor với strict validation

Đây là phần tôi thấy nghiêm túc nhất so với các framework khác. 452 alpha factor chia 4 bộ: qlib158 (154 alpha từ Microsoft Qlib, Apache-2.0), alpha101 (Kakushadze arXiv:1601.00991), gtja191 (Guotai Junan 2014), và academic 6 (Fama-French 5 + Carhart momentum).

Validation enforce cứng: AST purity gate chặn import lạ, lookahead-ban scan toàn bộ expression, pytest-socket block network khi backtest, random-control benchmark với out-of-sample split. Ai làm quant lâu hiểu cái này cứu rất nhiều giờ debug.

Backtest: 7 engine + composite

Mỗi thị trường một engine riêng để xử lý đúng calendar và microstructure: AShareDaily, HKDaily, USDaily, ChinaFutures, GlobalFutures, Forex, Options v2. Quan trọng nhất là composite engine: cho phép chạy portfolio mix nhiều thị trường (vd A-shares + crypto) chia chung capital pool, mỗi market giữ rule riêng. Validation layer: Monte Carlo, Bootstrap confidence interval, Walk-Forward.

Shadow Account: phân tích sai lầm của chính bạn

Feature này khá độc đáo. Bạn export journal từ broker (同花顺, 东方财富, 富途, hoặc CSV chung), Vibe-Trading parse ra profile hành vi: holding day, win rate, PnL ratio, drawdown, disposition effect, overtrading, momentum chasing, anchoring. Sau đó nó extract rule ngầm từ pattern giao dịch của bạn, backtest cái rule đó như một strategy, rồi báo cáo HTML/PDF chỉ ra: lệnh nào vi phạm rule, exit sớm chỗ nào, miss signal chỗ nào, alternative path nếu hold thêm.

Quick start

pip install vibe-trading-ai
vibe-trading init
vibe-trading run -p "backtest mean-reversion strategy on top 100 A-shares 2020-2025"

Bạn cũng có thể chạy như API server (vibe-trading serve --port 8899) hoặc MCP server (vibe-trading-mcp) để cắm vào Claude Desktop, Cursor, OpenClaw. 13 LLM provider được support: OpenAI, DeepSeek, Gemini, Groq, Qwen, Zhipu, Kimi, MiniMax, Xiaomi MIMO, Z.ai, OpenRouter, Ollama, OpenAI Codex (ChatGPT OAuth). 7 data loader auto-fallback nên không cần Tushare token vẫn có A-share data qua mootdx hoặc AKShare.

Broker connector: 10 sàn, paper/live phân biệt structural

10 broker được wrap: Tiger, Alpaca, OKX, Binance, Futu hỗ trợ paper + đặt lệnh; Longbridge, Dhan, Shoonya, IBKR ở chế độ paper hoặc read-only. Robinhood Agentic Trading là connector live duy nhất - cần OAuth committed mandate, có filesystem kill-switch và audit ledger. Triết lý là no custody: Vibe-Trading chỉ relay intent, broker vẫn giữ tiền và execute lệnh. Quan trọng: paper/live phân biệt ở tầng connector chứ không phải bằng account ID, nên không có cửa accidental fire live order.

Export: chạy được trên TradingView, MT5, vnpy

Sau khi backtest xong, agent có thể xuất strategy sang 4 platform: TradingView Pine Script v6, TDX (通达信/同花顺/东方财富), MetaTrader 5 MQL5, vnpy CtaTemplate. Đây là lý do framework này có giá trị thực dụng cho retail trader - không cần tự port code sang Pine Script bằng tay.

Hạn chế thực tế

  • Cần Python 3.11+ và ít nhất 1 LLM API key (Ollama nếu muốn local).
  • Live trading thật sự chỉ có Robinhood Agentic; các broker khác phần lớn paper hoặc read-only.
  • Composite backtest tốn nhiều RAM khi universe lớn.
  • UI Web còn dev-grade, làm việc qua CLI hoặc MCP mượt hơn.

Ai nên thử ngay

  • Quant researcher: 452 alpha + walk-forward + Monte Carlo có sẵn, tiết kiệm hàng tuần code.
  • Retail trader: Shadow Account thực sự nên thử để hiểu bias cá nhân.
  • PM/analyst: chạy swarm investment_committee để có debate giữa các persona trước khi quyết định.
  • Crypto trader: skill perp-funding-basis, liquidation-heatmap, stablecoin-flow đáng giá riêng.
  • Strategy dev: tự nhiên ngôn ngữ -> code -> Pine Script chạy thẳng TradingView.

Context: bài này nằm trong loạt nào

Vibe-Trading đã được tôi nhắc 2 lần trước đó nhưng chỉ ở dạng listing: top finance GitHub repos tuần 4/2026 xếp Vibe-Trading vào nhóm dẫn đầu, và 10 GitHub repos quá tốt để miễn phí liệt nó vào nhóm "không nên là free". Bài này là phần deep-dive thật sự về kiến trúc và feature.

Kết

Vibe-Trading là một trong những công trình quant open-source hiếm hoi vừa có scale (77 skill, 452 alpha, 7 engine, 10 broker) vừa có kỷ luật kỹ thuật (AST purity, lookahead-ban, no custody, structural paper/live). Nếu bạn đang nghiêm túc về backtest hoặc muốn dạy LLM agent làm research tài chính, đây là codebase nên đọc kỹ via HKUDS/Vibe-Trading trên GitHub.