项目简介
Vibe-Trading 是一个由 LLM 驱动的个人交易智能体,集成多代理编排与券商连接器,支持回测、实时行情和风控。提供命令行、REST API、MCP 和 Web 界面,一条命令即可部署交易策略。
README 预览
\n English | 中文 | 日本語 | 한국어 | العربية\n\n\n\n \n\n\nVibe-Trading: Your Personal Trading Agent\n\n\n One Command to Empower Your Agent with Comprehensive Trading Capabilities\n\n\n\n \n\n\n\n \n \n \n \n \n \n \n \n \n\n\n\n Website · \n Docs · \n News · \n Features · \n Shadow Account · \n Demo · \n Quick Start · \n Examples · \n API / MCP · \n Roadmap · \n Contributing\n\n\n\n \n\n\n---\n\n## 📰 News\n\n- **2026-06-03** 🧹 **Community triage + trace correlation**: Tool-call trace entries now carry the originating `call_id`, so a `tool_result` can be matched back to its `tool_call` when replaying a run trace — arg previews stay truncated to keep trace files small ([#168](https://github.com/HKUDS/Vibe-Trading/pull/168), thanks @zwrong). Source comments no longer point at an internal-only docs path that external contributors couldn't find ([#166](https://github.com/HKUDS/Vibe-Trading/issues/166), thanks @jaleelpersonal). Also clarified that the `langchain-community` resolver warning on install is a harmless leftover-package notice, not a failure ([#167](https://github.com/HKUDS/Vibe-Trading/issues/167)), and scoped Gemini 2.5/3.0 `thoughtSignature` round-tripping for function calls as a `help wanted` task with a full fix plan ([#170](https://github.com/HKUDS/Vibe-Trading/issues/170), thanks @jliu6789).\n- **2026-06-02** 🔌 **Six new broker connectors (Tiger / Longbridge / Alpaca / OKX / Binance / Futu)**: The connector-first trading layer gains a direct-SDK transport alongside IBKR (local) and Robinhood (MCP). Each connector exposes read-only account / positions / orders / quote / history **plus paper-account order placement** — test your strategies across these broker paper accounts. Five of them (Tiger, Alpaca, OKX, Binance, Futu) also support **bounded, mandate-ga
常见问题 (5)
故障排除为什么在使用 DeepSeek v4 pro API key 时,vibe-trading 会返回 401 错误?
401错误表示LLM提供商配置不正确。请确保.env(最好是~/.vibe-trading/.env)包含以下内容:
LANGCHAIN_PROVIDER=deepseek
LANGCHAIN_MODEL_NAME=deepseek-v4-pro
DEEPSEEK_API_KEY=sk-your-deepseek-official-api-key
DEEPSEEK_BASE_URL=https://api.deepseek.com/v1
TIMEOUT_SECONDS=2400
重要提示:
- LANGCHAIN_PROVIDER必须为deepseek,而不是openrouter。
- 不要混用OpenRouter和DeepSeek的密钥。
- Vibe-trading会优先读取~/.vibe-trading/.env;如果该文件存在,请更新它而非agent/.env。
故障排除为什么 Vibe-Trading CLI swarm 失败并显示 '429 billing_not_active' 错误?
Swarm工作节点使用其独立的LLM提供商配置,与Codex或单任务运行使用的配置不同。CLI的swarm命令启动工作流,但内部节点因通过环境变量(例如agent/.env或shell中的LANGCHAIN_PROVIDER、LANGCHAIN_MODEL_NAME、DEEPSEEK_API_KEY)配置的提供商账户未激活或未设置计费而失败。解决办法:检查agent/.env文件,确保设置了正确的API密钥,且提供商账户处于激活状态并启用了计费。然后重新运行swarm命令。
故障排除如何修复 alpha-bench 符号链接测试中的 "AttributeError: 'object' object has no attribute 'meta'" 错误?
更新 agent/tests/test_mcp_alpha_zoo_contract.py 中的 _BenchRegistry 测试桩,使其返回的注册表条目包含 _validate_bench_data_requirements() 现在要求的 meta 属性。将原本的 object() 返回值替换为 SimpleNamespace(meta=None)(如有必要,从 types 导入 SimpleNamespace)。验证器会将 meta=None 视为没有必需的列,从而允许测试继续执行其符号链接断言。不要扩大生产代码中的 except 子句以捕获 AttributeError,因为这可能会掩盖真正的注册表契约 bug。
故障排除如何修复期权回测中 max_drawdown 忽略初始资金的首根K线亏损或报告为 0.0 的问题?
升级到包含 PR fix(options): seed the max-drawdown peak with initial cash 的版本。如果手动修补 agent/backtest/engines/options_portfolio.py,请将 _calc_options_metrics 中观测到的权益峰值:
peak = equity_vals.cummax()
替换为以有效初始现金作为种子值的峰值:
import numpy as np
if initial_cash is not None and np.isfinite(initial_cash) and initial_cash > 0:
peak = equity_vals.cummax().clip(lower=float(initial_cash))
else:
peak = equity_vals.cummax() # preserve previous fallback/warning
这与 agent/backtest/metrics.py 保持一致,其中 initial_cash 是账户在首个记录的 bar 之前的第一个高水位线。修复后,当 initial_cash=100 时,权益 [95, 90, 99] 报告 max_drawdown=-0.10,而单个观测值 [90] 报告 -0.10 而非 0.0。请为首根 bar 亏损、单根 bar 亏损、全上涨的权益曲线以及无效初始现金添加回归测试。
故障排除为什么在回测 BTC-USDT-PERP 永续合约交易对时,所有订单都以 zero_size 被拒绝(trade_count: 0)?
根本原因:backtest/engines/_market_hooks.py 中的 _detect_market() 没有针对 -PERP 后缀的正则表达式,因此像 BTC-USDT-PERP 这样的交易对符号会在 _MARKET_PATTERNS 中匹配落空,落入默认的 a_share。回测随后会应用中国 A 股 100 股一手的整手取整逻辑,而不是 CryptoEngine,导致每个计算出的仓位数量都被向下取整为零——因此出现 unfilled_plan_rejections_by_symbol: {"BTC-USDT-PERP": {"zero_size": N}} 以及一条平直的权益曲线,尽管数据加载完全正常。修复方法:在 _MARKET_PATTERNS 的 crypto 部分添加以下条目:(re.compile(r"^[A-Z0-9]+-USDT-PERP$", re.I), "crypto")。临时变通方案——在调用 runner.main() 之前于内存中进行猴子补丁(monkey-patch):import re; from backtest.engines import _market_hooks; _market_hooks._MARKET_PATTERNS.insert(0, (re.compile(r"^[A-Z0-9]+-USDT-PERP$", re.I), "crypto"))。应用该补丁后,相同配置会路由到 CryptoEngine,杠杆/保证金/资金费率设置生效,订单可以正常确定数量并成交。同样的根本原因也影响 OKX 风格的永续合约符号(source: "okx")。