stock-sdk 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -11
- package/dist/index.cjs +5581 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -6
- package/dist/index.d.ts +38 -6
- package/dist/index.js +5578 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -5
package/dist/index.d.cts
CHANGED
|
@@ -193,10 +193,25 @@ interface FundQuote {
|
|
|
193
193
|
raw: string[];
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
/**
|
|
197
|
+
* 获取全部 A 股行情的配置选项
|
|
198
|
+
*/
|
|
199
|
+
interface GetAllAShareQuotesOptions {
|
|
200
|
+
/** 单次请求的股票数量,默认 800 */
|
|
201
|
+
batchSize?: number;
|
|
202
|
+
/** 最大并发请求数,默认 5 */
|
|
203
|
+
concurrency?: number;
|
|
204
|
+
/** 进度回调函数 */
|
|
205
|
+
onProgress?: (completed: number, total: number) => void;
|
|
206
|
+
}
|
|
207
|
+
declare class StockSDK {
|
|
208
|
+
private baseUrl;
|
|
209
|
+
private timeout;
|
|
210
|
+
constructor(options?: {
|
|
211
|
+
baseUrl?: string;
|
|
212
|
+
timeout?: number;
|
|
213
|
+
});
|
|
214
|
+
private request;
|
|
200
215
|
/**
|
|
201
216
|
* 获取 A 股 / 指数 全量行情
|
|
202
217
|
* @param codes 如 ['sz000858', 'sh600000']
|
|
@@ -205,7 +220,7 @@ declare class TencentStockSDK {
|
|
|
205
220
|
private parseFullQuote;
|
|
206
221
|
/**
|
|
207
222
|
* 获取简要行情
|
|
208
|
-
* @param codes 如 ['
|
|
223
|
+
* @param codes 如 ['sz000858', 'sh000001'](自动添加 s_ 前缀)
|
|
209
224
|
*/
|
|
210
225
|
getSimpleQuotes(codes: string[]): Promise<SimpleQuote[]>;
|
|
211
226
|
private parseSimpleQuote;
|
|
@@ -247,6 +262,23 @@ declare class TencentStockSDK {
|
|
|
247
262
|
key: string;
|
|
248
263
|
fields: string[];
|
|
249
264
|
}[]>;
|
|
265
|
+
/**
|
|
266
|
+
* 获取全部 A 股实时行情(使用内置股票代码列表)
|
|
267
|
+
* @param options 配置选项
|
|
268
|
+
* @param options.batchSize 单次请求的股票数量,默认 800
|
|
269
|
+
* @param options.concurrency 最大并发请求数,默认 5
|
|
270
|
+
* @param options.onProgress 进度回调函数
|
|
271
|
+
* @returns 全部 A 股的实时行情数据
|
|
272
|
+
*/
|
|
273
|
+
getAllAShareQuotes(options?: GetAllAShareQuotesOptions): Promise<FullQuote[]>;
|
|
274
|
+
/**
|
|
275
|
+
* 获取全部 A 股实时行情(使用自定义股票代码列表)
|
|
276
|
+
* @param codes 股票代码列表
|
|
277
|
+
* @param options 配置选项
|
|
278
|
+
*/
|
|
279
|
+
getAllQuotesByCodes(codes: string[], options?: GetAllAShareQuotesOptions): Promise<FullQuote[]>;
|
|
250
280
|
}
|
|
251
281
|
|
|
252
|
-
|
|
282
|
+
declare const codeList: string[];
|
|
283
|
+
|
|
284
|
+
export { type FullQuote, type FundFlow, type FundQuote, type GetAllAShareQuotesOptions, type HKQuote, type PanelLargeOrder, type SimpleQuote, StockSDK, type USQuote, codeList, StockSDK as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -193,10 +193,25 @@ interface FundQuote {
|
|
|
193
193
|
raw: string[];
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
/**
|
|
197
|
+
* 获取全部 A 股行情的配置选项
|
|
198
|
+
*/
|
|
199
|
+
interface GetAllAShareQuotesOptions {
|
|
200
|
+
/** 单次请求的股票数量,默认 800 */
|
|
201
|
+
batchSize?: number;
|
|
202
|
+
/** 最大并发请求数,默认 5 */
|
|
203
|
+
concurrency?: number;
|
|
204
|
+
/** 进度回调函数 */
|
|
205
|
+
onProgress?: (completed: number, total: number) => void;
|
|
206
|
+
}
|
|
207
|
+
declare class StockSDK {
|
|
208
|
+
private baseUrl;
|
|
209
|
+
private timeout;
|
|
210
|
+
constructor(options?: {
|
|
211
|
+
baseUrl?: string;
|
|
212
|
+
timeout?: number;
|
|
213
|
+
});
|
|
214
|
+
private request;
|
|
200
215
|
/**
|
|
201
216
|
* 获取 A 股 / 指数 全量行情
|
|
202
217
|
* @param codes 如 ['sz000858', 'sh600000']
|
|
@@ -205,7 +220,7 @@ declare class TencentStockSDK {
|
|
|
205
220
|
private parseFullQuote;
|
|
206
221
|
/**
|
|
207
222
|
* 获取简要行情
|
|
208
|
-
* @param codes 如 ['
|
|
223
|
+
* @param codes 如 ['sz000858', 'sh000001'](自动添加 s_ 前缀)
|
|
209
224
|
*/
|
|
210
225
|
getSimpleQuotes(codes: string[]): Promise<SimpleQuote[]>;
|
|
211
226
|
private parseSimpleQuote;
|
|
@@ -247,6 +262,23 @@ declare class TencentStockSDK {
|
|
|
247
262
|
key: string;
|
|
248
263
|
fields: string[];
|
|
249
264
|
}[]>;
|
|
265
|
+
/**
|
|
266
|
+
* 获取全部 A 股实时行情(使用内置股票代码列表)
|
|
267
|
+
* @param options 配置选项
|
|
268
|
+
* @param options.batchSize 单次请求的股票数量,默认 800
|
|
269
|
+
* @param options.concurrency 最大并发请求数,默认 5
|
|
270
|
+
* @param options.onProgress 进度回调函数
|
|
271
|
+
* @returns 全部 A 股的实时行情数据
|
|
272
|
+
*/
|
|
273
|
+
getAllAShareQuotes(options?: GetAllAShareQuotesOptions): Promise<FullQuote[]>;
|
|
274
|
+
/**
|
|
275
|
+
* 获取全部 A 股实时行情(使用自定义股票代码列表)
|
|
276
|
+
* @param codes 股票代码列表
|
|
277
|
+
* @param options 配置选项
|
|
278
|
+
*/
|
|
279
|
+
getAllQuotesByCodes(codes: string[], options?: GetAllAShareQuotesOptions): Promise<FullQuote[]>;
|
|
250
280
|
}
|
|
251
281
|
|
|
252
|
-
|
|
282
|
+
declare const codeList: string[];
|
|
283
|
+
|
|
284
|
+
export { type FullQuote, type FundFlow, type FundQuote, type GetAllAShareQuotesOptions, type HKQuote, type PanelLargeOrder, type SimpleQuote, StockSDK, type USQuote, codeList, StockSDK as default };
|