Skip to content

Commit 92ef6d4

Browse files
committed
fix: Docker build + MCP/PyPI/ClawHub sync (v0.1.4)
- Fix #8: remove COPY data/ data/ from Dockerfile (dir doesn't exist) - Add akshare/ccxt to requirements.txt and pyproject.toml dependencies - Remove non-existent run_agent from py-modules - MCP: rewrite _get_loader to use registry with fallback, add web_search tool (16→17) - MCP: update docstrings (56→68 skills, add akshare/ccxt source docs) - ClawHub SKILL.md: 64→68 skills, 3→5 sources, 16→17 tools, add version field - docker-compose: remove dead fin-data volume, rename fin-→vibe- prefix - .dockerignore: expand exclusions (tests, docs, assets, build artifacts) - README: merge 4/10 news, update MCP 16→17, fix contributing (remove done items) - Bump version 0.1.3→0.1.4, published to PyPI and ClawHub
1 parent c4f4218 commit 92ef6d4

8 files changed

Lines changed: 106 additions & 60 deletions

File tree

.dockerignore

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,50 @@
1+
# Version control & CI
2+
.git/
3+
.github/
4+
5+
# IDE & editor
6+
.claude/
7+
.vscode/
8+
.editorconfig
9+
10+
# Python artifacts
111
.venv/
212
agent/.venv/
313
__pycache__/
414
*.pyc
515
.pytest_cache/
616
.ruff_cache/
7-
node_modules/
8-
frontend/dist/
9-
frontend/tsconfig.tsbuildinfo
10-
.env
11-
agent/.env
17+
agent/vibe_trading.egg-info/
18+
agent/vibe_trading_ai.egg-info/
19+
agent/__pycache__/
20+
21+
# Runtime data (generated at runtime, not in repo)
22+
data/
1223
agent/runs/
1324
agent/sessions/
1425
agent/.swarm/runs/
1526
agent/.ui_runtime/
1627
agent/.tasks/
17-
agent/vibe_trading.egg-info/
18-
.git/
19-
.github/
20-
.claude/
21-
.vscode/
22-
data/*.duckdb
23-
data/*.duckdb.wal
24-
data/.duckdb_tmp/
25-
data/parquet/
26-
data/backup/
27-
data/minutes/
28-
data/*.log
28+
29+
# Env files (mounted via docker-compose env_file)
30+
.env
31+
agent/.env
32+
33+
# Frontend build (built inside Docker, don't copy local)
34+
frontend/dist/
35+
frontend/node_modules/
36+
frontend/tsconfig.tsbuildinfo
37+
38+
# Tests & docs (not needed in production image)
39+
agent/tests/
40+
docs/
41+
assets/
42+
build/
43+
dist/
44+
45+
# Project docs
46+
CLAUDE.md
47+
CONTRIBUTING.md
48+
*.md
49+
!README.md
50+
!LICENSE

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ RUN pip install --no-cache-dir -r agent/requirements.txt
2828
# Copy project
2929
COPY pyproject.toml LICENSE README.md ./
3030
COPY agent/ agent/
31-
COPY data/ data/
3231

3332
# Copy built frontend
3433
COPY --from=frontend-build /app/frontend/dist frontend/dist

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
## 📰 News
4747

48-
- **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.
48+
- **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.
4949
- **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.
5050
- **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).
5151
- **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)
227227
git clone https://github.com/HKUDS/Vibe-Trading.git
228228
cd Vibe-Trading
229229
cp agent/.env.example agent/.env
230-
# Edit agent/.env — set OPENAI_API_KEY (required)
230+
# Edit agent/.env — uncomment your LLM provider and set API key
231231
docker compose up --build
232232
```
233233

@@ -245,7 +245,7 @@ source .venv/bin/activate # Linux / macOS
245245
# .venv\Scripts\Activate.ps1 # Windows PowerShell
246246

247247
pip install -e .
248-
cp agent/.env.example agent/.env # Edit — set OPENAI_API_KEY
248+
cp agent/.env.example agent/.env # Edit — set your LLM provider API key
249249
vibe-trading # Launch interactive TUI
250250
```
251251

@@ -390,7 +390,7 @@ Interactive docs: `http://localhost:8899/docs`
390390

391391
## 🔌 MCP Plugin
392392

393-
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.
393+
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.
394394

395395
<details>
396396
<summary><b>Claude Desktop</b></summary>
@@ -432,7 +432,7 @@ vibe-trading-mcp --transport sse # SSE for web clients
432432

433433
</details>
434434

435-
**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`.
435+
**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`.
436436

437437
<details>
438438
<summary><b>Install from ClawHub (one command)</b></summary>
@@ -490,7 +490,7 @@ Vibe-Trading/
490490
├── agent/ # Backend (Python)
491491
│ ├── cli.py # CLI entrypoint — interactive TUI + subcommands
492492
│ ├── api_server.py # FastAPI server — runs, sessions, upload, swarm, SSE
493-
│ ├── mcp_server.py # MCP server — 16 tools for OpenClaw / Claude Desktop
493+
│ ├── mcp_server.py # MCP server — 17 tools for OpenClaw / Claude Desktop
494494
│ │
495495
│ ├── src/
496496
│ │ ├── agent/ # ReAct agent core
@@ -518,7 +518,7 @@ Vibe-Trading/
518518
│ │ └── providers/ # LLM provider abstraction
519519
│ │
520520
│ ├── backtest/ # Backtest engines
521-
│ │ ├── engines/ # daily_portfolio + options_portfolio
521+
│ │ ├── engines/ # 7 engines: china_a, global_equity, crypto, china_futures, global_futures, forex + options_portfolio
522522
│ │ ├── loaders/ # 5 sources: tushare, okx, yfinance, akshare, ccxt
523523
│ │ │ ├── base.py # DataLoader Protocol
524524
│ │ │ └── registry.py # Registry + auto-fallback chains
@@ -579,9 +579,7 @@ Areas we'd love help with:
579579

580580
| Area | Difficulty | Description |
581581
|------|:----------:|-------------|
582-
| Intraday backtest engine | Hard | Sub-daily (1m/5m/1H) bar execution with proper session handling |
583582
| Options vol surface & Greeks viz | Hard | 3D implied-vol surface, delta/gamma/vega charts in frontend |
584-
| Monte Carlo & stress testing | Hard | Scenario simulation, regime-switching, tail-risk analysis |
585583
| Portfolio optimizer constraints | Medium | Leverage limits, sector caps, turnover penalties |
586584
| Correlation heatmap dashboard | Medium | Cross-asset correlation matrix with time-window slider |
587585
| New data source loader | Medium | Implement `DataLoader` Protocol for a new exchange/vendor |

agent/SKILL.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: vibe-trading
3-
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).
3+
version: 0.1.4
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).
45
dependencies:
56
python: ">=3.11"
67
pip:
@@ -10,7 +11,7 @@ env:
1011
description: "Tushare API token for China A-share data (optional — HK/US/crypto work without any key)"
1112
required: false
1213
- name: OPENAI_API_KEY
13-
description: "OpenAI-compatible API key — only needed for run_swarm (multi-agent teams). All other 15 tools work without it."
14+
description: "OpenAI-compatible API key — only needed for run_swarm (multi-agent teams). All other 16 tools work without it."
1415
required: false
1516
- name: LANGCHAIN_MODEL_NAME
1617
description: "LLM model name for run_swarm (e.g. deepseek/deepseek-v3.2). Only needed if using run_swarm."
@@ -22,7 +23,7 @@ mcp:
2223

2324
# Vibe-Trading
2425

25-
Professional finance research toolkit with AI-powered backtesting, multi-agent teams, and 64 specialized skills.
26+
Professional finance research toolkit with AI-powered backtesting (6 engines), multi-agent teams, and 68 specialized skills.
2627

2728
## Setup
2829

@@ -52,7 +53,7 @@ Add to your agent's MCP config:
5253

5354
### API Key Requirements
5455

55-
**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.
56+
**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.
5657

5758
| Feature | Key needed | When |
5859
|---------|-----------|------|
@@ -63,10 +64,11 @@ Add to your agent's MCP config:
6364
## What You Can Do
6465

6566
### Backtesting
66-
Create and run quantitative strategies across 3 markets:
67+
Create and run quantitative strategies across 6 engines (ChinaA, GlobalEquity, Crypto, ChinaFutures, GlobalFutures, Forex + options) with 5 data sources:
6768
- **HK/US equities** via yfinance (free, no API key)
68-
- **Cryptocurrency** via OKX (free, no API key)
69-
- **China A-shares** via Tushare (requires TUSHARE_TOKEN)
69+
- **Cryptocurrency** via OKX or CCXT/100+ exchanges (free, no API key)
70+
- **China A-shares** via Tushare (token) or AKShare (free fallback)
71+
- **Futures, forex, macro** via AKShare (free, no API key)
7072

7173
Example workflow:
7274
1. Use `list_skills()` to discover strategy patterns
@@ -87,7 +89,7 @@ Example workflow:
8789

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

90-
### Finance Skills (64)
92+
### Finance Skills (68)
9193
Comprehensive knowledge base covering:
9294
- Technical analysis (candlestick, Elliott wave, Ichimoku, SMC)
9395
- Quantitative methods (factor research, ML strategy, pair trading)
@@ -99,17 +101,18 @@ Comprehensive knowledge base covering:
99101

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

102-
## Available MCP Tools (16)
104+
## Available MCP Tools (17)
103105

104106
| Tool | Description | API Key |
105107
|------|-------------|---------|
106-
| `list_skills` | List all 64 finance skills | None |
108+
| `list_skills` | List all 68 finance skills | None |
107109
| `load_skill` | Load full skill documentation | None |
108110
| `backtest` | Run vectorized backtest engine | None* |
109111
| `factor_analysis` | IC/IR analysis + layered backtest | None* |
110112
| `analyze_options` | Black-Scholes price + Greeks | None |
111113
| `pattern_recognition` | Detect chart patterns (H&S, double top, etc.) | None |
112-
| `get_market_data` | Fetch OHLCV data across 3 markets (auto-detect source) | None* |
114+
| `get_market_data` | Fetch OHLCV data across 5 sources (auto-detect + fallback) | None* |
115+
| `web_search` | Search the web via DuckDuckGo | None |
113116
| `read_url` | Fetch web page as Markdown | None |
114117
| `read_document` | Extract text from PDF (with OCR) | None |
115118
| `write_file` | Write files (config, strategy code) | None |
@@ -128,7 +131,7 @@ Use `load_skill(name)` to access full methodology docs with code templates.
128131
pip install vibe-trading-ai
129132
```
130133

131-
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.
134+
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.
132135

133136
## Examples
134137

agent/mcp_server.py

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python3
2-
"""Vibe-Trading MCP Server — expose 16 finance research tools to any MCP client.
2+
"""Vibe-Trading MCP Server — expose 17 finance research tools to any MCP client.
33
44
Works with OpenClaw, Claude Desktop, Cursor, and any MCP-compatible client.
5-
Zero API key required for HK/US/crypto markets (yfinance + OKX are free).
5+
Zero API key required for HK/US/crypto markets (yfinance, OKX, AKShare are free).
66
77
Usage:
88
python mcp_server.py # stdio transport (default)
@@ -75,7 +75,7 @@ def _get_registry():
7575
def list_skills() -> str:
7676
"""List all available finance skills with names and descriptions.
7777
78-
Returns a JSON array of {name, description} for all 56 skills.
78+
Returns a JSON array of {name, description} for all 68 skills.
7979
Use load_skill(name) to get the full documentation for any skill.
8080
"""
8181
loader = _get_skills_loader()
@@ -117,7 +117,9 @@ def backtest(run_dir: str) -> str:
117117
- "yfinance": HK/US equities (free, no API key needed)
118118
- "okx": cryptocurrency (free, no API key needed)
119119
- "tushare": China A-shares (requires TUSHARE_TOKEN env var)
120-
- "auto": auto-detect based on symbol format
120+
- "akshare": A-shares, US, HK, futures, forex (free, no API key)
121+
- "ccxt": crypto from 100+ exchanges (free, no API key)
122+
- "auto": auto-detect based on symbol format (with fallback)
121123
122124
Returns metrics (Sharpe, return, drawdown, etc.) and artifact paths.
123125
@@ -246,6 +248,27 @@ def read_document(file_path: str) -> str:
246248
return registry.execute("read_document", {"file_path": file_path})
247249

248250

251+
# ---------------------------------------------------------------------------
252+
# Web search tool
253+
# ---------------------------------------------------------------------------
254+
255+
@mcp.tool
256+
def web_search(query: str, max_results: int = 5) -> str:
257+
"""Search the web via DuckDuckGo and return top results.
258+
259+
Returns titles, URLs, and snippets. Use read_url() to fetch full content
260+
from any result URL. Free, no API key required.
261+
262+
Args:
263+
query: Search query string.
264+
max_results: Maximum results to return (default 5, max 10).
265+
"""
266+
registry = _get_registry()
267+
return registry.execute("web_search", {
268+
"query": query, "max_results": min(max_results, 10),
269+
})
270+
271+
249272
# ---------------------------------------------------------------------------
250273
# File I/O tools (sandboxed to workspace)
251274
# ---------------------------------------------------------------------------
@@ -354,6 +377,7 @@ def run_swarm(preset_name: str, variables: dict[str, str]) -> str:
354377
(re.compile(r"^[A-Z]+\.US$", re.I), "yfinance"),
355378
(re.compile(r"^\d{3,5}\.HK$", re.I), "yfinance"),
356379
(re.compile(r"^[A-Z]+-USDT$", re.I), "okx"),
380+
(re.compile(r"^[A-Z]+/USDT$", re.I), "ccxt"),
357381
]
358382

359383

@@ -365,13 +389,9 @@ def _detect_source(code: str) -> str:
365389

366390

367391
def _get_loader(source: str):
368-
if source == "okx":
369-
from backtest.loaders.okx import DataLoader
370-
elif source == "yfinance":
371-
from backtest.loaders.yfinance_loader import DataLoader
372-
else:
373-
from backtest.loaders.tushare import DataLoader
374-
return DataLoader
392+
"""Get loader class via registry with fallback support."""
393+
from backtest.loaders.registry import get_loader_cls_with_fallback
394+
return get_loader_cls_with_fallback(source)
375395

376396

377397
@mcp.tool
@@ -388,13 +408,15 @@ def get_market_data(
388408
- "yfinance": HK/US equities (free, e.g. AAPL.US, 700.HK)
389409
- "okx": cryptocurrency (free, e.g. BTC-USDT, ETH-USDT)
390410
- "tushare": China A-shares (requires TUSHARE_TOKEN, e.g. 000001.SZ)
391-
- "auto": auto-detect based on symbol format (supports mixed markets)
411+
- "akshare": A-shares, US, HK, futures, forex (free, e.g. 000001.SZ, AAPL.US)
412+
- "ccxt": crypto from 100+ exchanges (free, e.g. BTC/USDT)
413+
- "auto": auto-detect based on symbol format (with fallback)
392414
393415
Args:
394416
codes: List of symbols (e.g. ["AAPL.US", "BTC-USDT", "000001.SZ"]).
395417
start_date: Start date (YYYY-MM-DD).
396418
end_date: End date (YYYY-MM-DD).
397-
source: Data source ("auto", "yfinance", "okx", "tushare").
419+
source: Data source ("auto", "yfinance", "okx", "tushare", "akshare", "ccxt").
398420
interval: Bar size (1m/5m/15m/30m/1H/4H/1D, default "1D").
399421
"""
400422
results = {}

agent/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ pyharmonics>=1.5.0
2626
tushare>=1.2.89
2727
requests>=2.31.0
2828
yfinance>=0.2.30
29+
akshare>=1.12.0
30+
ccxt>=4.0.0
2931

3032
# REST API & SSE
3133
fastapi>=0.104.0

docker-compose.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ services:
66
env_file:
77
- agent/.env
88
volumes:
9-
- fin-data:/app/data
10-
- fin-runs:/app/agent/runs
11-
- fin-sessions:/app/agent/sessions
9+
- vibe-runs:/app/agent/runs
10+
- vibe-sessions:/app/agent/sessions
1211
restart: unless-stopped
1312

1413
volumes:
15-
fin-data:
16-
fin-runs:
17-
fin-sessions:
14+
vibe-runs:
15+
vibe-sessions:

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "vibe-trading-ai"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
description = "Natural-language finance research AI agent with backtesting"
55
requires-python = ">=3.11"
66
license = "MIT"
@@ -36,6 +36,8 @@ dependencies = [
3636
"tushare>=1.2.89",
3737
"requests>=2.31.0",
3838
"yfinance>=0.2.30",
39+
"akshare>=1.12.0",
40+
"ccxt>=4.0.0",
3941
"fastapi>=0.104.0",
4042
"uvicorn[standard]>=0.24.0",
4143
"pydantic>=2.0.0",
@@ -55,7 +57,7 @@ vibe-trading-mcp = "mcp_server:main"
5557

5658
[tool.setuptools]
5759
package-dir = {"" = "agent"}
58-
py-modules = ["cli", "run_agent", "api_server", "mcp_server"]
60+
py-modules = ["cli", "api_server", "mcp_server"]
5961

6062
[tool.setuptools.packages.find]
6163
where = ["agent"]

0 commit comments

Comments
 (0)