Socket
Socket
Sign inDemoInstall

stock-api

Package Overview
Dependencies
41
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    stock-api

【韭菜小猪】免费股票数据分析相关接口


Version published
Weekly downloads
33
decreased by-57.69%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

股票数据小助手

Coverage Status Downloads Version License License

简介

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

股票数据

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

安装

npm install stock-api

使用

接口概览

股票代码

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

交易所代号实例
上海交易所SHSH000001
深圳交易所SZSZ399001
香港交易所HKHKHSI
美国交易所USUSDJI

选择数据源

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

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

搜索股票代码

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

// 获取股票组实时数据
stocks.netease.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.netease.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.netease.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 给个 小星星。

Keywords

FAQs

Last updated on 28 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc