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
7a4938ed3a
commit
952b9ca62e
@ -20,6 +20,14 @@ const Base: StockApi = {
|
||||
*/
|
||||
async getStocks(codes: string[]): Promise<Stock[]> {
|
||||
throw new Error("未实现获取股票数据组");
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索股票代码
|
||||
* @param key 关键字
|
||||
*/
|
||||
async searchStocks(key: string): Promise<Stock[]> {
|
||||
throw new Error("未实现搜索股票代码");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -67,6 +67,14 @@ const Netease: StockApi = {
|
||||
yesterday: 0,
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索股票代码
|
||||
* @param key 关键字
|
||||
*/
|
||||
async searchStocks(key: string): Promise<Stock[]> {
|
||||
throw new Error("未实现搜索股票代码");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,14 @@ const Sina: StockApi = {
|
||||
|
||||
return data.getStock();
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索股票代码
|
||||
* @param key 关键字
|
||||
*/
|
||||
async searchStocks(key: string): Promise<Stock[]> {
|
||||
throw new Error("未实现搜索股票代码");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,14 @@ const Tencent: StockApi = {
|
||||
|
||||
return data.getStock();
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索股票代码
|
||||
* @param key 关键字
|
||||
*/
|
||||
async searchStocks(key: string): Promise<Stock[]> {
|
||||
throw new Error("未实现搜索股票代码");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,14 @@ const Xueqiu: StockApi & { getToken(): Promise<string> } = {
|
||||
const data = (new XueqiuStockTransform(code, params.quote));
|
||||
return data.getStock();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索股票代码
|
||||
* @param key 关键字
|
||||
*/
|
||||
async searchStocks(key: string): Promise<Stock[]> {
|
||||
throw new Error("未实现搜索股票代码");
|
||||
}
|
||||
}
|
||||
|
||||
|
6
types/stocks/index.d.ts
vendored
6
types/stocks/index.d.ts
vendored
@ -12,6 +12,12 @@ export interface StockApi {
|
||||
* @param codes 股票代码组
|
||||
*/
|
||||
getStocks(codes: string[]): Promise<Stock[]>;
|
||||
|
||||
/**
|
||||
* 搜索股票代码
|
||||
* @param key 关键字
|
||||
*/
|
||||
searchStocks(key: string): Promise<Stock[]>;
|
||||
}
|
||||
|
||||
export default StockApi;
|
||||
|
Loading…
Reference in New Issue
Block a user