Vibe Trading

MCP Tools

Professional finance research toolkit — backtesting (7 engines + benchmark comparison panel), factor analysis, Alpha Zoo (452 pre-built alphas across qlib158/alpha101/gtja191/academic), options pricing, 75 finance skills, 29 multi-agent swarm teams, Trade Journal analyzer, and Shadow Account (extract → backtest → render) across 6 data sources (tushare, yfinance, okx, akshare, ccxt, futu).

Install

openclaw skills install vibe-trading

Vibe-Trading

Professional finance research toolkit with AI-powered backtesting (7 engines), multi-agent teams, 75 specialized skills, the Alpha Zoo (452 pre-built quantitative alphas across qlib158 / alpha101 / gtja191 / academic with one-line CLI benchmarking), and the Shadow Account loop — extract your implicit trading rules from a journal, backtest them across A股/港股/美股/crypto, then see where they would have served you better.

Setup

pip install vibe-trading-ai

Package name vs commands: The PyPI package is vibe-trading-ai. Once installed, you get:

CommandPurpose
vibe-tradingInteractive CLI / TUI
vibe-trading serveLaunch FastAPI web server
vibe-trading-mcpStart MCP server (for Claude Desktop, OpenClaw, Cursor, etc.)

Add to your agent's MCP config:

{
  "mcpServers": {
    "vibe-trading": {
      "command": "vibe-trading-mcp"
    }
  }
}

API Key Requirements

21 of 22 MCP tools work with zero API keys. After pip install, backtesting, market data, factor analysis, options pricing, chart patterns, web search, document reading, trade journal analysis, shadow-account extraction/backtest/report, the Alpha Zoo (452 pre-built alphas), and all 75 skills are ready to use for HK/US equities and crypto.

FeatureKey neededWhen
HK/US equities & cryptoNoneAlways free (yfinance + OKX)
China A-share dataTUSHARE_TOKENOnly if you query A-share symbols
Multi-agent swarm (run_swarm)OPENAI_API_KEY + LANGCHAIN_MODEL_NAMESwarm spawns internal LLM workers

What You Can Do

Shadow Account — flagship loop

Feed a CSV broker export (同花顺 / 东财 / 富途 / generic), and the agent will:

  1. analyze_trade_journal — profile your behavior (holding period, win rate, disposition effect, chasing, overtrading, anchoring).
  2. extract_shadow_strategy — distill 3-5 if-then rules that describe your profitable roundtrips.
  3. run_shadow_backtest — backtest those rules across A/HK/US/crypto and compute delta-PnL vs your realized trades.
  4. render_shadow_report — produce an HTML/PDF report (8 sections + charts) with today's matching signals.
  5. scan_shadow_signals — list today's symbols that match your shadow's entry cadence (research only).

Backtesting

Create and run quantitative strategies across 7 engines (ChinaA, GlobalEquity, Crypto, ChinaFutures, GlobalFutures, Forex + options) with 6 data sources:

  • HK/US equities via yfinance (free, no API key)
  • Cryptocurrency via OKX or CCXT/100+ exchanges (free, no API key)
  • China A-shares via Tushare (token) or AKShare (free fallback)
  • Futures, forex, macro via AKShare (free, no API key)
  • HK & A-share equities via Futu (broker login required, optional)

Example workflow:

  1. Use list_skills() to discover strategy patterns
  2. Use load_skill("strategy-generate") for the strategy creation guide
  3. Use write_file() to create config.json and code/signal_engine.py
  4. Use backtest() to run and get metrics (Sharpe, return, drawdown, etc.)

Multi-Agent Swarm Teams

29 pre-built agent teams for complex research:

  • Investment Committee: bull/bear debate → risk review → PM decision
  • Global Equities Desk: A-share + HK/US + crypto → global strategist
  • Crypto Trading Desk: funding/basis + liquidation + flow → risk manager
  • Earnings Research Desk: fundamentals + revisions + options → earnings strategist
  • Macro/Rates/FX Desk: rates + FX + commodities → macro PM
  • Quant Strategy Desk: screening → factor research → backtest → risk audit
  • Risk Committee: drawdown, tail risk, regime analysis
  • And 22 more specialized teams

Use list_swarm_presets() to see all teams, then run_swarm() to execute.

Alpha Zoo (452 pre-built alphas)

One-line cross-sectional IC / IR / alive-reversed-dead categorisation across four bundled zoos:

  • qlib158 (154 alphas) — Microsoft Qlib's Alpha158 feature handler, Apache-2.0 with pinned commit SHA.
  • alpha101 (101 alphas) — Kakushadze (2015) "101 Formulaic Alphas" (arXiv:1601.00991), written from the paper appendix.
  • gtja191 (191 alphas) — Guotai Junan 2014 "191 Short-period Trading Alpha Factors" research report.
  • academic (6 factors) — Fama-French 5 + Carhart momentum (honest price-based proxies).

