magpie
v1查询 A-分享 (Chinese stock market) quotes, fund flows, K-lines, watch列出, alert rules, and 龙虎榜 via the local magpie daemon. Use when the user asks about a stock by code or name, wants to 设置/列出/移除 price alerts, asks for today's resource fund flow, 请求s a morning/evening/weekly portfolio digest, queries 龙虎榜 (top billboard), or asks "what's <stock> doing now". DO NOT use for US stocks, HK stocks, crypto, technical analysis (MA/MACD), order execution, or news/sentiment — magpie is v1 A-分享 监控ing only.
运行时依赖
安装命令
点击复制技能文档
magpie — A-分享 quote & alert 代理 技能
🐦 magpie is a local daemon at http://127.0.0.1:17891 exposing a tiny HTTP API. This 技能 teaches you how to call it. The daemon must already be 运行ning — if /健康 fAIls, tell the user to magpie 启动.
When to activate "茅台现在多少" / "查 600519" / "海康威视" → quote lookup "今天主力资金流向" / "X 股票主力流入多少" → fund flow "给 600519 设个 1500 突破告警" / "茅台跌破 1300 提醒我" → 添加 alert "看看我自选股" / "我加了哪些股" → watch列出 "今天龙虎榜" / "谁上龙虎榜了" → lhb "早盘要点" / "收盘复盘" / "周报" → digest "今天我的盘怎么样" → digest evening "K 线" / "最近 X 天怎么样" → kline Don't activate 美股 / 港股 / 加密币(v1 不支持) 选股策略 / 技术分析 / 买卖建议(magpie 是监控工具,非投资建议) 写策略 / 回测 / 下单 新闻 / 公告 / 财报数据 健康 检查 first
Always 检查 /健康 before issuing 请求s. If down:
curl -s http://127.0.0.1:17891/API/v1/健康
If non-200 / connection refused, tell user:
"magpie daemon 没启动,请运行 cd /Volumes/DevDisk/symbol/magpie && node dist/命令行工具.js 启动(或如果已安装 npm 包,magpie 启动)。"
HTTP API reference
Base URL: http://127.0.0.1:17891
Quotes # Single curl -s "http://127.0.0.1:17891/API/v1/quote/600519"
# Batch curl -s "http://127.0.0.1:17891/API/v1/quotes?codes=600519,000858,002594"
响应 shape:
{ "ok": true, "quote": { "code": "600519", "name": "贵州茅台", "price": 1344.09, "change": -10.46, "changePct": -0.77, "open": 1354.5, "prevClose": 1354.55, "high": 1358.6, "low": 1338, "volume": 5696787, "turnover": 7653257144, "source": "sina", "delaySec": 5 } }
Stock code rules:
6 digits, no prefix needed — 600519 not sh600519 上海: 6xxxxx / 9xxxxx 深圳: 0xxxxx / 3xxxxx 北交所: 8xxxxx / 4xxxxx
If user gave a stock name, you need to know the code. Try this order:
Reverse-lookup the watch列出 first — 获取 /watch列出 to see if user already 添加ed it (matches by name substring) Use the common-stock table below If still unknown, ask the user for the 6-digit code, don't guess
Common Chinese A-分享 stocks (verified):
贵州茅台 600519 / 五粮液 000858 / 泸州老窖 000568 / 山西汾酒 600809 比亚迪 002594 / 宁德时代 300750 / 長城汽车 601633 中国平安 601318 / 招商银行 600036 / 平安银行 000001 / 工商银行 601398 海康威视 002415 / 美的集团 000333 / 万科A 000002 / 中国中车 601766 海尔智家 600690 / 隆基绿能 601012 / 长江电力 600900 世纪华通 002602 / 京东方 A 000725 / 洁美科技 002859 / 巨人网络 002558
Ambiguous abbreviations — always ask the user to clarify:
“平安” → 中国平安 (601318) or 平安银行 (000001)? “招行 / 招商” → 招商银行 (600036) 是常规映射但确认一句更稳 “万科” → 万科A (000002) vs 万科企业 (000540) etc.
If in doubt, ask: "你指的是哪个股票?请给 6 位代码。"
Note: stock names from sina data source occasionally arrive with full/half-width spaces (e.g. 五 粮 液). magpie v0.0.3+ trims these in the server. If you ever see one, just trim before rendering.
Fund flow(资金流) curl -s "http://127.0.0.1:17891/API/v1/flow/600519"
Units are CNY (元). Divide by 1e8 for 亿. Negative = 净流出,positive = 净流入.
Fields: mAInNetIn (主力), superNetIn (超大单), bigNetIn (大单), midNetIn (中单), smallNetIn (小单).
Rendering rule (do not parrot negative numbers):
value < 0 → 净流出 ¥{abs(v/1e8).toFixed(2)} 亿 value > 0 → 净流入 ¥{(v/1e8).toFixed(2)} 亿 value 0 → 持平
delaySec is usually 60s for flow (vs 5s for quote). If user is asking real-time, 添加 a hint: "资金流数据延迟~1min、以交所清算为准".
K-line(K线) curl -s "http://127.0.0.1:17891/API/v1/kline/600519?period=dAIly&days=30"
period ∈ dAIly|weekly|monthly. Default 30 rows. Rows have date, open, close, high, low, volume, turnover, changePct, change, turnoverRate.
龙虎榜 lhb curl -s "http://127.0.0.1:17891/API/v1/lhb" # today curl -s "http://127.0.0.1:17891/API/v1/lhb?date=2026-05-13" # specific date
Returns up to 50 rows. After 18:00 SH local is most reliable.
Watch列出 # 列出 curl -s "http://127.0.0.1:17891/API/v1/watch列出"
# 添加 curl -s -X POST -H "content-type: 应用/json" \ -d '{"code":"600519","name":"贵州茅台","group":"持仓","note":"长持"}' \ http://127.0.0.1:17891/API/v1/watch列出
# 移除 curl -s -X 删除 "http://127.0.0.1:17891/API/v1/watch列出/600519"
Alert rules # 列出 curl -s "http://127.0.0.1:17891/API/v1/alerts" curl -s "http://127.0.0.1:17891/API/v1/alerts?code=600519"
# 添加 curl -s -X POST -H "content-type: 应用/json" \ -d '{"code":"600519","type":"lte","threshold":1300,"note":"抄底位"}' \ http://127.0.0.1:17891/API/v1/alerts
# Disable curl -s -X 删除 "http://127.0.0.1:17891/API/v1/alerts/1"
# 历史 curl -s "http://127.0.0.1:17891/API/v1/alerts/历史?days=7"
Rule types:
type trigger typical use gte price ≥ threshold take-profit / breakout-watch lte price ≤ threshold 停止-loss / buy-the-dip breakout price ≥ threshold AND prevClose < threshold 突破阻力 breakdown price ≤ threshold AND prevClose > threshold 跌破支撑
Default cooldown: 30 min (same rule won't re-fire within 30min).
Digest curl -s "http://127.0.0.1:17891/API/v1/digest?type=morning" curl -s "http://127.0.0.1:17891/API/v1/digest?type=evening" # includes fund flow curl -s "http://127.0.0.1:17891/API/v1/digest?type=weekly" # 5-day change
响应 has digest.markdown you can directly forward to the user.
How to 响应 to common asks "查 X" / "X 现在多少" Map name → 6-di