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

nfragrans_stock

v1.0.0

Published

读取stock数据,基于新浪和搜狐的stockAPI

Readme

读取stock数据,基于新浪和搜狐的stockAPI

都存在跨域问题,需要在网站上后端获取,或者使用nodejs生成的网站作为代理服务器(https://gitee.com/QGISER/nfragrans_proxy-server.git)

搜狐数据

1.获取历史数据

getSOHistoryData(symbol, startDate, endDate = getFormattedDate()) url = https://q.stock.sohu.com/hisHq?code=${symbol}&start=${startDate}&end=${endDate}; 返回: [{ date: '2024-11-14', open: '8.30', close: '8.26', change: '-0.09', changePercent: '-1.08%', low: '8.25', high: '8.36', volume: '661416', amount: '54910.66', turnover: '0.27%' }, ...... ]

2.读取某年数据

getSOByYear(symbol, year=null)

3.读取近5年数据

async function getSOBynYears(symbol, year = null, n = 5)

新浪数据

1.读取实时数据

getSNCurrenData(symbol) symbol为股票名称,标准格式sh600519,可输入cn_600519或sh600519或600519,代码自动检测修正。 url=https://hq.sinajs.cn/etag.php?list=${symbol} 返回: [ 0.'"����ę́'//名称, 1.'1467.950'//开盘价, 2.'1467.980'//昨日收盘价, 3.'1450.000'//当前价, 4.'1478.880'//最高价, 5.'1449.340'//最低价, 6.'1450.000'//“买一”报价,
7.'1450.060'//“买一”报价, 8.'3822583'//成交的股票数(股), 9.'5578603148.000'//成交金额(元), 10.'4746'//买1股数,
11.'1450.000'//买1价格, 12.'500'//买2股数,
13.'1449.990'//买2价格, 14.'700'//买3价格, 15.'1449.980'//买3价格,
16.'100'//买4股数,
17.'1449.970'//买4价格, 18.'300'//买5股数,
19.'1449.960'//买5价格, 20.'300'//卖1股数, 21.'1450.060'//卖1价格,
22.'400'//卖2股数,
23.'1450.070'//卖2价格, 24.'100'//卖3股数,
25.'1450.220'//卖3价格, 26.'100'//卖4股数, 27.'1450.660'//卖4价格,
28.'300'//卖5股数,
29.'1450.800'//卖5价格, 30.'2025-10-24'//日期,
31.'15:00:03'//时间, 32.'00', 33.'";\n' ]

2.读取股票分价统计情况

getSNPriceDistribution(symbol, startDate) https://market.finance.sina.com.cn/pricehis.php?symbol=sh600900&startdate=2025-01-01 返回:[ { price: '30.52', volume: '418500' }, { price: '30.51', volume: '718100' }, { price: '30.50', volume: '3202700' }, { price: '30.49', volume: '4873900' }, { price: '30.48', volume: '3723550' }, { price: '30.47', volume: '2221500' }, { price: '30.46', volume: '1215736' }, { price: '30.45', volume: '1464636' }, .... ]

vue element-plus UI

股票代码检索:frvStCode

<frvStCode type="sohu" @getcode="handleGetCode" style="display: inline-block;"> type=sina/sohu/code/name,分别返回sh600519,cn_600519,600519,贵州茅台 handleGetCode(value,name)

某股票某年K线与成交量:frvsKchart

某股票近5年趋势图:frvYchart

组合控件:frvStUI