Each alpha ships with __alpha_meta__ (formula LaTeX + theme + universe + warmup + columns required), guarded by an AST purity gate + 300-row lookahead sentinel test. Use the vibe-trading alpha {list,show,bench,compare,export-manifest} CLI, the /alpha/* REST routes (browser at /alpha-zoo), or compose multi-factor signals via ZooSignalEngine.from_zoo(...).

Finance Skills (75)

Comprehensive knowledge base covering:

  • Technical analysis (candlestick, Elliott wave, Ichimoku, SMC, harmonic, chanlun)
  • Quantitative methods (factor research, ML strategy, pair trading, multi-factor)
  • Risk management (VaR/CVaR, stress testing, hedging)
  • Options (Black-Scholes, Greeks, multi-leg strategies, payoff diagrams)
  • HK/US equities (SEC filings, earnings revisions, ETF flows, ADR/H-share arbitrage)
  • Crypto trading desk (funding rates, liquidation heatmaps, stablecoin flows, token unlocks, DeFi yields)
  • Behavioral finance, trade journal diagnostics, shadow account
  • Macro analysis, credit research, sector rotation, and more

Use load_skill(name) to access full methodology docs with code templates.

Available MCP Tools (22)

ToolDescriptionAPI Key
list_skillsList all 75 finance skillsNone
load_skillLoad full skill documentationNone
backtestRun vectorized backtest engineNone*
factor_analysisIC/IR analysis + layered backtestNone*
analyze_optionsBlack-Scholes price + GreeksNone
pattern_recognitionDetect chart patterns (H&S, double top, etc.)None
get_market_dataFetch OHLCV data across 6 sources (auto-detect + fallback)None*
web_searchSearch the web via DuckDuckGoNone
read_urlFetch web page as MarkdownNone
read_documentExtract text from PDF/DOCX/XLSX/PPTX/imagesNone
write_fileWrite files (config, strategy code)None
read_fileRead file contentsNone
analyze_trade_journalParse broker CSV → profile + behavior diagnosticsNone
extract_shadow_strategyDistill 3-5 if-then rules from profitable roundtripsNone
run_shadow_backtestMulti-market backtest + delta-PnL attributionNone*
render_shadow_reportHTML/PDF shadow report (8 sections + charts)None
scan_shadow_signalsToday's symbols matching the shadow's cadenceNone
list_swarm_presetsList multi-agent team presetsNone
run_swarmExecute a multi-agent research teamLLM key
get_swarm_statusPoll swarm run status without blockingNone
get_run_resultGet final report and task summariesNone
list_runsList recent swarm runs with metadataNone

<sub>*A-share symbols require TUSHARE_TOKEN. HK/US/crypto are free.</sub>

Quick Start

pip install vibe-trading-ai

That's it — no API keys needed for HK/US/crypto markets. Start using backtest, get_market_data, analyze_options, analyze_trade_journal, extract_shadow_strategy, web_search, the Alpha Zoo (vibe-trading alpha bench --zoo gtja191 --universe csi300 --period 2018-2025), and all 75 skills immediately.

Loading Tools from External MCP Servers

The built-in agent can load tools from your own external MCP servers in addition to its local toolset.

Note: This is the MCP client path — the opposite of the MCP plugin listed above. The plugin above makes Vibe-Trading's tools available to your agents. This section lets Vibe-Trading's own agent call tools from your servers.

Setup

Create ~/.vibe-trading/agent.json:

{
  "mcpServers": {
    "my-server": {
      "command": "uvx",
      "args": ["my-mcp-server"],
      "toolTimeout": 30,
      "enabledTools": ["*"]
    }
  }
}

Remote tools appear automatically in every vibe-trading run / vibe-trading chat call. They are injected after local tools under stable names: mcp_<server>_<tool>.

Config fields

FieldRequiredDefaultDescription
commandyesExecutable to launch
argsno[]Command arguments
envno{}Extra env vars for the subprocess
toolTimeoutno30Seconds before a tool call is cancelled
enabledToolsno["*"]Allowlist of remote tool names. ["*"] enables all

Per-session override (API)

Security — disabled by default. mcpServers defines subprocess command/args/env and is therefore restricted to operator-level trust. API callers cannot inject MCP server definitions through POST /sessions unless the server operator explicitly opts in.

To enable session-level MCP injection, set the environment variable on the server before starting the agent:

export ALLOW_SESSION_MCP_SERVERS=1

With the opt-in active, pass mcpServers inside session.config to extend or replace the global config for that session only:

{
  "config": {
    "mcpServers": {
      "research": {
        "command": "uvx",
        "args": ["research-mcp"],
        "enabledTools": ["search"]
      }
    }
  }
}

Without ALLOW_SESSION_MCP_SERVERS=1, any mcpServers key in session.config is silently stripped before config loading. The global operator config on disk (~/.vibe-trading/agent.json) is always respected regardless of this flag.

v1 limits

  • Transport: stdio only. SSE and HTTP transports are rejected.
  • Execution: serial only. MCP tools never enter the parallel readonly path.
  • Surfaces: tools only. Resources and prompts are not exposed.
  • Swarm: MCP tools are excluded from Swarm worker registries in v1.
  • Hot reload: not supported. Restart the process to pick up config changes.

Failure handling

CaseBehavior
Missing config filefalls back to empty config — no MCP servers loaded
Invalid config filelogs a warning and falls back to empty config
Server fails to startthat server is skipped; local tools and other servers still load
Tool call times outreturns a normalized error payload instead of raising
Two server names collide after sanitizationdeterministic hash suffix appended; operator warning emitted

Examples

Backtest a MACD strategy on Apple:

Backtest AAPL with MACD crossover strategy (fast=12, slow=26, signal=9) for 2024

Analyze my trade journal and build a Shadow Account:

Call analyze_trade_journal on ~/Downloads/tonghuashun.csv, then extract_shadow_strategy with min_support=3, then run_shadow_backtest for the last year, then render_shadow_report.

Run an investment committee review:

Use run_swarm with investment_committee preset to evaluate NVDA. Variables: target=NVDA.US, market=US

Factor analysis on CSI 300:

Run factor_analysis on CSI 300 stocks using pe_ttm factor from 2023 to 2024

Options analysis:

Use analyze_options: spot=100, strike=105, 90 days, vol=25%, rate=3%