mirror of
https://github.com/zhangxiangliang/stock-api.git
synced 2025-02-02 14:18:44 +08:00
feat: 修改 项目说明示例代码
This commit is contained in:
parent
d52fa41742
commit
a0663455f4
28
README.md
28
README.md
@ -6,13 +6,13 @@
|
||||
|
||||
## 股票数据
|
||||
|
||||
| 名称 | 接口名 | 官网 |
|
||||
| --- | --- | --- |
|
||||
| 基础示例 | base | 无 |
|
||||
| 网易财经 | netease | [传送门](https://money.163.com/) |
|
||||
| 新浪股票 | sina | [传送门](https://finance.sina.com.cn/) |
|
||||
| 名称 | 接口名 | 官网 |
|
||||
| -------- | ------- | -------------------------------------- |
|
||||
| 基础示例 | base | 无 |
|
||||
| 网易财经 | netease | [传送门](https://money.163.com/) |
|
||||
| 新浪股票 | sina | [传送门](https://finance.sina.com.cn/) |
|
||||
|
||||
## 安装
|
||||
## 安装
|
||||
|
||||
```shell
|
||||
npm install stock-api
|
||||
@ -24,10 +24,11 @@ yarn install stock-api
|
||||
### 获取股票实时数据
|
||||
|
||||
```typescript
|
||||
import { api } from 'stock-api/stocks/netease';
|
||||
import { api } from "stock-api/stocks";
|
||||
|
||||
// 省略 async 相关内容
|
||||
const stock = await (new api).getStock('SH510500');
|
||||
const stock = await(new api["sina"]()).getStock("SH510500");
|
||||
const stock = await(new api["netease"]()).getStock("SH510500");
|
||||
|
||||
// 结果:
|
||||
// { code: 'SH510500', name: '500ETF', price: 7.253, percent: -0.001102 }
|
||||
@ -36,10 +37,11 @@ const stock = await (new api).getStock('SH510500');
|
||||
### 获取股票组实时数据
|
||||
|
||||
```typescript
|
||||
import { api } from 'stock-api/stocks/netease';
|
||||
import { api } from "stock-api/stocks";
|
||||
|
||||
// 省略 async 相关内容
|
||||
const stock = await (new api).getStocks(['SH510500']);
|
||||
const stock = await(new api["sina"]()).getStocks(["SH510500"]);
|
||||
const stock = await(new api["netease"]()).getStocks(["SH510500"]);
|
||||
|
||||
// 结果:
|
||||
// [{ code: 'SH510500', name: '500ETF', price: 7.253, percent: -0.001102 }]
|
||||
@ -49,6 +51,6 @@ const stock = await (new api).getStocks(['SH510500']);
|
||||
|
||||
> 韭菜小猪也有暴富梦~
|
||||
|
||||
* 在困惑的城市里总少不了并肩同行的 伙伴 让我们一起成长。
|
||||
* 如果您想让更多人看到文章可以点个 点赞。
|
||||
* 如果您想激励小二可以到 Github 给个 小星星。
|
||||
- 在困惑的城市里总少不了并肩同行的 伙伴 让我们一起成长。
|
||||
- 如果您想让更多人看到文章可以点个 点赞。
|
||||
- 如果您想激励小二可以到 Github 给个 小星星。
|
||||
|
Loading…
Reference in New Issue
Block a user