Git Product home page Git Product logo

stock-api's Introduction

股票数据小助手

Coverage Status Downloads Version License License

简介

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

股票数据

名称 接口名 搜索股票代码 获取股票实时数据 获取股票组实时数据 官网
网易财经 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 给个 小星星。

stock-api's People

Contributors

jimmylv avatar zhangxiangliang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.