stock-sdk 1.0.1 → 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/dist/index.d.cts CHANGED
@@ -46,8 +46,10 @@ interface FullQuote {
46
46
  amount: number;
47
47
  /** 换手率% */
48
48
  turnoverRate: number | null;
49
- /** 市盈率 */
49
+ /** 市盈率(TTM) */
50
50
  pe: number | null;
51
+ /** 振幅% */
52
+ amplitude: number | null;
51
53
  /** 流通市值(亿) */
52
54
  circulatingMarketCap: number | null;
53
55
  /** 总市值(亿) */
@@ -58,6 +60,22 @@ interface FullQuote {
58
60
  limitUp: number | null;
59
61
  /** 跌停价 */
60
62
  limitDown: number | null;
63
+ /** 量比 */
64
+ volumeRatio: number | null;
65
+ /** 均价 */
66
+ avgPrice: number | null;
67
+ /** 市盈率(静) */
68
+ peStatic: number | null;
69
+ /** 市盈率(动) */
70
+ peDynamic: number | null;
71
+ /** 52周最高价 */
72
+ high52w: number | null;
73
+ /** 52周最低价 */
74
+ low52w: number | null;
75
+ /** 流通股本(股) */
76
+ circulatingShares: number | null;
77
+ /** 总股本(股) */
78
+ totalShares: number | null;
61
79
  /** 原始字段数组(供扩展使用) */
62
80
  raw: string[];
63
81
  }
@@ -175,10 +193,25 @@ interface FundQuote {
175
193
  raw: string[];
176
194
  }
177
195
 
178
- declare class TencentStockSDK {
179
- private client;
180
- constructor();
181
- private fetch;
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;
182
215
  /**
183
216
  * 获取 A 股 / 指数 全量行情
184
217
  * @param codes 如 ['sz000858', 'sh600000']
@@ -187,7 +220,7 @@ declare class TencentStockSDK {
187
220
  private parseFullQuote;
188
221
  /**
189
222
  * 获取简要行情
190
- * @param codes 如 ['s_sz000858', 's_sh000001']
223
+ * @param codes 如 ['sz000858', 'sh000001'](自动添加 s_ 前缀)
191
224
  */
192
225
  getSimpleQuotes(codes: string[]): Promise<SimpleQuote[]>;
193
226
  private parseSimpleQuote;
@@ -229,6 +262,23 @@ declare class TencentStockSDK {
229
262
  key: string;
230
263
  fields: string[];
231
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[]>;
232
280
  }
233
281
 
234
- export { type FullQuote, type FundFlow, type FundQuote, type HKQuote, type PanelLargeOrder, type SimpleQuote, TencentStockSDK, type USQuote, TencentStockSDK as default };
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
@@ -46,8 +46,10 @@ interface FullQuote {
46
46
  amount: number;
47
47
  /** 换手率% */
48
48
  turnoverRate: number | null;
49
- /** 市盈率 */
49
+ /** 市盈率(TTM) */
50
50
  pe: number | null;
51
+ /** 振幅% */
52
+ amplitude: number | null;
51
53
  /** 流通市值(亿) */
52
54
  circulatingMarketCap: number | null;
53
55
  /** 总市值(亿) */
@@ -58,6 +60,22 @@ interface FullQuote {
58
60
  limitUp: number | null;
59
61
  /** 跌停价 */
60
62
  limitDown: number | null;
63
+ /** 量比 */
64
+ volumeRatio: number | null;
65
+ /** 均价 */
66
+ avgPrice: number | null;
67
+ /** 市盈率(静) */
68
+ peStatic: number | null;
69
+ /** 市盈率(动) */
70
+ peDynamic: number | null;
71
+ /** 52周最高价 */
72
+ high52w: number | null;
73
+ /** 52周最低价 */
74
+ low52w: number | null;
75
+ /** 流通股本(股) */
76
+ circulatingShares: number | null;
77
+ /** 总股本(股) */
78
+ totalShares: number | null;
61
79
  /** 原始字段数组(供扩展使用) */
62
80
  raw: string[];
63
81
  }
@@ -175,10 +193,25 @@ interface FundQuote {
175
193
  raw: string[];
176
194
  }
177
195
 
178
- declare class TencentStockSDK {
179
- private client;
180
- constructor();
181
- private fetch;
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;
182
215
  /**
183
216
  * 获取 A 股 / 指数 全量行情
184
217
  * @param codes 如 ['sz000858', 'sh600000']
@@ -187,7 +220,7 @@ declare class TencentStockSDK {
187
220
  private parseFullQuote;
188
221
  /**
189
222
  * 获取简要行情
190
- * @param codes 如 ['s_sz000858', 's_sh000001']
223
+ * @param codes 如 ['sz000858', 'sh000001'](自动添加 s_ 前缀)
191
224
  */
192
225
  getSimpleQuotes(codes: string[]): Promise<SimpleQuote[]>;
193
226
  private parseSimpleQuote;
@@ -229,6 +262,23 @@ declare class TencentStockSDK {
229
262
  key: string;
230
263
  fields: string[];
231
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[]>;
232
280
  }
233
281
 
234
- export { type FullQuote, type FundFlow, type FundQuote, type HKQuote, type PanelLargeOrder, type SimpleQuote, TencentStockSDK, type USQuote, TencentStockSDK as default };
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 };