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

@xhopcfine/aster-plugin-stock-analysis

v0.1.1

Published

Aster plugin for China A-share market data, news research and visual analysis

Readme

@xhopcfine/aster-plugin-stock-analysis

Aster 的 A 股行情、历史数据、公开新闻与可视化分析插件。

插件用于查看单只股票的实时行情、历史 K 线、收益率、均线、波动率、最大回撤和成交量变化,也可以附加公开新闻链接进行正文提取、事件关键词和情绪归纳。插件不提供选股推荐、自动交易或收益承诺。

Stock Lens 股票分析界面

主要能力

  • 查询 A 股实时行情,新浪行情不可用时自动切换备用数据源。
  • 查询日线、周线和月线历史行情,支持前复权、后复权和不复权。
  • 展示 K 线、成交量、MA5、MA20 和近 60 周期价格位置。
  • 计算区间收益、近 5/20 周期收益、年化波动率、最大回撤、均线和成交量比。
  • 提取公开新闻或政策网页,归纳正文、事件关键词和信息倾向。
  • 根据政策新闻建立产业传导链,筛选候选股票,并逐只调用行情与历史分析进行验证。
  • 使用本地 SQLite 缓存行情和保存分析记录。
  • 向 Aster 暴露完整工具和 OpenAPI,可在插件进程内调用,不依赖 Web 服务端口。

安装

插件和 Aster 都建议始终安装 latest 版本。

1. 安装或升级 Aster

npm install -g aster-agent@latest --registry=https://registry.npmjs.org/

2. 安装或升级插件

npm install -g @xhopcfine/aster-plugin-stock-analysis@latest --registry=https://registry.npmjs.org/

3. 首次注册并启用插件

首次安装时执行:

aster plugins install stock-analysis --package @xhopcfine/aster-plugin-stock-analysis --enabled

如果已经注册过插件,只需要重新执行上面的 npm install -g ...@latest,然后退出并重新启动 Aster,不需要重复注册。

4. 启动 Aster

aster

插件更新后必须重新启动正在运行的 Aster,新的工具和提示词才会生效。

使用示例

安装并重启 Aster 后,可以直接使用自然语言对话,不需要手动输入工具名称。

查询实时行情

查询浦发银行 600000 的实时行情

分析历史走势

分析 600000 最近 250 个交易日的走势,重点说明收益、波动率、最大回撤、均线和成交量变化
分析 000001 的周线历史表现

结合新闻分析一只股票

结合这篇新闻分析 600000 的行情和历史走势:
https://example.com/news.html

根据政策新闻分析潜在受益股票

根据这个政策分析哪些股票可能上涨,并逐只验证实时行情和历史走势:
https://www.gov.cn/zhengce/content/202606/content_7072483.htm

Aster 会调用 stock_analyze_policy_news_opportunities 获取分析流程,然后继续完成:

  1. 提取并核对政策原文。
  2. 拆解政策措施、资金变化、直接和间接受益产业链。
  3. 形成候选股票并核验公司业务、地域和政策关联。
  4. 逐只调用实时行情和历史分析工具。
  5. 比较近 5/20 日收益、均线、成交量、波动率、回撤和价格位置。
  6. 输出“重点研究、次级观察、暂不关注”分组及风险,而不是只凭常识罗列股票。

启动可视化页面

在 Aster 对话中输入:

启动股票分析

然后输入:

打开股票分析页面

默认页面地址:

http://127.0.0.1:8770

页面中输入股票代码即可查看指标卡、K 线、成交量、均线、客观观察和历史分析记录;也可以附加一个公开新闻链接。

独立启动 Web 界面

可以在 Aster 对话中说“启动股票分析”,也可以直接运行:

aster-stock-analysis-web --port 8770 --open

默认地址:

http://127.0.0.1:8770

如需监听局域网地址:

aster-stock-analysis-web --host 0.0.0.0 --port 8770

Aster 工具

| 工具 | 作用 | | --- | --- | | stock_start | 启动 Web/API 服务 | | stock_stop | 停止 Web/API 服务 | | stock_status | 查看服务状态和数据库路径 | | stock_url | 获取 Web 页面地址 | | stock_analyze_policy_news_opportunities | 根据新闻政策生成候选股票筛选、行情验证和评分流程 | | stock_quote | 查询实时行情 | | stock_history | 查询历史行情 | | stock_analyze | 生成统计与新闻综合分析 | | stock_extract_news | 提取公开新闻正文 | | stock_analysis_records | 查询历史分析记录 | | stock_list_available_apis | 列出内部 OpenAPI 接口 | | stock_call_internal_api | 进程内调用 OpenAPI 接口 | | stock_openapi_spec | 获取 OpenAPI JSON |

数据与限制

默认数据库:

~/.aster/plugins/stock-analysis/stock-analysis.db

行情接口属于第三方公开数据源,可能受网络、访问频率、交易时段和数据源策略变化影响。实时行情不等同于交易所直连行情,不应作为自动交易依据。

新闻链接仅支持公开的 httphttps HTML 页面。插件会拦截本机、内网地址和过大的页面内容。

政策新闻分析中的候选股票和机会评分来自公开信息、政策传导逻辑及历史行情统计。政策落地、公司实际受益程度和市场表现均存在不确定性。

本插件输出仅用于公开信息与历史数据研究,不构成投资建议、收益承诺或自动交易依据。

更新插件

后续发布新版本后,执行:

npm install -g @xhopcfine/aster-plugin-stock-analysis@latest --registry=https://registry.npmjs.org/

安装完成后退出并重新启动:

aster