Lightweight A-share (Chinese stock market) monitoring daemon. Watchlist, price/fund-flow alerts, digest reports, and an agent-friendly HTTP API. Reports good news and bad — like a magpie (喜鹊).
🦅 monitoring tool, not investment advice. Data is best-effort from public sources with 3–60s delay. Do your own research. Markets are risky.
- 🐦 Real-time quotes — sina + tencent direct (≤500ms, 5s delay)
- 💰 Fund flow — 主力 / 超大单 / 大单 / 中单 / 小单 净流入 (Eastmoney)
- 📊 K-lines — daily / weekly / monthly, up to 1000 rows
- 🏆 龙虎榜 — top-50 daily billboard
- 👀 Watchlist — local SQLite, group/tag/note
- 🚨 Alert rules —
gte / lte / breakout / breakdown+ 30min cooldown + Feishu webhook - 📺 Digests — morning / evening / weekly markdown reports
- ⏰ Scheduler — 09:25 / 15:30 / Fri 15:35 auto-push, trading-day-aware
- 🤖 Agent skill — drop-in
SKILL.mdfor OpenClaw / clawhub - 🔌 HTTP API — 13 endpoints,
127.0.0.1:17891, no auth needed locally
# npm
npm i -g @symbolstar/magpie
# or via clawhub (if you're an OpenClaw user)
clawhub install magpieYou also need Python ≥ 3.10 for the data worker. magpie will fall back to system python3.
pip install -r "$(npm root -g)/@symbolstar/magpie/requirements.txt"# 1. Add stocks to watch (6-digit codes, no prefix)
magpie watch add 600519 -n "贵州茅台"
magpie watch add 000858 -n "五粮液"
magpie watch add 002594 -n "比亚迪"
# 2. Add alert rules
magpie alert add 600519 lte 1300 --note "抄底位"
magpie alert add 000858 breakout 100
# 3. (Optional) Feishu bot webhook for push
export MAGPIE_FEISHU_WEBHOOK="https://open.feishu.cn/open-apis/bot/v2/hook/xxx"
# 4. Start the daemon (HTTP + poller + scheduler)
magpie start
# → magpie v0.0.4 listening on http://127.0.0.1:17891
# → phase: post · poller: on · scheduler: onNow during trading hours the daemon polls every 5s and pushes Feishu cards when rules trigger. At 09:25 / 15:30 / Fri 15:35 it pushes a markdown digest.
magpie start [--port 17891] [--no-poll] [--no-schedule]
magpie quote <code...> fetch one or many quotes
magpie flow <code> latest fund flow (亿元)
magpie kline <code> [--period daily|weekly|monthly] [--days 30]
magpie lhb [--date YYYY-MM-DD]
magpie digest <type> morning|evening|weekly [--push feishu]
magpie watch add <code> [-n name] [-g group] [--note ...]
magpie watch list
magpie watch remove <code>
magpie alert add <code> <type> <threshold> [--note ...] [--channel feishu]
magpie alert list [--code 600519]
magpie alert disable <id>
magpie alert history [--days 7]
magpie status phase + poller stats + counts
magpie test-fire <code> simulate a quote price for rule firing
magpie poll-once one polling tick (for cron / heartbeat use)
Base URL: http://127.0.0.1:17891
| Method | Path | Purpose |
|---|---|---|
| GET | /api/v1/health |
service + market phase + poller |
| GET | /api/v1/quote/:code |
single quote |
| GET | /api/v1/quotes?codes=A,B,C |
batch quotes |
| GET | /api/v1/flow/:code |
fund flow |
| GET | /api/v1/kline/:code?period=daily&days=30 |
K-line rows |
| GET | /api/v1/lhb?date=YYYY-MM-DD |
龙虎榜 (default today) |
| GET | `/api/v1/digest?type=morning | evening |
| GET / POST / DELETE | /api/v1/watchlist[/:code] |
watchlist CRUD |
| GET / POST / DELETE | /api/v1/alerts[/:id] |
alert-rule CRUD |
| GET | /api/v1/alerts/history?days=7 |
fired alerts log |
| Source | Used for | Delay |
|---|---|---|
sina (hq.sinajs.cn) |
primary quote | 5s |
tencent (qt.gtimg.cn) |
fallback quote | 5s |
Eastmoney push2 |
fund flow / k-line | 60s |
| Eastmoney datacenter | 龙虎榜 | ~18:00 same day |
| akshare (Python) | optional, for advanced data | varies |
No tokens, no logins, no proxies needed. If sina blocks you, magpie auto-falls back to tencent.
magpie ships with a SKILL.md that teaches your OpenClaw agents to call the daemon over HTTP. It covers triggers, output style, ambiguous stock names, alert types, failure modes, and market-phase semantics.
To install for your agents:
# Option A: via clawhub
clawhub install magpie
# Option B: symlink the skill folder
ln -s "$(npm root -g)/@symbolstar/magpie/skill" ~/.openclaw/workspace/skills/magpieThen ask any agent: "查一下茅台" / "今天五粮液资金流如何" / "给比亚迪设个 100 元突破告警".
┌─────────────────────────────────────┐
user ──HTTP─►│ Node daemon (commander + http) │◄── agents (SKILL.md)
│ ┌──────────────────────────────┐ │
│ │ Poller (5s盘中 / 5min闲时) │ │
│ │ Scheduler (09:25 / 15:30 ...)│ │
│ │ Rule engine (gte/lte/break*)│ │
│ │ SQLite (watchlist/rules/cache)│ │
│ └──────────────────────────────┘ │
│ │ │
└─────────────spawn child─────────────┘
▼
┌──────────────────────────────────────┐
│ Python worker (fetch.py) │
│ - sina / tencent (quote) │
│ - eastmoney push2 (flow / kline) │
│ - eastmoney datacenter (lhb) │
└──────────────────────────────────────┘
| Env | Default | Purpose |
|---|---|---|
MAGPIE_HOME |
~/.magpie |
SQLite + logs directory |
MAGPIE_PORT |
17891 |
HTTP port |
MAGPIE_HOST |
127.0.0.1 |
bind host |
MAGPIE_FEISHU_WEBHOOK |
— | Feishu bot webhook URL |
MAGPIE_PYTHON |
python3 |
python interpreter path |
- ✅ A-share quotes, fund flow, K-line, 龙虎榜
- ✅ Watchlist + alert rules (gte / lte / breakout / breakdown)
- ✅ Daily / weekly digest (morning / evening / weekly)
- ✅ Feishu webhook notifier
- ✅ OpenClaw skill integration
- 🚧 HK / US markets
- 🚧 Technical indicators (MA / MACD / RSI / BOLL)
- 🚧 Portfolio tracking (holdings, P&L)
- 🚧 Telegram / Discord notifiers
- 🚧 Sector / industry analysis
MIT © SymbolStar