npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

erlangshen

v0.2.5

Published

二郎神 - 全知全能的AI投资智能体

Readme

二郎神 (Erlangshen) - AI投资智能体

全知全能的AI投资智能体,支持全资产多策略分析。

给 Agent 的 2 分钟上手说明

如果你是 Codex、Claude Code、Gemini CLI 或其他用户侧 Agent,先按下面的顺序理解和使用二郎神:

  1. 二郎神是一个 MCP-first 投资分析 CLI,不是普通聊天机器人。遇到行情、宏观、基金、ETF、市场巡视问题时,优先通过 CLI 命令触发数据链路,再回答用户。
  2. 最短初始化:
npm install -g erlangshen
erlangshen /doctor
erlangshen /login xwab <账号>
erlangshen /model key
erlangshen /workspace allow <项目目录>
  1. 常用工作流:
erlangshen "今天市场环境怎么样"
erlangshen "/patrol"
erlangshen "/patrol run 重点看红利和微盘拥挤"
erlangshen /plan
erlangshen /artifacts
  1. 回答原则:

    • /patrol run 会按利率环境、高频经济金融、市场结构、ETF 被动资金、主动策略五个模块做市场环境巡视。
    • MCP 有结构化数据就优先用 MCP;MCP 缺口用 web_search 交叉验证。
    • 拿不到 Top100 成交占比、ETF 申赎、产品创新高/回撤时,不编造,列为待补数据口径。
    • 用户问“过程怎么看”时,引导查看 /plan;用户问“报告/图表在哪里”时,引导查看 /artifacts/links/open
    • 不要在主回答里复述内部参数、token、API Key、原始 JSON 或冗长工具日志。
  2. 对 Agent 最有用的命令:

| 命令 | 用途 | |------|------| | /doctor | 检查账号、模型、MCP、web_search、工作区是否就绪 | | /patrol | 查看市场环境巡视 SOP | | /patrol run <关注点> | 发起完整市场环境巡视 | | /plan | 复盘本轮意图、工具、MCP 数据、服务端迁移入口和缺口 | | /links | 查看网页、图片、报告、图表等资源入口 | | /artifacts | 查看本地保存的报告和图表 |

功能特性

  • 🤖 多Agent协作: 宏观分析师、股票分析师、多资产分析师
  • 📊 MCP工具: 行情数据、宏观数据、飞书文档
  • 斜杠命令: /analyze, /macro, /stock, /report
  • 🧠 LLM大脑: 支持 DeepSeek、OpenAI 等多种模型
  • 📝 知识沉淀: 纪要、报告自动保存

目录结构

erlangshen/
├── bin/
│   └── erlangshen          # CLI 入口脚本
├── src/
│   ├── cli.py               # CLI 主入口
│   ├── config.py            # 配置管理
│   ├── brain.py             # LLM 大脑
│   ├── mcp/                 # MCP 工具
│   │   ├── market.py        # 行情数据
│   │   ├── macro.py         # 宏观数据
│   │   ├── feishu.py        # 飞书文档
│   │   └── registry.py      # MCP 注册表
│   ├── agents/              # 专业智能体
│   │   ├── base.py          # 基础Agent
│   │   ├── macro.py         # 宏观Agent
│   │   ├── equity.py        # 股票Agent
│   │   └── multi_asset.py   # 多资产Agent
│   ├── commands/             # 斜杠命令
│   │   ├── analyze.py
│   │   ├── macro.py
│   │   ├── stock.py
│   │   ├── report.py
│   │   ├── search.py
│   │   ├── portfolio.py
│   │   ├── risk.py
│   │   └── memo.py
│   ├── skills/              # 技能
│   │   ├── framework.py
│   │   └── templates.py
│   └── hooks/               # 事件钩子
│       ├── session_start.py
│       └── session_end.py
├── .claude/
│   └── settings.json        # 配置文件
├── knowledge/               # 知识库
│   ├── memos/               # 纪要
│   ├── reports/             # 报告
│   ├── insights/            # 洞察
│   └── facts/               # 事实库
└── requirements.txt

安装

npm 安装 (推荐)

# 全局安装
npm install -g erlangshen

# 安装完成后会自动:
# 1. 检查 Python 3.9+
# 2. 安装 Python 依赖
# 3. 创建配置目录 ~/.erlangshen/

手动安装

# 克隆项目
git clone https://github.com/xiaoerdata/xiaoer-erlangshen.git
cd xiaoer-erlangshen

# 安装依赖
pip install -r requirements.txt

# 添加执行权限
chmod +x bin/erlangshen

# 链接到 PATH (可选)
ln -s $(pwd)/bin/erlangshen /usr/local/bin/erlangshen

配置

可以通过 ERLANGSHEN_CONFIG 指定 JSON 配置文件;未指定时默认读取项目内 .claude/settings.json,不存在则读取 ~/.erlangshen/settings.json:

{
  "llm_provider": "deepseek",
  "deepseek_api_key": "your-api-key",
  "deepseek_model": "deepseek-chat",
  "db_host": "localhost",
  "db_port": 5432,
  "db_name": "market",
  "feishu_app_id": "your-feishu-app-id",
  "feishu_app_secret": "your-feishu-app-secret"
}

使用方式

交互模式

erlangshen

命令模式

erlangshen /analyze A股当前走势
erlangshen /macro CPI走势
erlangshen /stock 贵州茅台
erlangshen /report 月度总结

斜杠命令

| 命令 | 说明 | 示例 | |------|------|------| | /analyze | 综合分析 | /analyze A股走势 | | /macro | 宏观分析 | /macro LPR利率 | | /stock | 股票分析 | /stock 茅台 | | /report | 报告生成 | /report 月度报告 | | /search | 搜索 | /search 量化策略 | | /portfolio | 组合分析 | /portfolio 风险 | | /risk | 风险分析 | /risk 市场风险 | | /omniscient --trend-tail | 趋势/尾部流动性判别 | /omniscient --trend-tail AI算力订单上修 | | /memo | 纪要管理 | /memo 记录会议 |

MCP 工具

Market MCP (行情)

  • get_stock_price: 实时股价
  • get_stock_history: 历史行情
  • get_index_quote: 指数行情
  • get_futures_price: 期货价格

Macro MCP (宏观)

  • get_macro_indicator: 宏观指标
  • get_interest_rates: 利率数据
  • get_currency_rates: 汇率数据
  • get_economic_calendar: 经济日历

Feishu MCP (飞书)

  • create_doc: 创建文档
  • append_doc: 追加内容
  • search_docs: 搜索文档
  • send_message: 发送消息

Agents

MacroAgent (宏观分析师)

专注宏观经济、政策解读、大类资产配置

EquityAgent (股票分析师)

专注A股、港股、美股基本面和技术面分析

MultiAssetAgent (多资产分析师)

专注跨资产配置、组合优化、风险预算

开发

# 安装开发依赖
pip install -r requirements-dev.txt

# 运行测试
python -m pytest -q

# 直接运行
python -m src.cli

# 或使用入口脚本
./bin/erlangshen

依赖

  • Python 3.10+
  • openai >= 1.0.0
  • pydantic >= 2.0.0
  • psycopg2-binary >= 2.9.0 (可选,用于数据库)
  • lark-oapi >= 1.0.0 (可选,用于飞书)

License

MIT