mirror of
https://github.com/zhangxiangliang/stock-api.git
synced 2025-01-23 06:00:24 +08:00
feat: 修改 项目说明示例代码、增加 项目页内接口跳转
This commit is contained in:
parent
30e40bcc8d
commit
5fcd19d518
34
README.md
34
README.md
@ -33,6 +33,13 @@ yarn install stock-api
|
||||
|
||||
## 使用
|
||||
|
||||
### 接口概览
|
||||
|
||||
* [选择数据源](#选择数据源)
|
||||
* [搜索股票代码](#搜索股票代码)
|
||||
* [获取股票实时数据](#获取股票实时数据)
|
||||
* [获取股票组实时数据](#获取股票组实时数据)
|
||||
|
||||
### 股票代码
|
||||
|
||||
由于每个交易所数据规则不一样,为了能统一规范对代码定义了规则 `交易所+股票代码`。
|
||||
@ -59,6 +66,31 @@ const netease = stocks.netease;
|
||||
const tencent = stocks.tencent;
|
||||
```
|
||||
|
||||
### 搜索股票代码
|
||||
|
||||
##### 示例
|
||||
|
||||
```typescript
|
||||
import { stocks } from "stock-api";
|
||||
|
||||
// 获取股票组实时数据
|
||||
stocks.sina.searchStocks(["510500"]).then(console.log);
|
||||
```
|
||||
|
||||
##### 输出
|
||||
|
||||
```typescript
|
||||
[{
|
||||
code: 'SH510500',
|
||||
name: '500ETF',
|
||||
percent: 0.028383,
|
||||
now: 7.174,
|
||||
low: 6.93,
|
||||
high: 7.184,
|
||||
yesterday: 6.976
|
||||
}]
|
||||
```
|
||||
|
||||
### 获取股票实时数据
|
||||
|
||||
##### 示例
|
||||
@ -109,6 +141,8 @@ stocks.sina.getStocks(["SH510500"]).then(console.log);
|
||||
}]
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 一起成长
|
||||
|
||||
> 韭菜小猪也有暴富梦~
|
||||
|
Loading…
Reference in New Issue
Block a user