"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix: Docker build + MCP/PyPI/ClawHub sync (v0.1.4)
warren618b0f59bd7f484
diff --git a/.dockerignore b/.dockerignoreindex ed87752a0..ff1bc3c7b 100644--- a/.dockerignore+++ b/.dockerignore@@ -1,28 +1,50 @@+# Version control & CI+.git/+.github/++# IDE & editor+.claude/+.vscode/+.editorconfig++# Python artifacts.venv/agent/.venv/__pycache__/*.pyc.pytest_cache/.ruff_cache/-node_modules/-frontend/dist/-frontend/tsconfig.tsbuildinfo-.env-agent/.env+agent/vibe_trading.egg-info/+agent/vibe_trading_ai.egg-info/+agent/__pycache__/++# Runtime data (generated at runtime, not in repo)+data/agent/runs/agent/sessions/agent/.swarm/runs/agent/.ui_runtime/agent/.tasks/-agent/vibe_trading.egg-info/-.git/-.github/-.claude/-.vscode/-data/*.duckdb-data/*.duckdb.wal-data/.duckdb_tmp/-data/parquet/-data/backup/-data/minutes/-data/*.log++# Env files (mounted via docker-compose env_file)+.env+agent/.env++# Frontend build (built inside Docker, don't copy local)+frontend/dist/+frontend/node_modules/+frontend/tsconfig.tsbuildinfo++# Tests & docs (not needed in production image)+agent/tests/+docs/+assets/+build/+dist/++# Project docs+CLAUDE.md+CONTRIBUTING.md+*.md+!README.md+!LICENSEdiff --git a/Dockerfile b/Dockerfileindex 299b93db9..64ebd0980 100644--- a/Dockerfile+++ b/Dockerfile@@ -28,7 +28,6 @@ RUN pip install --no-cache-dir -r agent/requirements.txt# Copy projectCOPY pyproject.toml LICENSE README.md ./COPY agent/ agent/-COPY data/ data/# Copy built frontendCOPY --from=frontend-build /app/frontend/dist frontend/distdiff --git a/README.md b/README.mdindex 90e3f0c2d..dde49d503 100644--- a/README.md+++ b/README.md@@ -45,7 +45,7 @@## π° News-- **2026-04-10** π§ **Performance & multi-provider**: LLM timeout 2400sβ120s, all tuning params configurable via `.env`. Added 11 LLM providers (DeepSeek, Groq, Gemini, Ollama, etc.). Hardened `ml-strategy` skill template with input validation and inf/NaN sanitization.+- **2026-04-10** π¦ **v0.1.4**: Fix Docker build ([#8](https://github.com/HKUDS/Vibe-Trading/issues/8)), add `web_search` MCP tool (17 total), `akshare`/`ccxt` in deps & MCP. 11 LLM providers (DeepSeek, Groq, Gemini, Ollama, etc.), all tuning params via `.env`. Hardened `ml-strategy` skill. Published to PyPI and ClawHub.- **2026-04-09** π **Backtest Wave 2 β multi-asset engines**: added ChinaFutures (CFFEX/SHFE/DCE/ZCE, 50+ contracts), GlobalFutures (CME/ICE/Eurex, 30+ contracts), Forex (24 pairs, spread + swap), Options v2 (American exercise, IV smile). Statistical validation: Monte Carlo permutation test, Bootstrap Sharpe CI, Walk-Forward analysis.- **2026-04-08** π§ **Multi-market backtest** with per-market rules; **Pine Script v6 export** for TradingView. **Data source expansion**: 5 sources with auto-fallback, `web_search` tool, skill categorization (7 categories).- **2026-04-01** π **v0.1.0** β Initial release: ReAct agent, 64 skills, 29 swarm presets, cross-market backtest, CLI + Web UI + MCP server.@@ -227,7 +227,7 @@ vibe-trading-mcp # start MCP server (stdio)git clone https://github.com/HKUDS/Vibe-Trading.gitcd Vibe-Tradingcp agent/.env.example agent/.env-# Edit agent/.env β set OPENAI_API_KEY (required)+# Edit agent/.env β uncomment your LLM provider and set API keydocker compose up --build```@@ -245,7 +245,7 @@ source .venv/bin/activate # Linux / macOS# .venv\Scripts\Activate.ps1 # Windows PowerShellpip install -e .-cp agent/.env.example agent/.env # Edit β set OPENAI_API_KEY+cp agent/.env.example agent/.env # Edit β set your LLM provider API keyvibe-trading # Launch interactive TUI```@@ -390,7 +390,7 @@ Interactive docs: `http://localhost:8899/docs`## π MCP Plugin-Vibe-Trading exposes 16 MCP tools for any MCP-compatible client. Runs as a stdio subprocess β no server setup needed. **15 of 16 tools work with zero API keys** (HK/US/crypto). Only `run_swarm` needs an LLM key.+Vibe-Trading exposes 17 MCP tools for any MCP-compatible client. Runs as a stdio subprocess β no server setup needed. **16 of 17 tools work with zero API keys** (HK/US/crypto). Only `run_swarm` needs an LLM key.<details><summary><b>Claude Desktop</b></summary>@@ -432,7 +432,7 @@ vibe-trading-mcp --transport sse # SSE for web clients</details>-**MCP tools exposed (16):** `list_skills`, `load_skill`, `backtest`, `factor_analysis`, `analyze_options`, `pattern_recognition`, `get_market_data`, `read_url`, `read_document`, `read_file`, `write_file`, `list_swarm_presets`, `run_swarm`, `get_swarm_status`, `get_run_result`, `list_runs`.+**MCP tools exposed (17):** `list_skills`, `load_skill`, `backtest`, `factor_analysis`, `analyze_options`, `pattern_recognition`, `get_market_data`, `web_search`, `read_url`, `read_document`, `read_file`, `write_file`, `list_swarm_presets`, `run_swarm`, `get_swarm_status`, `get_run_result`, `list_runs`.<details><summary><b>Install from ClawHub (one command)</b></summary>@@ -490,7 +490,7 @@ Vibe-Trading/βββ agent/ # Backend (Python)β βββ cli.py # CLI entrypoint β interactive TUI + subcommandsβ βββ api_server.py # FastAPI server β runs, sessions, upload, swarm, SSE-β βββ mcp_server.py # MCP server β 16 tools for OpenClaw / Claude Desktop+β βββ mcp_server.py # MCP server β 17 tools for OpenClaw / Claude Desktopβ ββ βββ src/β β βββ agent/ # ReAct agent core@@ -518,7 +518,7 @@ Vibe-Trading/β β βββ providers/ # LLM provider abstractionβ ββ βββ backtest/ # Backtest engines-β β βββ engines/ # daily_portfolio + options_portfolio+β β βββ engines/ # 7 engines: china_a, global_equity, crypto, china_futures, global_futures, forex + options_portfolioβ β βββ loaders/ # 5 sources: tushare, okx, yfinance, akshare, ccxtβ β β βββ base.py # DataLoader Protocolβ β β βββ registry.py # Registry + auto-fallback chains@@ -579,9 +579,7 @@ Areas we'd love help with:| Area | Difficulty | Description ||------|:----------:|-------------|-| Intraday backtest engine | Hard | Sub-daily (1m/5m/1H) bar execution with proper session handling || Options vol surface & Greeks viz | Hard | 3D implied-vol surface, delta/gamma/vega charts in frontend |-| Monte Carlo & stress testing | Hard | Scenario simulation, regime-switching, tail-risk analysis || Portfolio optimizer constraints | Medium | Leverage limits, sector caps, turnover penalties || Correlation heatmap dashboard | Medium | Cross-asset correlation matrix with time-window slider || New data source loader | Medium | Implement `DataLoader` Protocol for a new exchange/vendor |diff --git a/agent/SKILL.md b/agent/SKILL.mdindex f81bec7a0..0bd3c8c37 100644--- a/agent/SKILL.md+++ b/agent/SKILL.md@@ -1,6 +1,7 @@---name: vibe-trading-description: Professional finance research toolkit β backtesting, factor analysis, options pricing, 64 finance skills, and 29 multi-agent swarm teams across 3 markets (A-shares, crypto, HK/US equities).+version: 0.1.4+description: Professional finance research toolkit β backtesting (6 engines), factor analysis, options pricing, 68 finance skills, and 29 multi-agent swarm teams across 5 data sources (tushare, yfinance, okx, akshare, ccxt).dependencies:python: ">=3.11"pip:@@ -10,7 +11,7 @@ env:description: "Tushare API token for China A-share data (optional β HK/US/crypto work without any key)"required: false- name: OPENAI_API_KEY- description: "OpenAI-compatible API key β only needed for run_swarm (multi-agent teams). All other 15 tools work without it."+ description: "OpenAI-compatible API key β only needed for run_swarm (multi-agent teams). All other 16 tools work without it."required: false- name: LANGCHAIN_MODEL_NAMEdescription: "LLM model name for run_swarm (e.g. deepseek/deepseek-v3.2). Only needed if using run_swarm."@@ -22,7 +23,7 @@ mcp:# Vibe-Trading-Professional finance research toolkit with AI-powered backtesting, multi-agent teams, and 64 specialized skills.+Professional finance research toolkit with AI-powered backtesting (6 engines), multi-agent teams, and 68 specialized skills.## Setup@@ -52,7 +53,7 @@ Add to your agent's MCP config:### API Key Requirements-**15 of 16 MCP tools work with zero API keys.** After `pip install`, backtesting, market data, factor analysis, options pricing, chart patterns, and all 64 skills are ready to use for HK/US equities and crypto.+**16 of 17 MCP tools work with zero API keys.** After `pip install`, backtesting, market data, factor analysis, options pricing, chart patterns, web search, and all 68 skills are ready to use for HK/US equities and crypto.| Feature | Key needed | When ||---------|-----------|------|@@ -63,10 +64,11 @@ Add to your agent's MCP config:## What You Can Do### Backtesting-Create and run quantitative strategies across 3 markets:+Create and run quantitative strategies across 6 engines (ChinaA, GlobalEquity, Crypto, ChinaFutures, GlobalFutures, Forex + options) with 5 data sources:- **HK/US equities** via yfinance (free, no API key)-- **Cryptocurrency** via OKX (free, no API key)-- **China A-shares** via Tushare (requires TUSHARE_TOKEN)+- **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)Example workflow:1. Use `list_skills()` to discover strategy patterns@@ -87,7 +89,7 @@ Example workflow:Use `list_swarm_presets()` to see all teams, then `run_swarm()` to execute.-### Finance Skills (64)+### Finance Skills (68)Comprehensive knowledge base covering:- Technical analysis (candlestick, Elliott wave, Ichimoku, SMC)- Quantitative methods (factor research, ML strategy, pair trading)@@ -99,17 +101,18 @@ Comprehensive knowledge base covering:Use `load_skill(name)` to access full methodology docs with code templates.-## Available MCP Tools (16)+## Available MCP Tools (17)| Tool | Description | API Key ||------|-------------|---------|-| `list_skills` | List all 64 finance skills | None |+| `list_skills` | List all 68 finance skills | None || `load_skill` | Load full skill documentation | None || `backtest` | Run vectorized backtest engine | None* || `factor_analysis` | IC/IR analysis + layered backtest | None* || `analyze_options` | Black-Scholes price + Greeks | None || `pattern_recognition` | Detect chart patterns (H&S, double top, etc.) | None |-| `get_market_data` | Fetch OHLCV data across 3 markets (auto-detect source) | None* |+| `get_market_data` | Fetch OHLCV data across 5 sources (auto-detect + fallback) | None* |+| `web_search` | Search the web via DuckDuckGo | None || `read_url` | Fetch web page as Markdown | None || `read_document` | Extract text from PDF (with OCR) | None || `write_file` | Write files (config, strategy code) | None |@@ -128,7 +131,7 @@ Use `load_skill(name)` to access full methodology docs with code templates.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`, and all 64 skills immediately.+That's it β no API keys needed for HK/US/crypto markets. Start using `backtest`, `get_market_data`, `analyze_options`, `web_search`, and all 68 skills immediately.## Examplesdiff --git a/agent/mcp_server.py b/agent/mcp_server.pyindex 157bfd17b..737a4d5ae 100644--- a/agent/mcp_server.py+++ b/agent/mcp_server.py@@ -1,8 +1,8 @@#!/usr/bin/env python3-"""Vibe-Trading MCP Server β expose 16 finance research tools to any MCP client.+"""Vibe-Trading MCP Server β expose 17 finance research tools to any MCP client.Works with OpenClaw, Claude Desktop, Cursor, and any MCP-compatible client.-Zero API key required for HK/US/crypto markets (yfinance + OKX are free).+Zero API key required for HK/US/crypto markets (yfinance, OKX, AKShare are free).Usage:python mcp_server.py # stdio transport (default)@@ -75,7 +75,7 @@ def _get_registry():def list_skills() -> str:"""List all available finance skills with names and descriptions.- Returns a JSON array of {name, description} for all 56 skills.+ Returns a JSON array of {name, description} for all 68 skills.Use load_skill(name) to get the full documentation for any skill."""loader = _get_skills_loader()@@ -117,7 +117,9 @@ def backtest(run_dir: str) -> str:- "yfinance": HK/US equities (free, no API key needed)- "okx": cryptocurrency (free, no API key needed)- "tushare": China A-shares (requires TUSHARE_TOKEN env var)- - "auto": auto-detect based on symbol format+ - "akshare": A-shares, US, HK, futures, forex (free, no API key)+ - "ccxt": crypto from 100+ exchanges (free, no API key)+ - "auto": auto-detect based on symbol format (with fallback)Returns metrics (Sharpe, return, drawdown, etc.) and artifact paths.@@ -246,6 +248,27 @@ def read_document(file_path: str) -> str:return registry.execute("read_document", {"file_path": file_path})+# ---------------------------------------------------------------------------+# Web search tool+# ---------------------------------------------------------------------------++def web_search(query: str, max_results: int = 5) -> str:+ """Search the web via DuckDuckGo and return top results.++ Returns titles, URLs, and snippets. Use read_url() to fetch full content+ from any result URL. Free, no API key required.++ Args:+ query: Search query string.+ max_results: Maximum results to return (default 5, max 10).+ """+ registry = _get_registry()+ return registry.execute("web_search", {+ "query": query, "max_results": min(max_results, 10),+ })++# ---------------------------------------------------------------------------# File I/O tools (sandboxed to workspace)# ---------------------------------------------------------------------------@@ -354,6 +377,7 @@ _SOURCE_PATTERNS = [(re.compile(r"^[A-Z]+\.US$", re.I), "yfinance"),(re.compile(r"^\d{3,5}\.HK$", re.I), "yfinance"),(re.compile(r"^[A-Z]+-USDT$", re.I), "okx"),+ (re.compile(r"^[A-Z]+/USDT$", re.I), "ccxt"),]@@ -365,13 +389,9 @@ def _detect_source(code: str) -> str:def _get_loader(source: str):- if source == "okx":- from backtest.loaders.okx import DataLoader- elif source == "yfinance":- from backtest.loaders.yfinance_loader import DataLoader- else:- from backtest.loaders.tushare import DataLoader- return DataLoader+ """Get loader class via registry with fallback support."""+ from backtest.loaders.registry import get_loader_cls_with_fallback+ return get_loader_cls_with_fallback(source)@mcp.tool@@ -388,13 +408,15 @@ def get_market_data(- "yfinance": HK/US equities (free, e.g. AAPL.US, 700.HK)- "okx": cryptocurrency (free, e.g. BTC-USDT, ETH-USDT)- "tushare": China A-shares (requires TUSHARE_TOKEN, e.g. 000001.SZ)- - "auto": auto-detect based on symbol format (supports mixed markets)+ - "akshare": A-shares, US, HK, futures, forex (free, e.g. 000001.SZ, AAPL.US)+ - "ccxt": crypto from 100+ exchanges (free, e.g. BTC/USDT)+ - "auto": auto-detect based on symbol format (with fallback)Args:codes: List of symbols (e.g. ["AAPL.US", "BTC-USDT", "000001.SZ"]).start_date: Start date (YYYY-MM-DD).end_date: End date (YYYY-MM-DD).- source: Data source ("auto", "yfinance", "okx", "tushare").+ source: Data source ("auto", "yfinance", "okx", "tushare", "akshare", "ccxt").interval: Bar size (1m/5m/15m/30m/1H/4H/1D, default "1D")."""results = {}diff --git a/agent/requirements.txt b/agent/requirements.txtindex 694c84e56..cfecd1f34 100644--- a/agent/requirements.txt+++ b/agent/requirements.txt@@ -26,6 +26,8 @@ pyharmonics>=1.5.0tushare>=1.2.89requests>=2.31.0yfinance>=0.2.30+akshare>=1.12.0+ccxt>=4.0.0# REST API & SSEfastapi>=0.104.0diff --git a/docker-compose.yml b/docker-compose.ymlindex 4a55bb8df..0b5b447d1 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -6,12 +6,10 @@ services:env_file:- agent/.envvolumes:- - fin-data:/app/data- - fin-runs:/app/agent/runs- - fin-sessions:/app/agent/sessions+ - vibe-runs:/app/agent/runs+ - vibe-sessions:/app/agent/sessionsrestart: unless-stoppedvolumes:- fin-data:- fin-runs:- fin-sessions:+ vibe-runs:+ vibe-sessions:diff --git a/pyproject.toml b/pyproject.tomlindex effd0387d..2723d8968 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,6 +1,6 @@[project]name = "vibe-trading-ai"-version = "0.1.3"+version = "0.1.4"description = "Natural-language finance research AI agent with backtesting"requires-python = ">=3.11"license = "MIT"@@ -36,6 +36,8 @@ dependencies = ["tushare>=1.2.89","requests>=2.31.0","yfinance>=0.2.30",+ "akshare>=1.12.0",+ "ccxt>=4.0.0","fastapi>=0.104.0","uvicorn[standard]>=0.24.0","pydantic>=2.0.0",@@ -55,7 +57,7 @@ vibe-trading-mcp = "mcp_server:main"[tool.setuptools]package-dir = {"" = "agent"}-py-modules = ["cli", "run_agent", "api_server", "mcp_server"]+py-modules = ["cli", "api_server", "mcp_server"][tool.setuptools.packages.find]where = ["agent"]