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 🙏

© 2024 – Pkg Stats / Ryan Hefner

linxiaowu-stock-api

v2.1.2

Published

免费股票数据分析相关接口

Downloads

10

Readme

在原有的功能上加上支持基金查询,目前测试了一下只有腾讯的接口支持,所以暂时加在腾讯的接口上 使用 FUND100032 即可查到对应的基金

简介

一款聚焦在 股票实时数据周边相关服务 的接口小助手。

股票数据

| 名称 | 接口名 | 搜索股票代码 | 获取股票实时数据 | 获取股票组实时数据 | 官网 | | :---: | :---: | :---: | :---: | :---: | :---: | | 网易财经 | netease | 已实现 | 已实现 | 已实现 | 传送门 | | 雪球 | xueqiu | 已实现 | 已实现 | 已实现 | 传送门 | | 新浪股票 | sina | 已实现 | 已实现 | 已实现 | 传送门 | | 腾讯股票 | tencent | 已实现 | 已实现 | 已实现 | 传送门 |

安装

npm install stock-api
yarn add stock-api

使用

接口概览

股票代码

由于每个交易所数据规则不一样,为了能统一规范对代码定义了规则 交易所+股票代码

| 交易所 | 代号 | 实例 | | --- | --- | --- | | 上海交易所 | SH | SH000001 | | 深圳交易所 | SZ | SZ399001 | | 香港交易所 | HK | HKHSI | | 美国交易所 | US | USDJI |

选择数据源

可选导入
import { stocks } from "stock-api";

// 数据源
const sina = stocks.sina;
const xueqiu = stocks.xueqiu;
const netease = stocks.netease;
const tencent = stocks.tencent;

搜索股票代码

示例
import { stocks } from "stock-api";

// 获取股票组实时数据
stocks.sina.searchStocks(["510500"]).then(console.log);
输出
 [{
    code: 'SH510500',
    name: '500ETF',
    percent: 0.028383,
    now: 7.174,
    low: 6.93,
    high: 7.184,
    yesterday: 6.976
  }]

获取股票实时数据

示例
import { stocks } from "stock-api";

// 获取股票实时数据
stocks.sina.getStock("SH510500").then(console.log);
输出
{
  code: 'SH510500',
  name: '500ETF',
  percent: 0.028383,
  now: 7.174,
  low: 6.93,
  high: 7.184,
  yesterday: 6.976
}

获取股票组实时数据

示例
import { stocks } from "stock-api";

// 获取股票组实时数据
stocks.sina.getStocks(["SH510500"]).then(console.log);
输出
 [{
    code: 'SH510500',
    name: '500ETF',
    percent: 0.028383,
    now: 7.174,
    low: 6.93,
    high: 7.184,
    yesterday: 6.976
  }]

一起成长

韭菜小猪也有暴富梦~

  • 在困惑的城市里总少不了并肩同行的 伙伴 让我们一起成长。
  • 如果您想让更多人看到文章可以点个 点赞。
  • 如果您想激励小二可以到 Github 给个 小星星。