Integrating Historical data query、Real-time market data search and WeChat integration — a unified Skill with three major capabilities.
Architecture Overview
┌─────────────┐ ┌──────────────┐ ┌─────────────────┐
│ 微信用户 │────▶│ picoclaw │────▶│ stock-mcp (8001) │
│ (WeChat) │ │ (LLM Gateway)│ │ 历史数据查询 │
└─────────────┘ │ port:18790 │ ├─────────────────┤
│ 微信 Channel │ │ WS (8765) │
┌─────────────┐ │ │────▶│ 实时行情推送 │
│ Web 前端 │────▶│ MCP Client │ └─────────────────┘
│ (18080) │ └──────────────┘
└─────────────┘
Core Capabilities
| Capability | Protocol | Port | Description |
|---|---|---|---|
| Historical data query | MCP (streamable-http) | 8001 | K-lines/financials/indices/ETFs, etc. |
| Real-time market data push | WebSocket | 8765 | A-shares/Hong Kong stocks/ETFs tick-by-tick |
| WeChat interaction | picoclaw WeChat Channel | — | Natural language → MCP tool invocation |
Quick Start
One-click Start
bash skills/stock-data-assistant/start_wechat_bridge.sh
This command will perform the following in sequence:
- Check/download picoclaw — automatically detect the system architecture and download from GitHub Releases
- Generate configuration — from
.envread the LLM configuration, generatepicoclaw.yaml - Start picoclaw — start Gateway (18790) + WeChat Channel
- Start real-time subscription — start the WebSocket push service (8765)
WeChat login
# 显示微信登录二维码(扫码后即绑定)
.local/bin/picoclaw auth weixin
# 或者使用完整路径
./.local/bin/picoclaw auth weixin
After a successful QR code scan, you can directly send messages in WeChat to operate on stock data.
WeChat Conversation Example
📱 你: 查一下贵州茅台最近的日K线
🤖 AI: 正在为您查询贵州茅台(600519.SH)的日线数据...
📱 你: 腾讯控股现在价格多少?
🤖 AI: 腾讯控股(00700.HK) 当前价 XXX.XX 港元,涨幅 X.XX%
📱 你: 监控 00700.HK 涨跌超过2%就通知我
🤖 AI: 已设置涨跌幅告警,触发条件:±2.00%
📱 你: 列出今天涨幅最大的10只A股
🤖 AI: 正在筛选今日涨幅榜 Top 10...
Manual Step-by-step Operation
Step 1: Install picoclaw
bash skills/stock-data-assistant/setup_picoclaw.sh
# 或指定版本
bash skills/stock-data-assistant/setup_picoclaw.sh v0.2.5
Step 2: Generate picoclaw configuration
python3 skills/stock-data-assistant/generate_picoclaw_config.py
# 自定义参数
python3 skills/stock-data-assistant/generate_picoclaw_config.py \
--mcp-token sk-your-token-here \
--output ./my-config.yaml
Step 3: Start picoclaw
export PATH=".local/bin:$PATH"
picoclaw run --config .local/picoclaw.yaml
Step 4: Log in to WeChat
picoclaw auth weixin
Configuration Instructions
LLM configuration (automatically reused from .env)
The configuration generator will automatically read the following environment variables:
| Variable | Description | Default value |
|---|---|---|
OPENAI_API_KEY |
API key | (required) |
OPENAI_BASE_URL |
API endpoint | https://api.openai.com/v1 |
OPENAI_MODEL |
Model name | gpt-4 |
MCP Server Configuration
| Variable | Description |
|---|---|
STOCK_MCP_SERVER_URL |
MCP service address (default http://localhost:8001/messages) |
STOCK_MCP_TOKEN |
MCP authentication token |
Generated configuration file structure
See references/picoclaw_config_example.yaml
Management Commands
# 查看状态
bash skills/stock-data-assistant/start_wechat_bridge.sh --status
# 停止所有服务
bash skills/stock-data-assistant/start_wechat_bridge.sh --stop
# 仅启动(不启用实时订阅)
bash skills/stock-data-assistant/start_wechat_bridge.sh --no-rt
# 指定订阅股票
bash skills/stock-data-assistant/start_wechat_bridge.sh --symbols 00700.HK,600519.SH
MCP Tools Overview (available via WeChat)
After picoclaw connects to stock_datasource via the MCP protocol, the following tools are all available in WeChat:
K-line data
tushare_daily_get_daily_data— daily K-lines (OHLCV)tushare_daily_get_latest_daily— latest trading day dataakshare_hk_*— Hong Kong stock daily data
Fundamentals
tushare_daily_basic_get_daily_basic— indicators such as PE/PB/market captushare_balancesheet_*— balance sheettushare_income_*— income statementtushare_cashflow_*— cash flow statement
Indices and ETFs
tushare_index_*— index datatushare_fund_*— ETF data
Market
tushare_trade_cal_get_cal— trading calendar
The complete tool list can be dynamically obtained via the MCP
tools/listinterface (about 76+ tools)
Real-time data (WebSocket)
Provided via skills/stock-rt-subscribe , supporting:
- Real-time push: updates quotes every 3–5 seconds
- Multi-market: A-shares / Hong Kong stocks / ETF
- Alert strategies: limit up/limit down, sharp fluctuations, unusual volume, price breakout
Detailed documentation: ../stock-rt-subscribe/SKILL.md
Directory structure
skills/stock-data-assistant/
├── SKILL.md # 本文档
├── setup_picoclaw.sh # 自动下载 picoclaw
├── generate_picoclaw_config.py # 从 .env 生成配置
├── start_wechat_bridge.sh # 一键启动脚本
└── references/
└── picoclaw_config_example.yaml # 配置示例
Troubleshooting
| Issue | Solution |
|---|---|
| picoclaw download failed | Check network/proxy; or manually download from GitHub and place it in .local/bin/ |
OPENAI_API_KEY not set |
Ensure the .env file contains the OPENAI_API_KEY field |
API key required (MCP) |
Set the STOCK_MCP_TOKEN environment variable or edit the configuration file |
| WeChat QR code expired | Re-run picoclaw auth weixin |
| No real-time data push | Check whether subscribe_client.py is running normally and whether port 8765 is reachable |
| picoclaw cannot call MCP tools | Confirm that the MCP service (8001) is running normally and the token is valid |
Dependencies
- Python >= 3.9 — used for configuration generation and real-time data subscription
- picoclaw >= v0.2.5 — automatically installed by
setup_picoclaw.shAuto Install - stock_datasource MCP service — port 8001 (must be started first)
- stock_datasource Backend — port 6666 (must be started first)