stock-sdk 1.2.1 → 1.3.0-beta.1
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 +394 -24
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +427 -72
- package/dist/index.d.ts +427 -72
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
interface RequestClientOptions {
|
|
2
|
+
baseUrl?: string;
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 响应解析器
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* 将 ArrayBuffer 解码为 GBK 字符串
|
|
11
|
+
* 使用原生 TextDecoder(浏览器和 Node.js 18+ 均支持 GBK)
|
|
12
|
+
*/
|
|
13
|
+
declare function decodeGBK(data: ArrayBuffer): string;
|
|
14
|
+
/**
|
|
15
|
+
* 解析腾讯财经响应文本
|
|
16
|
+
* 按 `;` 拆行,提取 `v_xxx="..."` 里的内容,返回 { key, fields }[]
|
|
17
|
+
*/
|
|
18
|
+
declare function parseResponse(text: string): {
|
|
19
|
+
key: string;
|
|
20
|
+
fields: string[];
|
|
21
|
+
}[];
|
|
22
|
+
/**
|
|
23
|
+
* 安全转换为数字,空值返回 0
|
|
24
|
+
*/
|
|
25
|
+
declare function safeNumber(val: string | undefined): number;
|
|
26
|
+
/**
|
|
27
|
+
* 安全转换为数字,空值返回 null
|
|
28
|
+
*/
|
|
29
|
+
declare function safeNumberOrNull(val: string | undefined): number | null;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 工具函数
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* 将数组分割成指定大小的块
|
|
36
|
+
*/
|
|
37
|
+
declare function chunkArray<T>(array: T[], chunkSize: number): T[][];
|
|
38
|
+
/**
|
|
39
|
+
* 并发控制执行异步任务
|
|
40
|
+
* @param tasks 任务函数数组
|
|
41
|
+
* @param concurrency 最大并发数
|
|
42
|
+
*/
|
|
43
|
+
declare function asyncPool<T>(tasks: (() => Promise<T>)[], concurrency: number): Promise<T[]>;
|
|
44
|
+
|
|
1
45
|
/**
|
|
2
46
|
* A 股 / 指数 全量行情
|
|
3
47
|
*/
|
|
@@ -295,6 +339,41 @@ interface TodayTimelineResponse {
|
|
|
295
339
|
/** 分时数据列表 */
|
|
296
340
|
data: TodayTimeline[];
|
|
297
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* 港股/美股历史 K 线
|
|
344
|
+
*/
|
|
345
|
+
interface HKUSHistoryKline {
|
|
346
|
+
/** 日期 YYYY-MM-DD */
|
|
347
|
+
date: string;
|
|
348
|
+
/** 股票代码 */
|
|
349
|
+
code: string;
|
|
350
|
+
/** 股票名称 */
|
|
351
|
+
name: string;
|
|
352
|
+
/** 开盘价 */
|
|
353
|
+
open: number | null;
|
|
354
|
+
/** 收盘价 */
|
|
355
|
+
close: number | null;
|
|
356
|
+
/** 最高价 */
|
|
357
|
+
high: number | null;
|
|
358
|
+
/** 最低价 */
|
|
359
|
+
low: number | null;
|
|
360
|
+
/** 成交量 */
|
|
361
|
+
volume: number | null;
|
|
362
|
+
/** 成交额 */
|
|
363
|
+
amount: number | null;
|
|
364
|
+
/** 振幅% */
|
|
365
|
+
amplitude: number | null;
|
|
366
|
+
/** 涨跌幅% */
|
|
367
|
+
changePercent: number | null;
|
|
368
|
+
/** 涨跌额 */
|
|
369
|
+
change: number | null;
|
|
370
|
+
/** 换手率% */
|
|
371
|
+
turnoverRate: number | null;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* 腾讯财经 - 批量操作
|
|
376
|
+
*/
|
|
298
377
|
|
|
299
378
|
/**
|
|
300
379
|
* 获取全部 A 股行情的配置选项
|
|
@@ -307,123 +386,399 @@ interface GetAllAShareQuotesOptions {
|
|
|
307
386
|
/** 进度回调函数 */
|
|
308
387
|
onProgress?: (completed: number, total: number) => void;
|
|
309
388
|
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* 东方财富 - A 股 K 线
|
|
392
|
+
*/
|
|
393
|
+
|
|
394
|
+
interface HistoryKlineOptions {
|
|
395
|
+
/** K 线周期 */
|
|
396
|
+
period?: 'daily' | 'weekly' | 'monthly';
|
|
397
|
+
/** 复权类型 */
|
|
398
|
+
adjust?: '' | 'qfq' | 'hfq';
|
|
399
|
+
/** 开始日期 YYYYMMDD */
|
|
400
|
+
startDate?: string;
|
|
401
|
+
/** 结束日期 YYYYMMDD */
|
|
402
|
+
endDate?: string;
|
|
403
|
+
}
|
|
404
|
+
interface MinuteKlineOptions {
|
|
405
|
+
/** K 线周期 */
|
|
406
|
+
period?: '1' | '5' | '15' | '30' | '60';
|
|
407
|
+
/** 复权类型(仅 5/15/30/60 分钟有效) */
|
|
408
|
+
adjust?: '' | 'qfq' | 'hfq';
|
|
409
|
+
/** 开始时间 */
|
|
410
|
+
startDate?: string;
|
|
411
|
+
/** 结束时间 */
|
|
412
|
+
endDate?: string;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* 东方财富 - 港股 K 线
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
interface HKKlineOptions {
|
|
420
|
+
/** K 线周期 */
|
|
421
|
+
period?: 'daily' | 'weekly' | 'monthly';
|
|
422
|
+
/** 复权类型 */
|
|
423
|
+
adjust?: '' | 'qfq' | 'hfq';
|
|
424
|
+
/** 开始日期 YYYYMMDD */
|
|
425
|
+
startDate?: string;
|
|
426
|
+
/** 结束日期 YYYYMMDD */
|
|
427
|
+
endDate?: string;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* 东方财富 - 美股 K 线
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
interface USKlineOptions {
|
|
435
|
+
/** K 线周期 */
|
|
436
|
+
period?: 'daily' | 'weekly' | 'monthly';
|
|
437
|
+
/** 复权类型 */
|
|
438
|
+
adjust?: '' | 'qfq' | 'hfq';
|
|
439
|
+
/** 开始日期 YYYYMMDD */
|
|
440
|
+
startDate?: string;
|
|
441
|
+
/** 结束日期 YYYYMMDD */
|
|
442
|
+
endDate?: string;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
interface OHLCV {
|
|
446
|
+
open: number | null;
|
|
447
|
+
high: number | null;
|
|
448
|
+
low: number | null;
|
|
449
|
+
close: number | null;
|
|
450
|
+
volume?: number | null;
|
|
451
|
+
}
|
|
452
|
+
interface MAOptions {
|
|
453
|
+
/** 均线周期数组,默认 [5, 10, 20, 30, 60, 120, 250] */
|
|
454
|
+
periods?: number[];
|
|
455
|
+
/** 均线类型:'sma'(简单) | 'ema'(指数) | 'wma'(加权),默认 'sma' */
|
|
456
|
+
type?: 'sma' | 'ema' | 'wma';
|
|
457
|
+
}
|
|
458
|
+
interface MACDOptions {
|
|
459
|
+
/** 短期 EMA 周期,默认 12 */
|
|
460
|
+
short?: number;
|
|
461
|
+
/** 长期 EMA 周期,默认 26 */
|
|
462
|
+
long?: number;
|
|
463
|
+
/** 信号线 EMA 周期,默认 9 */
|
|
464
|
+
signal?: number;
|
|
465
|
+
}
|
|
466
|
+
interface BOLLOptions {
|
|
467
|
+
/** 均线周期,默认 20 */
|
|
468
|
+
period?: number;
|
|
469
|
+
/** 标准差倍数,默认 2 */
|
|
470
|
+
stdDev?: number;
|
|
471
|
+
}
|
|
472
|
+
interface KDJOptions {
|
|
473
|
+
/** RSV 周期,默认 9 */
|
|
474
|
+
period?: number;
|
|
475
|
+
/** K 值平滑周期,默认 3 */
|
|
476
|
+
kPeriod?: number;
|
|
477
|
+
/** D 值平滑周期,默认 3 */
|
|
478
|
+
dPeriod?: number;
|
|
479
|
+
}
|
|
480
|
+
interface RSIOptions {
|
|
481
|
+
/** RSI 周期数组,默认 [6, 12, 24] */
|
|
482
|
+
periods?: number[];
|
|
483
|
+
}
|
|
484
|
+
interface WROptions {
|
|
485
|
+
/** WR 周期数组,默认 [6, 10] */
|
|
486
|
+
periods?: number[];
|
|
487
|
+
}
|
|
488
|
+
interface BIASOptions {
|
|
489
|
+
/** BIAS 周期数组,默认 [6, 12, 24] */
|
|
490
|
+
periods?: number[];
|
|
491
|
+
}
|
|
492
|
+
interface CCIOptions {
|
|
493
|
+
/** CCI 周期,默认 14 */
|
|
494
|
+
period?: number;
|
|
495
|
+
}
|
|
496
|
+
interface ATROptions {
|
|
497
|
+
/** ATR 周期,默认 14 */
|
|
498
|
+
period?: number;
|
|
499
|
+
}
|
|
500
|
+
interface IndicatorOptions {
|
|
501
|
+
ma?: MAOptions | boolean;
|
|
502
|
+
macd?: MACDOptions | boolean;
|
|
503
|
+
boll?: BOLLOptions | boolean;
|
|
504
|
+
kdj?: KDJOptions | boolean;
|
|
505
|
+
rsi?: RSIOptions | boolean;
|
|
506
|
+
wr?: WROptions | boolean;
|
|
507
|
+
bias?: BIASOptions | boolean;
|
|
508
|
+
cci?: CCIOptions | boolean;
|
|
509
|
+
atr?: ATROptions | boolean;
|
|
510
|
+
}
|
|
511
|
+
interface MAResult {
|
|
512
|
+
[key: string]: number | null;
|
|
513
|
+
}
|
|
514
|
+
interface MACDResult {
|
|
515
|
+
dif: number | null;
|
|
516
|
+
dea: number | null;
|
|
517
|
+
macd: number | null;
|
|
518
|
+
}
|
|
519
|
+
interface BOLLResult {
|
|
520
|
+
mid: number | null;
|
|
521
|
+
upper: number | null;
|
|
522
|
+
lower: number | null;
|
|
523
|
+
bandwidth: number | null;
|
|
524
|
+
}
|
|
525
|
+
interface KDJResult {
|
|
526
|
+
k: number | null;
|
|
527
|
+
d: number | null;
|
|
528
|
+
j: number | null;
|
|
529
|
+
}
|
|
530
|
+
interface RSIResult {
|
|
531
|
+
[key: string]: number | null;
|
|
532
|
+
}
|
|
533
|
+
interface WRResult {
|
|
534
|
+
[key: string]: number | null;
|
|
535
|
+
}
|
|
536
|
+
interface BIASResult {
|
|
537
|
+
[key: string]: number | null;
|
|
538
|
+
}
|
|
539
|
+
interface CCIResult {
|
|
540
|
+
cci: number | null;
|
|
541
|
+
}
|
|
542
|
+
interface ATRResult {
|
|
543
|
+
/** 真实波幅 */
|
|
544
|
+
tr: number | null;
|
|
545
|
+
/** 平均真实波幅 */
|
|
546
|
+
atr: number | null;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* 计算简单移动平均线 SMA
|
|
551
|
+
*/
|
|
552
|
+
declare function calcSMA(data: (number | null)[], period: number): (number | null)[];
|
|
553
|
+
/**
|
|
554
|
+
* 计算指数移动平均线 EMA
|
|
555
|
+
* 使用前 N 天的 SMA 作为 EMA 初始值,避免首日偏差
|
|
556
|
+
*/
|
|
557
|
+
declare function calcEMA(data: (number | null)[], period: number): (number | null)[];
|
|
558
|
+
/**
|
|
559
|
+
* 计算加权移动平均线 WMA
|
|
560
|
+
*/
|
|
561
|
+
declare function calcWMA(data: (number | null)[], period: number): (number | null)[];
|
|
562
|
+
/**
|
|
563
|
+
* 批量计算均线
|
|
564
|
+
*/
|
|
565
|
+
declare function calcMA(closes: (number | null)[], options?: MAOptions): MAResult[];
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* 计算 MACD 指标
|
|
569
|
+
*/
|
|
570
|
+
declare function calcMACD(closes: (number | null)[], options?: MACDOptions): MACDResult[];
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* 计算布林带
|
|
574
|
+
*/
|
|
575
|
+
declare function calcBOLL(closes: (number | null)[], options?: BOLLOptions): BOLLResult[];
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* 计算 KDJ 指标
|
|
579
|
+
*/
|
|
580
|
+
declare function calcKDJ(data: OHLCV[], options?: KDJOptions): KDJResult[];
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* 计算 RSI 指标
|
|
584
|
+
*/
|
|
585
|
+
declare function calcRSI(closes: (number | null)[], options?: RSIOptions): RSIResult[];
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* 计算威廉指标 WR
|
|
589
|
+
*/
|
|
590
|
+
declare function calcWR(data: OHLCV[], options?: WROptions): WRResult[];
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* 计算乖离率 BIAS
|
|
594
|
+
*
|
|
595
|
+
* 公式:BIAS = (收盘价 - MA) / MA × 100
|
|
596
|
+
*
|
|
597
|
+
* 乖离率表示股价与移动平均线之间的偏离程度
|
|
598
|
+
* - 正乖离:股价在均线上方,可能超买
|
|
599
|
+
* - 负乖离:股价在均线下方,可能超卖
|
|
600
|
+
*/
|
|
601
|
+
declare function calcBIAS(closes: (number | null)[], options?: BIASOptions): BIASResult[];
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* 计算商品通道指数 CCI
|
|
605
|
+
*
|
|
606
|
+
* 公式:
|
|
607
|
+
* TP(典型价格)= (最高价 + 最低价 + 收盘价) / 3
|
|
608
|
+
* MA = TP 的 N 日简单移动平均
|
|
609
|
+
* MD = TP 与 MA 的平均绝对偏差
|
|
610
|
+
* CCI = (TP - MA) / (0.015 × MD)
|
|
611
|
+
*
|
|
612
|
+
* CCI 用于判断超买超卖:
|
|
613
|
+
* - CCI > 100:超买区域
|
|
614
|
+
* - CCI < -100:超卖区域
|
|
615
|
+
* - CCI 在 -100 ~ 100 之间:正常区域
|
|
616
|
+
*/
|
|
617
|
+
declare function calcCCI(data: OHLCV[], options?: CCIOptions): CCIResult[];
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* 计算平均真实波幅 ATR (Average True Range)
|
|
621
|
+
*
|
|
622
|
+
* 公式:
|
|
623
|
+
* TR(真实波幅)= max(
|
|
624
|
+
* 最高价 - 最低价,
|
|
625
|
+
* |最高价 - 昨收|,
|
|
626
|
+
* |最低价 - 昨收|
|
|
627
|
+
* )
|
|
628
|
+
* ATR = TR 的 N 日移动平均
|
|
629
|
+
*
|
|
630
|
+
* ATR 用于衡量市场波动性:
|
|
631
|
+
* - ATR 越大,市场波动越大
|
|
632
|
+
* - ATR 越小,市场波动越小
|
|
633
|
+
* - 常用于止损位设置(如 2 倍 ATR)
|
|
634
|
+
*/
|
|
635
|
+
declare function calcATR(data: OHLCV[], options?: ATROptions): ATRResult[];
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* 带技术指标的 K 线数据
|
|
639
|
+
*/
|
|
640
|
+
type KlineWithIndicators<T extends HistoryKline | HKUSHistoryKline> = T & {
|
|
641
|
+
ma?: MAResult;
|
|
642
|
+
macd?: MACDResult;
|
|
643
|
+
boll?: BOLLResult;
|
|
644
|
+
kdj?: KDJResult;
|
|
645
|
+
rsi?: RSIResult;
|
|
646
|
+
wr?: WRResult;
|
|
647
|
+
bias?: BIASResult;
|
|
648
|
+
cci?: CCIResult;
|
|
649
|
+
atr?: ATRResult;
|
|
650
|
+
};
|
|
651
|
+
/**
|
|
652
|
+
* 为 K 线数据添加技术指标
|
|
653
|
+
*/
|
|
654
|
+
declare function addIndicators<T extends HistoryKline | HKUSHistoryKline>(klines: T[], options?: IndicatorOptions): KlineWithIndicators<T>[];
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Stock SDK - 门面类
|
|
658
|
+
* 统一对外接口,组合各模块
|
|
659
|
+
*/
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* 市场类型
|
|
663
|
+
*/
|
|
664
|
+
type MarketType = 'A' | 'HK' | 'US';
|
|
310
665
|
declare class StockSDK {
|
|
311
|
-
private
|
|
312
|
-
|
|
313
|
-
constructor(options?: {
|
|
314
|
-
baseUrl?: string;
|
|
315
|
-
timeout?: number;
|
|
316
|
-
});
|
|
317
|
-
private request;
|
|
666
|
+
private client;
|
|
667
|
+
constructor(options?: RequestClientOptions);
|
|
318
668
|
/**
|
|
319
669
|
* 获取 A 股 / 指数 全量行情
|
|
320
|
-
* @param codes
|
|
670
|
+
* @param codes 股票代码数组,如 ['sz000858', 'sh600000']
|
|
321
671
|
*/
|
|
322
672
|
getFullQuotes(codes: string[]): Promise<FullQuote[]>;
|
|
323
|
-
private parseFullQuote;
|
|
324
673
|
/**
|
|
325
674
|
* 获取简要行情
|
|
326
|
-
* @param codes
|
|
675
|
+
* @param codes 股票代码数组,如 ['sz000858', 'sh000001']
|
|
327
676
|
*/
|
|
328
677
|
getSimpleQuotes(codes: string[]): Promise<SimpleQuote[]>;
|
|
329
|
-
private parseSimpleQuote;
|
|
330
|
-
/**
|
|
331
|
-
* 获取资金流向
|
|
332
|
-
* @param codes 股票代码数组,如 ['sz000858', 'sh600000'](自动添加 ff_ 前缀)
|
|
333
|
-
*/
|
|
334
|
-
getFundFlow(codes: string[]): Promise<FundFlow[]>;
|
|
335
|
-
private parseFundFlow;
|
|
336
|
-
/**
|
|
337
|
-
* 获取盘口大单占比
|
|
338
|
-
* @param codes 股票代码数组,如 ['sz000858', 'sh600000'](自动添加 s_pk 前缀)
|
|
339
|
-
*/
|
|
340
|
-
getPanelLargeOrder(codes: string[]): Promise<PanelLargeOrder[]>;
|
|
341
|
-
private parsePanelLargeOrder;
|
|
342
678
|
/**
|
|
343
679
|
* 获取港股扩展行情
|
|
344
|
-
* @param codes 港股代码数组,如 ['09988', '00700']
|
|
680
|
+
* @param codes 港股代码数组,如 ['09988', '00700']
|
|
345
681
|
*/
|
|
346
682
|
getHKQuotes(codes: string[]): Promise<HKQuote[]>;
|
|
347
|
-
private parseHKQuote;
|
|
348
683
|
/**
|
|
349
684
|
* 获取美股简要行情
|
|
350
|
-
* @param codes 美股代码数组,如 ['BABA', 'AAPL']
|
|
685
|
+
* @param codes 美股代码数组,如 ['BABA', 'AAPL']
|
|
351
686
|
*/
|
|
352
687
|
getUSQuotes(codes: string[]): Promise<USQuote[]>;
|
|
353
|
-
private parseUSQuote;
|
|
354
688
|
/**
|
|
355
689
|
* 获取公募基金行情
|
|
356
|
-
* @param codes 基金代码数组,如 ['000001', '110011']
|
|
690
|
+
* @param codes 基金代码数组,如 ['000001', '110011']
|
|
357
691
|
*/
|
|
358
692
|
getFundQuotes(codes: string[]): Promise<FundQuote[]>;
|
|
359
|
-
private parseFundQuote;
|
|
360
693
|
/**
|
|
361
|
-
*
|
|
362
|
-
* @param
|
|
694
|
+
* 获取资金流向
|
|
695
|
+
* @param codes 股票代码数组,如 ['sz000858', 'sh600000']
|
|
363
696
|
*/
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
697
|
+
getFundFlow(codes: string[]): Promise<FundFlow[]>;
|
|
698
|
+
/**
|
|
699
|
+
* 获取盘口大单占比
|
|
700
|
+
* @param codes 股票代码数组,如 ['sz000858', 'sh600000']
|
|
701
|
+
*/
|
|
702
|
+
getPanelLargeOrder(codes: string[]): Promise<PanelLargeOrder[]>;
|
|
368
703
|
/**
|
|
369
704
|
* 获取当日分时走势数据
|
|
370
705
|
* @param code 股票代码,如 'sz000001' 或 'sh600000'
|
|
371
|
-
* @returns 当日分时数据
|
|
372
706
|
*/
|
|
373
707
|
getTodayTimeline(code: string): Promise<TodayTimelineResponse>;
|
|
708
|
+
/**
|
|
709
|
+
* 获取 A 股历史 K 线(日/周/月)
|
|
710
|
+
*/
|
|
711
|
+
getHistoryKline(symbol: string, options?: HistoryKlineOptions): Promise<HistoryKline[]>;
|
|
712
|
+
/**
|
|
713
|
+
* 获取 A 股分钟 K 线或分时数据
|
|
714
|
+
*/
|
|
715
|
+
getMinuteKline(symbol: string, options?: MinuteKlineOptions): Promise<MinuteTimeline[] | MinuteKline[]>;
|
|
716
|
+
/**
|
|
717
|
+
* 获取港股历史 K 线(日/周/月)
|
|
718
|
+
*/
|
|
719
|
+
getHKHistoryKline(symbol: string, options?: HKKlineOptions): Promise<HKUSHistoryKline[]>;
|
|
720
|
+
/**
|
|
721
|
+
* 获取美股历史 K 线(日/周/月)
|
|
722
|
+
*/
|
|
723
|
+
getUSHistoryKline(symbol: string, options?: USKlineOptions): Promise<HKUSHistoryKline[]>;
|
|
374
724
|
/**
|
|
375
725
|
* 从远程获取 A 股代码列表
|
|
376
726
|
* @param includeExchange 是否包含交易所前缀(如 sh、sz、bj),默认 true
|
|
377
|
-
* @returns A 股代码数组
|
|
378
727
|
*/
|
|
379
728
|
getAShareCodeList(includeExchange?: boolean): Promise<string[]>;
|
|
380
729
|
/**
|
|
381
|
-
* 获取全部 A
|
|
382
|
-
* @param options 配置选项
|
|
383
|
-
* @param options.batchSize 单次请求的股票数量,默认 500
|
|
384
|
-
* @param options.concurrency 最大并发请求数,默认 7
|
|
385
|
-
* @param options.onProgress 进度回调函数
|
|
386
|
-
* @returns 全部 A 股的实时行情数据
|
|
730
|
+
* 获取全部 A 股实时行情
|
|
387
731
|
*/
|
|
388
732
|
getAllAShareQuotes(options?: GetAllAShareQuotesOptions): Promise<FullQuote[]>;
|
|
389
733
|
/**
|
|
390
|
-
*
|
|
391
|
-
* @param codes 股票代码列表
|
|
392
|
-
* @param options 配置选项
|
|
734
|
+
* 获取全部股票实时行情(使用自定义股票代码列表)
|
|
393
735
|
*/
|
|
394
736
|
getAllQuotesByCodes(codes: string[], options?: GetAllAShareQuotesOptions): Promise<FullQuote[]>;
|
|
395
737
|
/**
|
|
396
|
-
*
|
|
397
|
-
* @param
|
|
398
|
-
* @param options 配置选项
|
|
399
|
-
* @param options.period K线周期:'daily' | 'weekly' | 'monthly',默认 'daily'
|
|
400
|
-
* @param options.adjust 复权类型:'' (不复权) | 'qfq' (前复权) | 'hfq' (后复权),默认 'hfq'
|
|
401
|
-
* @param options.startDate 开始日期 YYYYMMDD,默认 '19700101'
|
|
402
|
-
* @param options.endDate 结束日期 YYYYMMDD,默认 '20500101'
|
|
403
|
-
* @returns 历史 K 线数据
|
|
738
|
+
* 批量混合查询,返回原始解析结果(key + fields)
|
|
739
|
+
* @param params 如 'sz000858,s_sh000001,jj000001'
|
|
404
740
|
*/
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
endDate?: string;
|
|
410
|
-
}): Promise<HistoryKline[]>;
|
|
741
|
+
batchRaw(params: string): Promise<{
|
|
742
|
+
key: string;
|
|
743
|
+
fields: string[];
|
|
744
|
+
}[]>;
|
|
411
745
|
/**
|
|
412
|
-
*
|
|
413
|
-
* @param symbol 股票代码(6位纯数字,如 '000001',或带前缀如 'sz000001')
|
|
414
|
-
* @param options 配置选项
|
|
415
|
-
* @param options.period K线周期:'1' (分时) | '5' | '15' | '30' | '60',默认 '1'
|
|
416
|
-
* @param options.adjust 复权类型(仅 5/15/30/60 分钟有效):'' | 'qfq' | 'hfq',默认 'hfq'
|
|
417
|
-
* @param options.startDate 开始时间 'YYYY-MM-DD HH:mm:ss'
|
|
418
|
-
* @param options.endDate 结束时间 'YYYY-MM-DD HH:mm:ss'
|
|
419
|
-
* @returns 分钟 K 线或分时数据
|
|
746
|
+
* 市场类型识别
|
|
420
747
|
*/
|
|
421
|
-
|
|
422
|
-
|
|
748
|
+
private detectMarket;
|
|
749
|
+
/**
|
|
750
|
+
* 安全获取数组最大值
|
|
751
|
+
*/
|
|
752
|
+
private safeMax;
|
|
753
|
+
/**
|
|
754
|
+
* 计算各指标所需的最大前置天数
|
|
755
|
+
*/
|
|
756
|
+
private calcRequiredLookback;
|
|
757
|
+
/**
|
|
758
|
+
* 计算实际请求的开始日期
|
|
759
|
+
*/
|
|
760
|
+
private calcActualStartDate;
|
|
761
|
+
/**
|
|
762
|
+
* 日期字符串转时间戳
|
|
763
|
+
*/
|
|
764
|
+
private dateToTimestamp;
|
|
765
|
+
/**
|
|
766
|
+
* 获取带技术指标的历史 K 线
|
|
767
|
+
*/
|
|
768
|
+
getKlineWithIndicators(symbol: string, options?: {
|
|
769
|
+
/** 市场类型,不传则自动识别 */
|
|
770
|
+
market?: MarketType;
|
|
771
|
+
/** K 线周期 */
|
|
772
|
+
period?: 'daily' | 'weekly' | 'monthly';
|
|
773
|
+
/** 复权类型 */
|
|
423
774
|
adjust?: '' | 'qfq' | 'hfq';
|
|
775
|
+
/** 开始日期 YYYYMMDD */
|
|
424
776
|
startDate?: string;
|
|
777
|
+
/** 结束日期 YYYYMMDD */
|
|
425
778
|
endDate?: string;
|
|
426
|
-
|
|
779
|
+
/** 技术指标配置 */
|
|
780
|
+
indicators?: IndicatorOptions;
|
|
781
|
+
}): Promise<KlineWithIndicators<HistoryKline | HKUSHistoryKline>[]>;
|
|
427
782
|
}
|
|
428
783
|
|
|
429
|
-
export { type FullQuote, type FundFlow, type FundQuote, type GetAllAShareQuotesOptions, type HKQuote, type HistoryKline, type MinuteKline, type MinuteTimeline, type PanelLargeOrder, type SimpleQuote, StockSDK, type TodayTimeline, type TodayTimelineResponse, type USQuote, StockSDK as default };
|
|
784
|
+
export { type ATROptions, type BIASOptions, type BOLLOptions, type CCIOptions, type FullQuote, type FundFlow, type FundQuote, type GetAllAShareQuotesOptions, type HKQuote, type HKUSHistoryKline, type HistoryKline, type IndicatorOptions, type KDJOptions, type KlineWithIndicators, type MACDOptions, type MAOptions, type MarketType, type MinuteKline, type MinuteTimeline, type PanelLargeOrder, type RSIOptions, type SimpleQuote, StockSDK, type TodayTimeline, type TodayTimelineResponse, type USQuote, type WROptions, addIndicators, asyncPool, calcATR, calcBIAS, calcBOLL, calcCCI, calcEMA, calcKDJ, calcMA, calcMACD, calcRSI, calcSMA, calcWMA, calcWR, chunkArray, decodeGBK, StockSDK as default, parseResponse, safeNumber, safeNumberOrNull };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function L(i){return new TextDecoder("gbk").decode(i)}function r(i){if(!i||i==="")return 0;let e=parseFloat(i);return Number.isNaN(e)?0:e}function u(i){if(!i||i==="")return null;let e=parseFloat(i);return Number.isNaN(e)?null:e}function U(i){let e=i.split(";").map(s=>s.trim()).filter(Boolean),n=[];for(let s of e){let t=s.indexOf("=");if(t<0)continue;let o=s.slice(0,t).trim();o.startsWith("v_")&&(o=o.slice(2));let a=s.slice(t+1).trim();a.startsWith('"')&&a.endsWith('"')&&(a=a.slice(1,-1));let m=a.split("~");n.push({key:o,fields:m})}return n}function N(i,e){let n=[];for(let s=0;s<i.length;s+=e)n.push(i.slice(s,s+e));return n}async function x(i,e){let n=[],s=[];for(let t of i){let o=Promise.resolve().then(()=>t()).then(a=>{n.push(a)});if(s.push(o),s.length>=e){await Promise.race(s);for(let a=s.length-1;a>=0;a--)await Promise.race([s[a].then(()=>"fulfilled"),Promise.resolve("pending")])==="fulfilled"&&s.splice(a,1)}}return await Promise.all(s),n}var K="https://qt.gtimg.cn",O="https://web.ifzq.gtimg.cn/appstock/app/minute/query",H="https://assets.linkdiary.cn/shares/ashare-code.json",I="https://push2his.eastmoney.com/api/qt/stock/kline/get",E="https://push2his.eastmoney.com/api/qt/stock/trends2/get";function M(i){return i.startsWith("sh")?"1":i.startsWith("sz")||i.startsWith("bj")?"0":i.startsWith("6")?"1":"0"}function l(i){if(!i||i===""||i==="-")return null;let e=parseFloat(i);return Number.isNaN(e)?null:e}var A=class{constructor(e={}){this.baseUrl=e.baseUrl??K,this.timeout=e.timeout??1e4}async request(e){let n=`${this.baseUrl}/?q=${encodeURIComponent(e)}`,s=new AbortController,t=setTimeout(()=>s.abort(),this.timeout);try{let o=await fetch(n,{signal:s.signal});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);let a=await o.arrayBuffer(),m=L(a);return U(m)}finally{clearTimeout(t)}}async getFullQuotes(e){return!e||e.length===0?[]:(await this.request(e.join(","))).filter(s=>s.fields&&s.fields.length>0&&s.fields[0]!=="").map(s=>this.parseFullQuote(s.fields))}parseFullQuote(e){let n=[];for(let t=0;t<5;t++)n.push({price:r(e[9+t*2]),volume:r(e[10+t*2])});let s=[];for(let t=0;t<5;t++)s.push({price:r(e[19+t*2]),volume:r(e[20+t*2])});return{marketId:e[0]??"",name:e[1]??"",code:e[2]??"",price:r(e[3]),prevClose:r(e[4]),open:r(e[5]),volume:r(e[6]),outerVolume:r(e[7]),innerVolume:r(e[8]),bid:n,ask:s,time:e[30]??"",change:r(e[31]),changePercent:r(e[32]),high:r(e[33]),low:r(e[34]),volume2:r(e[36]),amount:r(e[37]),turnoverRate:u(e[38]),pe:u(e[39]),amplitude:u(e[43]),circulatingMarketCap:u(e[44]),totalMarketCap:u(e[45]),pb:u(e[46]),limitUp:u(e[47]),limitDown:u(e[48]),volumeRatio:u(e[49]),avgPrice:u(e[51]),peStatic:u(e[52]),peDynamic:u(e[53]),high52w:u(e[67]),low52w:u(e[68]),circulatingShares:u(e[72]),totalShares:u(e[73]),raw:e}}async getSimpleQuotes(e){if(!e||e.length===0)return[];let n=e.map(t=>`s_${t}`);return(await this.request(n.join(","))).filter(t=>t.fields&&t.fields.length>0&&t.fields[0]!=="").map(t=>this.parseSimpleQuote(t.fields))}parseSimpleQuote(e){return{marketId:e[0]??"",name:e[1]??"",code:e[2]??"",price:r(e[3]),change:r(e[4]),changePercent:r(e[5]),volume:r(e[6]),amount:r(e[7]),marketCap:u(e[9]),marketType:e[10]??"",raw:e}}async getFundFlow(e){if(!e||e.length===0)return[];let n=e.map(t=>`ff_${t}`);return(await this.request(n.join(","))).filter(t=>t.fields&&t.fields.length>0&&t.fields[0]!=="").map(t=>this.parseFundFlow(t.fields))}parseFundFlow(e){return{code:e[0]??"",mainInflow:r(e[1]),mainOutflow:r(e[2]),mainNet:r(e[3]),mainNetRatio:r(e[4]),retailInflow:r(e[5]),retailOutflow:r(e[6]),retailNet:r(e[7]),retailNetRatio:r(e[8]),totalFlow:r(e[9]),name:e[12]??"",date:e[13]??"",raw:e}}async getPanelLargeOrder(e){if(!e||e.length===0)return[];let n=e.map(t=>`s_pk${t}`);return(await this.request(n.join(","))).filter(t=>t.fields&&t.fields.length>0&&t.fields[0]!=="").map(t=>this.parsePanelLargeOrder(t.fields))}parsePanelLargeOrder(e){return{buyLargeRatio:r(e[0]),buySmallRatio:r(e[1]),sellLargeRatio:r(e[2]),sellSmallRatio:r(e[3]),raw:e}}async getHKQuotes(e){if(!e||e.length===0)return[];let n=e.map(t=>`r_hk${t}`);return(await this.request(n.join(","))).filter(t=>t.fields&&t.fields.length>0&&t.fields[0]!=="").map(t=>this.parseHKQuote(t.fields))}parseHKQuote(e){return{marketId:e[0]??"",name:e[1]??"",code:e[2]??"",price:r(e[3]),prevClose:r(e[4]),open:r(e[5]),volume:r(e[6]),time:e[30]??"",change:r(e[31]),changePercent:r(e[32]),high:r(e[33]),low:r(e[34]),amount:r(e[36]),lotSize:u(e[40]),circulatingMarketCap:u(e[46]),totalMarketCap:u(e[47]),currency:e[e.length-3]??"",raw:e}}async getUSQuotes(e){if(!e||e.length===0)return[];let n=e.map(t=>`s_us${t}`);return(await this.request(n.join(","))).filter(t=>t.fields&&t.fields.length>0&&t.fields[0]!=="").map(t=>this.parseUSQuote(t.fields))}parseUSQuote(e){return{marketId:e[0]??"",name:e[1]??"",code:e[2]??"",price:r(e[3]),change:r(e[4]),changePercent:r(e[5]),volume:r(e[6]),amount:r(e[7]),marketCap:u(e[8]),raw:e}}async getFundQuotes(e){if(!e||e.length===0)return[];let n=e.map(t=>`jj${t}`);return(await this.request(n.join(","))).filter(t=>t.fields&&t.fields.length>0&&t.fields[0]!=="").map(t=>this.parseFundQuote(t.fields))}parseFundQuote(e){return{code:e[0]??"",name:e[1]??"",nav:r(e[5]),accNav:r(e[6]),change:r(e[7]),navDate:e[8]??"",raw:e}}async batchRaw(e){return this.request(e)}async getTodayTimeline(e){let n=new AbortController,s=setTimeout(()=>n.abort(),this.timeout);try{let t=await fetch(`${O}?code=${e}`,{signal:n.signal});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);let o=await t.json();if(o.code!==0)throw new Error(o.msg||"API error");let a=o.data?.[e];if(!a)return{code:e,date:"",data:[]};let m=a.data?.data||[],d=a.data?.date||"",h=!1;if(m.length>0){let p=m[0].split(" "),c=parseFloat(p[1])||0,g=parseInt(p[2],10)||0,f=parseFloat(p[3])||0;g>0&&c>0&&f/g>c*50&&(h=!0)}let k=m.map(p=>{let c=p.split(" "),g=c[0],f=`${g.slice(0,2)}:${g.slice(2,4)}`,y=parseInt(c[2],10)||0,b=parseFloat(c[3])||0,w=h?y*100:y,P=w>0?b/w:0;return{time:f,price:parseFloat(c[1])||0,volume:w,amount:b,avgPrice:Math.round(P*100)/100}});return{code:e,date:d,data:k}}finally{clearTimeout(s)}}async getAShareCodeList(e=!0){let n=new AbortController,s=setTimeout(()=>n.abort(),this.timeout);try{let t=await fetch(H,{signal:n.signal});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);let o=await t.json();return e?o:o.map(a=>a.replace(/^(sh|sz|bj)/,""))}finally{clearTimeout(s)}}async getAllAShareQuotes(e={}){let{batchSize:n=500,concurrency:s=7,onProgress:t}=e,o=await this.getAShareCodeList(),a=N(o,n),m=a.length,d=0,h=a.map(p=>async()=>{let c=await this.getFullQuotes(p);return d++,t&&t(d,m),c});return(await x(h,s)).flat()}async getAllQuotesByCodes(e,n={}){let{batchSize:s=500,concurrency:t=7,onProgress:o}=n,a=N(e,s),m=a.length,d=0,h=a.map(p=>async()=>{let c=await this.getFullQuotes(p);return d++,o&&o(d,m),c});return(await x(h,t)).flat()}async getHistoryKline(e,n={}){let{period:s="daily",adjust:t="hfq",startDate:o="19700101",endDate:a="20500101"}=n,m=e.replace(/^(sh|sz|bj)/,""),d={daily:"101",weekly:"102",monthly:"103"},h={"":"0",qfq:"1",hfq:"2"},k=`${M(m)}.${m}`,p=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116",ut:"7eea3edcaed734bea9cbfc24409ed989",klt:d[s],fqt:h[t],secid:k,beg:o,end:a}),c=new AbortController,g=setTimeout(()=>c.abort(),this.timeout);try{let f=await fetch(`${I}?${p.toString()}`,{signal:c.signal});if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);let b=(await f.json())?.data?.klines;return!Array.isArray(b)||b.length===0?[]:b.map(w=>{let[P,T,v,Q,S,F,j,q,C,R,$]=w.split(",");return{date:P,code:m,open:l(T),close:l(v),high:l(Q),low:l(S),volume:l(F),amount:l(j),amplitude:l(q),changePercent:l(C),change:l(R),turnoverRate:l($)}})}finally{clearTimeout(g)}}async getMinuteKline(e,n={}){let{period:s="1",adjust:t="hfq",startDate:o="1979-09-01 09:32:00",endDate:a="2222-01-01 09:32:00"}=n,m=e.replace(/^(sh|sz|bj)/,""),d=`${M(m)}.${m}`,h=new AbortController,k=setTimeout(()=>h.abort(),this.timeout);try{if(s==="1"){let p=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",fields2:"f51,f52,f53,f54,f55,f56,f57,f58",ut:"7eea3edcaed734bea9cbfc24409ed989",ndays:"5",iscr:"0",secid:d}),c=await fetch(`${E}?${p.toString()}`,{signal:h.signal});if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);let f=(await c.json())?.data?.trends;if(!Array.isArray(f)||f.length===0)return[];let y=o.replace("T"," ").slice(0,16),b=a.replace("T"," ").slice(0,16);return f.map(w=>{let[P,T,v,Q,S,F,j,q]=w.split(",");return{time:P,open:l(T),close:l(v),high:l(Q),low:l(S),volume:l(F),amount:l(j),avgPrice:l(q)}}).filter(w=>w.time>=y&&w.time<=b)}else{let p={"":"0",qfq:"1",hfq:"2"},c=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",ut:"7eea3edcaed734bea9cbfc24409ed989",klt:s,fqt:p[t],secid:d,beg:"0",end:"20500000"}),g=await fetch(`${I}?${c.toString()}`,{signal:h.signal});if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);let y=(await g.json())?.data?.klines;if(!Array.isArray(y)||y.length===0)return[];let b=o.replace("T"," ").slice(0,16),w=a.replace("T"," ").slice(0,16);return y.map(P=>{let[T,v,Q,S,F,j,q,C,R,$,D]=P.split(",");return{time:T,open:l(v),close:l(Q),high:l(S),low:l(F),changePercent:l(R),change:l($),volume:l(j),amount:l(q),amplitude:l(C),turnoverRate:l(D)}}).filter(P=>P.time>=b&&P.time<=w)}}finally{clearTimeout(k)}}},_=A;export{A as StockSDK,_ as default};
|
|
1
|
+
var Pe=Object.defineProperty;var pe=(t,e)=>{for(var n in e)Pe(t,n,{get:e[n],enumerable:!0})};function q(t){return new TextDecoder("gbk").decode(t)}function U(t){let e=t.split(";").map(s=>s.trim()).filter(Boolean),n=[];for(let s of e){let o=s.indexOf("=");if(o<0)continue;let r=s.slice(0,o).trim();r.startsWith("v_")&&(r=r.slice(2));let i=s.slice(o+1).trim();i.startsWith('"')&&i.endsWith('"')&&(i=i.slice(1,-1));let l=i.split("~");n.push({key:r,fields:l})}return n}function m(t){if(!t||t==="")return 0;let e=parseFloat(t);return Number.isNaN(e)?0:e}function b(t){if(!t||t==="")return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function p(t){if(!t||t===""||t==="-")return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}var fe="https://qt.gtimg.cn",de="https://web.ifzq.gtimg.cn/appstock/app/minute/query",he="https://assets.linkdiary.cn/shares/ashare-code.json",ee="https://push2his.eastmoney.com/api/qt/stock/kline/get",ge="https://push2his.eastmoney.com/api/qt/stock/trends2/get",ye="https://33.push2his.eastmoney.com/api/qt/stock/kline/get",be="https://63.push2his.eastmoney.com/api/qt/stock/kline/get";var L=class{constructor(e={}){this.baseUrl=e.baseUrl??fe,this.timeout=e.timeout??3e4}getTimeout(){return this.timeout}async get(e,n={}){let s=new AbortController,o=setTimeout(()=>s.abort(),this.timeout);try{let r=await fetch(e,{signal:s.signal});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);switch(n.responseType){case"json":return await r.json();case"arraybuffer":return await r.arrayBuffer();default:return await r.text()}}finally{clearTimeout(o)}}async getTencentQuote(e){let n=`${this.baseUrl}/?q=${encodeURIComponent(e)}`,s=await this.get(n,{responseType:"arraybuffer"}),o=q(s);return U(o)}};function D(t,e){let n=[];for(let s=0;s<t.length;s+=e)n.push(t.slice(s,s+e));return n}async function F(t,e){let n=[],s=[];for(let o of t){let r=Promise.resolve().then(()=>o()).then(i=>{n.push(i)});if(s.push(r),s.length>=e){await Promise.race(s);for(let i=s.length-1;i>=0;i--)await Promise.race([s[i].then(()=>"fulfilled"),Promise.resolve("pending")])==="fulfilled"&&s.splice(i,1)}}return await Promise.all(s),n}function v(t){return t.startsWith("sh")?"1":t.startsWith("sz")||t.startsWith("bj")?"0":t.startsWith("6")?"1":"0"}var K={};pe(K,{getAShareCodeList:()=>Ae,getAllQuotesByCodes:()=>Ce,getFullQuotes:()=>N,getFundFlow:()=>we,getFundQuotes:()=>Te,getHKQuotes:()=>Ke,getPanelLargeOrder:()=>Me,getSimpleQuotes:()=>Re,getTodayTimeline:()=>Se,getUSQuotes:()=>xe,parseFullQuote:()=>te,parseFundFlow:()=>re,parseFundQuote:()=>le,parseHKQuote:()=>se,parsePanelLargeOrder:()=>oe,parseSimpleQuote:()=>ne,parseUSQuote:()=>ie});function te(t){let e=[];for(let s=0;s<5;s++)e.push({price:m(t[9+s*2]),volume:m(t[10+s*2])});let n=[];for(let s=0;s<5;s++)n.push({price:m(t[19+s*2]),volume:m(t[20+s*2])});return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:m(t[3]),prevClose:m(t[4]),open:m(t[5]),volume:m(t[6]),outerVolume:m(t[7]),innerVolume:m(t[8]),bid:e,ask:n,time:t[30]??"",change:m(t[31]),changePercent:m(t[32]),high:m(t[33]),low:m(t[34]),volume2:m(t[36]),amount:m(t[37]),turnoverRate:b(t[38]),pe:b(t[39]),amplitude:b(t[43]),circulatingMarketCap:b(t[44]),totalMarketCap:b(t[45]),pb:b(t[46]),limitUp:b(t[47]),limitDown:b(t[48]),volumeRatio:b(t[49]),avgPrice:b(t[51]),peStatic:b(t[52]),peDynamic:b(t[53]),high52w:b(t[67]),low52w:b(t[68]),circulatingShares:b(t[72]),totalShares:b(t[73]),raw:t}}function ne(t){return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:m(t[3]),change:m(t[4]),changePercent:m(t[5]),volume:m(t[6]),amount:m(t[7]),marketCap:b(t[9]),marketType:t[10]??"",raw:t}}function re(t){return{code:t[0]??"",mainInflow:m(t[1]),mainOutflow:m(t[2]),mainNet:m(t[3]),mainNetRatio:m(t[4]),retailInflow:m(t[5]),retailOutflow:m(t[6]),retailNet:m(t[7]),retailNetRatio:m(t[8]),totalFlow:m(t[9]),name:t[12]??"",date:t[13]??"",raw:t}}function oe(t){return{buyLargeRatio:m(t[0]),buySmallRatio:m(t[1]),sellLargeRatio:m(t[2]),sellSmallRatio:m(t[3]),raw:t}}function se(t){return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:m(t[3]),prevClose:m(t[4]),open:m(t[5]),volume:m(t[6]),time:t[30]??"",change:m(t[31]),changePercent:m(t[32]),high:m(t[33]),low:m(t[34]),amount:m(t[36]),lotSize:b(t[40]),circulatingMarketCap:b(t[46]),totalMarketCap:b(t[47]),currency:t[t.length-3]??"",raw:t}}function ie(t){return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:m(t[3]),change:m(t[4]),changePercent:m(t[5]),volume:m(t[6]),amount:m(t[7]),marketCap:b(t[8]),raw:t}}function le(t){return{code:t[0]??"",name:t[1]??"",nav:m(t[5]),accNav:m(t[6]),change:m(t[7]),navDate:t[8]??"",raw:t}}async function N(t,e){return!e||e.length===0?[]:(await t.getTencentQuote(e.join(","))).filter(s=>s.fields&&s.fields.length>0&&s.fields[0]!=="").map(s=>te(s.fields))}async function Re(t,e){if(!e||e.length===0)return[];let n=e.map(o=>`s_${o}`);return(await t.getTencentQuote(n.join(","))).filter(o=>o.fields&&o.fields.length>0&&o.fields[0]!=="").map(o=>ne(o.fields))}async function we(t,e){if(!e||e.length===0)return[];let n=e.map(o=>`ff_${o}`);return(await t.getTencentQuote(n.join(","))).filter(o=>o.fields&&o.fields.length>0&&o.fields[0]!=="").map(o=>re(o.fields))}async function Me(t,e){if(!e||e.length===0)return[];let n=e.map(o=>`s_pk${o}`);return(await t.getTencentQuote(n.join(","))).filter(o=>o.fields&&o.fields.length>0&&o.fields[0]!=="").map(o=>oe(o.fields))}async function Ke(t,e){if(!e||e.length===0)return[];let n=e.map(o=>`r_hk${o}`);return(await t.getTencentQuote(n.join(","))).filter(o=>o.fields&&o.fields.length>0&&o.fields[0]!=="").map(o=>se(o.fields))}async function xe(t,e){if(!e||e.length===0)return[];let n=e.map(o=>`s_us${o}`);return(await t.getTencentQuote(n.join(","))).filter(o=>o.fields&&o.fields.length>0&&o.fields[0]!=="").map(o=>ie(o.fields))}async function Te(t,e){if(!e||e.length===0)return[];let n=e.map(o=>`jj${o}`);return(await t.getTencentQuote(n.join(","))).filter(o=>o.fields&&o.fields.length>0&&o.fields[0]!=="").map(o=>le(o.fields))}async function Se(t,e){let n=t.getTimeout(),s=new AbortController,o=setTimeout(()=>s.abort(),n);try{let r=await fetch(`${de}?code=${e}`,{signal:s.signal});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);let i=await r.json();if(i.code!==0)throw new Error(i.msg||"API error");let l=i.data?.[e];if(!l)return{code:e,date:"",data:[]};let a=l.data?.data||[],c=l.data?.date||"",u=!1;if(a.length>0){let f=a[0].split(" "),h=parseFloat(f[1])||0,g=parseInt(f[2],10)||0,y=parseFloat(f[3])||0;g>0&&h>0&&y/g>h*50&&(u=!0)}let d=a.map(f=>{let h=f.split(" "),g=h[0],y=`${g.slice(0,2)}:${g.slice(2,4)}`,R=parseInt(h[2],10)||0,w=parseFloat(h[3])||0,M=u?R*100:R,x=M>0?w/M:0;return{time:y,price:parseFloat(h[1])||0,volume:M,amount:w,avgPrice:Math.round(x*100)/100}});return{code:e,date:c,data:d}}finally{clearTimeout(o)}}async function Ae(t,e=!0){let n=t.getTimeout(),s=new AbortController,o=setTimeout(()=>s.abort(),n);try{let r=await fetch(he,{signal:s.signal});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);let i=await r.json();return e?i:i.map(l=>l.replace(/^(sh|sz|bj)/,""))}finally{clearTimeout(o)}}async function Ce(t,e,n={}){let{batchSize:s=500,concurrency:o=7,onProgress:r}=n,i=D(e,s),l=i.length,a=0,c=i.map(d=>async()=>{let f=await N(t,d);return a++,r&&r(a,l),f});return(await F(c,o)).flat()}var j={};pe(j,{getHKHistoryKline:()=>He,getHistoryKline:()=>ke,getMinuteKline:()=>Oe,getUSHistoryKline:()=>je});async function ke(t,e,n={}){let{period:s="daily",adjust:o="hfq",startDate:r="19700101",endDate:i="20500101"}=n,l=e.replace(/^(sh|sz|bj)/,""),a={daily:"101",weekly:"102",monthly:"103"},c={"":"0",qfq:"1",hfq:"2"},u=`${v(e)}.${l}`,d=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116",ut:"7eea3edcaed734bea9cbfc24409ed989",klt:a[s],fqt:c[o],secid:u,beg:r,end:i}),f=`${ee}?${d.toString()}`,g=(await t.get(f,{responseType:"json"}))?.data?.klines;return!Array.isArray(g)||g.length===0?[]:g.map(y=>{let[R,w,M,x,T,S,A,C,k,O,H]=y.split(",");return{date:R,code:l,open:p(w),close:p(M),high:p(x),low:p(T),volume:p(S),amount:p(A),amplitude:p(C),changePercent:p(k),change:p(O),turnoverRate:p(H)}})}async function Oe(t,e,n={}){let{period:s="1",adjust:o="hfq",startDate:r="1979-09-01 09:32:00",endDate:i="2222-01-01 09:32:00"}=n,l=e.replace(/^(sh|sz|bj)/,""),a=`${v(e)}.${l}`;if(s==="1"){let c=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",fields2:"f51,f52,f53,f54,f55,f56,f57,f58",ut:"7eea3edcaed734bea9cbfc24409ed989",ndays:"5",iscr:"0",secid:a}),u=`${ge}?${c.toString()}`,f=(await t.get(u,{responseType:"json"}))?.data?.trends;if(!Array.isArray(f)||f.length===0)return[];let h=r.replace("T"," ").slice(0,16),g=i.replace("T"," ").slice(0,16);return f.map(y=>{let[R,w,M,x,T,S,A,C]=y.split(",");return{time:R,open:p(w),close:p(M),high:p(x),low:p(T),volume:p(S),amount:p(A),avgPrice:p(C)}}).filter(y=>y.time>=h&&y.time<=g)}else{let c={"":"0",qfq:"1",hfq:"2"},u=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",ut:"7eea3edcaed734bea9cbfc24409ed989",klt:s,fqt:c[o],secid:a,beg:"0",end:"20500000"}),d=`${ee}?${u.toString()}`,h=(await t.get(d,{responseType:"json"}))?.data?.klines;if(!Array.isArray(h)||h.length===0)return[];let g=r.replace("T"," ").slice(0,16),y=i.replace("T"," ").slice(0,16);return h.map(R=>{let[w,M,x,T,S,A,C,k,O,H,X]=R.split(",");return{time:w,open:p(M),close:p(x),high:p(T),low:p(S),changePercent:p(O),change:p(H),volume:p(A),amount:p(C),amplitude:p(k),turnoverRate:p(X)}}).filter(R=>R.time>=g&&R.time<=y)}}async function He(t,e,n={}){let{period:s="daily",adjust:o="hfq",startDate:r="19700101",endDate:i="20500101"}=n,l=e.replace(/^hk/i,"").padStart(5,"0"),a={daily:"101",weekly:"102",monthly:"103"},c={"":"0",qfq:"1",hfq:"2"},u=`116.${l}`,d=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",ut:"7eea3edcaed734bea9cbfc24409ed989",klt:a[s],fqt:c[o],secid:u,beg:r,end:i,lmt:"1000000"}),f=`${ye}?${d.toString()}`,h=await t.get(f,{responseType:"json"}),g=h?.data?.klines,y=h?.data?.name||"";return!Array.isArray(g)||g.length===0?[]:g.map(R=>{let[w,M,x,T,S,A,C,k,O,H,X]=R.split(",");return{date:w,code:l,name:y,open:p(M),close:p(x),high:p(T),low:p(S),volume:p(A),amount:p(C),amplitude:p(k),changePercent:p(O),change:p(H),turnoverRate:p(X)}})}async function je(t,e,n={}){let{period:s="daily",adjust:o="hfq",startDate:r="19700101",endDate:i="20500101"}=n,l={daily:"101",weekly:"102",monthly:"103"},a={"":"0",qfq:"1",hfq:"2"},c=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",ut:"7eea3edcaed734bea9cbfc24409ed989",klt:l[s],fqt:a[o],secid:e,beg:r,end:i,lmt:"1000000"}),u=`${be}?${c.toString()}`,d=await t.get(u,{responseType:"json"}),f=d?.data?.klines,h=d?.data?.code||e.split(".")[1]||e,g=d?.data?.name||"";return!Array.isArray(f)||f.length===0?[]:f.map(y=>{let[R,w,M,x,T,S,A,C,k,O,H]=y.split(",");return{date:R,code:h,name:g,open:p(w),close:p(M),high:p(x),low:p(T),volume:p(S),amount:p(A),amplitude:p(C),changePercent:p(k),change:p(O),turnoverRate:p(H)}})}function Q(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function I(t,e){let n=[];for(let s=0;s<t.length;s++){if(s<e-1){n.push(null);continue}let o=0,r=0;for(let i=s-e+1;i<=s;i++)t[i]!==null&&(o+=t[i],r++);n.push(r===e?Q(o/e):null)}return n}function P(t,e){let n=[],s=2/(e+1),o=null,r=!1;for(let i=0;i<t.length;i++){if(i<e-1){n.push(null);continue}if(!r){let a=0,c=0;for(let u=i-e+1;u<=i;u++)t[u]!==null&&(a+=t[u],c++);c===e&&(o=a/e,r=!0),n.push(o!==null?Q(o):null);continue}let l=t[i];l===null?n.push(o!==null?Q(o):null):(o=s*l+(1-s)*o,n.push(Q(o)))}return n}function ae(t,e){let n=[],s=Array.from({length:e},(r,i)=>i+1),o=s.reduce((r,i)=>r+i,0);for(let r=0;r<t.length;r++){if(r<e-1){n.push(null);continue}let i=0,l=!0;for(let a=0;a<e;a++){let c=t[r-e+1+a];if(c===null){l=!1;break}i+=c*s[a]}n.push(l?Q(i/o):null)}return n}function _(t,e={}){let{periods:n=[5,10,20,30,60,120,250],type:s="sma"}=e,o=s==="ema"?P:s==="wma"?ae:I,r={};for(let i of n)r[`ma${i}`]=o(t,i);return t.map((i,l)=>{let a={};for(let c of n)a[`ma${c}`]=r[`ma${c}`][l];return a})}function Ie(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function E(t,e={}){let{short:n=12,long:s=26,signal:o=9}=e,r=P(t,n),i=P(t,s),l=t.map((c,u)=>r[u]===null||i[u]===null?null:r[u]-i[u]),a=P(l,o);return t.map((c,u)=>({dif:l[u]!==null?Ie(l[u]):null,dea:a[u],macd:l[u]!==null&&a[u]!==null?Ie((l[u]-a[u])*2):null}))}function ue(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function Ue(t,e,n){let s=[];for(let o=0;o<t.length;o++){if(o<e-1||n[o]===null){s.push(null);continue}let r=0,i=0;for(let l=o-e+1;l<=o;l++)t[l]!==null&&n[o]!==null&&(r+=Math.pow(t[l]-n[o],2),i++);s.push(i===e?Math.sqrt(r/e):null)}return s}function $(t,e={}){let{period:n=20,stdDev:s=2}=e,o=I(t,n),r=Ue(t,n,o);return t.map((i,l)=>{if(o[l]===null||r[l]===null)return{mid:null,upper:null,lower:null,bandwidth:null};let a=o[l]+s*r[l],c=o[l]-s*r[l],u=o[l]!==0?ue((a-c)/o[l]*100):null;return{mid:o[l],upper:ue(a),lower:ue(c),bandwidth:u}})}function ce(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function B(t,e={}){let{period:n=9,kPeriod:s=3,dPeriod:o=3}=e,r=[],i=50,l=50;for(let a=0;a<t.length;a++){if(a<n-1){r.push({k:null,d:null,j:null});continue}let c=-1/0,u=1/0,d=!0;for(let y=a-n+1;y<=a;y++){if(t[y].high===null||t[y].low===null){d=!1;break}c=Math.max(c,t[y].high),u=Math.min(u,t[y].low)}let f=t[a].close;if(!d||f===null||c===u){r.push({k:null,d:null,j:null});continue}let h=(f-u)/(c-u)*100;i=(s-1)/s*i+1/s*h,l=(o-1)/o*l+1/o*i;let g=3*i-2*l;r.push({k:ce(i),d:ce(l),j:ce(g)})}return r}function De(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function W(t,e={}){let{periods:n=[6,12,24]}=e,s=[null];for(let r=1;r<t.length;r++)t[r]===null||t[r-1]===null?s.push(null):s.push(t[r]-t[r-1]);let o={};for(let r of n){let i=[],l=0,a=0;for(let c=0;c<t.length;c++){if(c<r){i.push(null),s[c]!==null&&(s[c]>0?l+=s[c]:a+=Math.abs(s[c]));continue}if(c===r)l=l/r,a=a/r;else{let u=s[c]??0,d=u>0?u:0,f=u<0?Math.abs(u):0;l=(l*(r-1)+d)/r,a=(a*(r-1)+f)/r}if(a===0)i.push(100);else if(l===0)i.push(0);else{let u=l/a;i.push(De(100-100/(1+u)))}}o[`rsi${r}`]=i}return t.map((r,i)=>{let l={};for(let a of n)l[`rsi${a}`]=o[`rsi${a}`][i];return l})}function Fe(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function V(t,e={}){let{periods:n=[6,10]}=e,s={};for(let o of n){let r=[];for(let i=0;i<t.length;i++){if(i<o-1){r.push(null);continue}let l=-1/0,a=1/0,c=!0;for(let f=i-o+1;f<=i;f++){if(t[f].high===null||t[f].low===null){c=!1;break}l=Math.max(l,t[f].high),a=Math.min(a,t[f].low)}let u=t[i].close;if(!c||u===null||l===a){r.push(null);continue}let d=(l-u)/(l-a)*100;r.push(Fe(d))}s[`wr${o}`]=r}return t.map((o,r)=>{let i={};for(let l of n)i[`wr${l}`]=s[`wr${l}`][r];return i})}function ve(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function G(t,e={}){let{periods:n=[6,12,24]}=e,s={};for(let o of n){let r=I(t,o),i=[];for(let l=0;l<t.length;l++)if(t[l]===null||r[l]===null||r[l]===0)i.push(null);else{let a=(t[l]-r[l])/r[l]*100;i.push(ve(a))}s[`bias${o}`]=i}return t.map((o,r)=>{let i={};for(let l of n)i[`bias${l}`]=s[`bias${l}`][r];return i})}function Ne(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function J(t,e={}){let{period:n=14}=e,s=[],o=t.map(r=>r.high===null||r.low===null||r.close===null?null:(r.high+r.low+r.close)/3);for(let r=0;r<t.length;r++){if(r<n-1){s.push({cci:null});continue}let i=0,l=0;for(let d=r-n+1;d<=r;d++)o[d]!==null&&(i+=o[d],l++);if(l!==n||o[r]===null){s.push({cci:null});continue}let a=i/n,c=0;for(let d=r-n+1;d<=r;d++)c+=Math.abs(o[d]-a);let u=c/n;if(u===0)s.push({cci:0});else{let d=(o[r]-a)/(.015*u);s.push({cci:Ne(d)})}}return s}function me(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function z(t,e={}){let{period:n=14}=e,s=[],o=[];for(let i=0;i<t.length;i++){let{high:l,low:a,close:c}=t[i];if(l===null||a===null||c===null){o.push(null);continue}if(i===0)o.push(l-a);else{let u=t[i-1].close;if(u===null)o.push(l-a);else{let d=l-a,f=Math.abs(l-u),h=Math.abs(a-u);o.push(Math.max(d,f,h))}}}let r=null;for(let i=0;i<t.length;i++){if(i<n-1){s.push({tr:o[i]!==null?me(o[i]):null,atr:null});continue}if(i===n-1){let l=0,a=0;for(let c=0;c<n;c++)o[c]!==null&&(l+=o[c],a++);a===n&&(r=l/n)}else r!==null&&o[i]!==null&&(r=(r*(n-1)+o[i])/n);s.push({tr:o[i]!==null?me(o[i]):null,atr:r!==null?me(r):null})}return s}function Y(t,e={}){if(t.length===0)return[];let n=t.map(h=>h.close),s=t.map(h=>({open:h.open,high:h.high,low:h.low,close:h.close,volume:h.volume})),o=e.ma?_(n,typeof e.ma=="object"?e.ma:{}):null,r=e.macd?E(n,typeof e.macd=="object"?e.macd:{}):null,i=e.boll?$(n,typeof e.boll=="object"?e.boll:{}):null,l=e.kdj?B(s,typeof e.kdj=="object"?e.kdj:{}):null,a=e.rsi?W(n,typeof e.rsi=="object"?e.rsi:{}):null,c=e.wr?V(s,typeof e.wr=="object"?e.wr:{}):null,u=e.bias?G(n,typeof e.bias=="object"?e.bias:{}):null,d=e.cci?J(s,typeof e.cci=="object"?e.cci:{}):null,f=e.atr?z(s,typeof e.atr=="object"?e.atr:{}):null;return t.map((h,g)=>({...h,...o&&{ma:o[g]},...r&&{macd:r[g]},...i&&{boll:i[g]},...l&&{kdj:l[g]},...a&&{rsi:a[g]},...c&&{wr:c[g]},...u&&{bias:u[g]},...d&&{cci:d[g]},...f&&{atr:f[g]}}))}var Z=class{constructor(e={}){this.client=new L(e)}getFullQuotes(e){return K.getFullQuotes(this.client,e)}getSimpleQuotes(e){return K.getSimpleQuotes(this.client,e)}getHKQuotes(e){return K.getHKQuotes(this.client,e)}getUSQuotes(e){return K.getUSQuotes(this.client,e)}getFundQuotes(e){return K.getFundQuotes(this.client,e)}getFundFlow(e){return K.getFundFlow(this.client,e)}getPanelLargeOrder(e){return K.getPanelLargeOrder(this.client,e)}getTodayTimeline(e){return K.getTodayTimeline(this.client,e)}getHistoryKline(e,n){return j.getHistoryKline(this.client,e,n)}getMinuteKline(e,n){return j.getMinuteKline(this.client,e,n)}getHKHistoryKline(e,n){return j.getHKHistoryKline(this.client,e,n)}getUSHistoryKline(e,n){return j.getUSHistoryKline(this.client,e,n)}getAShareCodeList(e=!0){return K.getAShareCodeList(this.client,e)}async getAllAShareQuotes(e={}){let n=await this.getAShareCodeList();return this.getAllQuotesByCodes(n,e)}getAllQuotesByCodes(e,n={}){return K.getAllQuotesByCodes(this.client,e,n)}async batchRaw(e){return this.client.getTencentQuote(e)}detectMarket(e){return/^\d{3}\.[A-Z]+$/i.test(e)?"US":/^\d{5}$/.test(e)?"HK":"A"}safeMax(e,n=0){return!e||e.length===0?n:Math.max(...e)}calcRequiredLookback(e){let n=0,s=!1;if(e.ma){let r=typeof e.ma=="object"?e.ma:{},i=r.periods??[5,10,20,30,60,120,250],l=r.type??"sma";n=Math.max(n,this.safeMax(i,20)),l==="ema"&&(s=!0)}if(e.macd){let r=typeof e.macd=="object"?e.macd:{},i=r.long??26,l=r.signal??9;n=Math.max(n,i*3+l),s=!0}if(e.boll){let r=typeof e.boll=="object"&&e.boll.period?e.boll.period:20;n=Math.max(n,r)}if(e.kdj){let r=typeof e.kdj=="object"&&e.kdj.period?e.kdj.period:9;n=Math.max(n,r)}if(e.rsi){let r=typeof e.rsi=="object"&&e.rsi.periods?e.rsi.periods:[6,12,24];n=Math.max(n,this.safeMax(r,14)+1)}if(e.wr){let r=typeof e.wr=="object"&&e.wr.periods?e.wr.periods:[6,10];n=Math.max(n,this.safeMax(r,10))}if(e.bias){let r=typeof e.bias=="object"&&e.bias.periods?e.bias.periods:[6,12,24];n=Math.max(n,this.safeMax(r,12))}if(e.cci){let r=typeof e.cci=="object"&&e.cci.period?e.cci.period:14;n=Math.max(n,r)}if(e.atr){let r=typeof e.atr=="object"&&e.atr.period?e.atr.period:14;n=Math.max(n,r)}return Math.ceil(n*(s?1.5:1.2))}calcActualStartDate(e,n,s=1.5){let o=Math.ceil(n*s),r=new Date(parseInt(e.slice(0,4)),parseInt(e.slice(4,6))-1,parseInt(e.slice(6,8)));r.setDate(r.getDate()-o);let i=r.getFullYear(),l=String(r.getMonth()+1).padStart(2,"0"),a=String(r.getDate()).padStart(2,"0");return`${i}${l}${a}`}dateToTimestamp(e){let n=e.includes("-")?e:`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`;return new Date(n).getTime()}async getKlineWithIndicators(e,n={}){let{startDate:s,endDate:o,indicators:r={}}=n,i=n.market??this.detectMarket(e),l=this.calcRequiredLookback(r),c={A:1.5,HK:1.46,US:1.45}[i],u=s?this.calcActualStartDate(s,l,c):void 0,d={period:n.period,adjust:n.adjust,startDate:u,endDate:n.endDate},f;switch(i){case"HK":f=await this.getHKHistoryKline(e,d);break;case"US":f=await this.getUSHistoryKline(e,d);break;default:f=await this.getHistoryKline(e,d)}if(s&&f.length<l)switch(i){case"HK":f=await this.getHKHistoryKline(e,{...d,startDate:void 0});break;case"US":f=await this.getUSHistoryKline(e,{...d,startDate:void 0});break;default:f=await this.getHistoryKline(e,{...d,startDate:void 0})}let h=Y(f,r);if(s){let g=this.dateToTimestamp(s),y=o?this.dateToTimestamp(o):1/0;return h.filter(R=>{let w=this.dateToTimestamp(R.date);return w>=g&&w<=y})}return h}},_e=Z;export{Z as StockSDK,Y as addIndicators,F as asyncPool,z as calcATR,G as calcBIAS,$ as calcBOLL,J as calcCCI,P as calcEMA,B as calcKDJ,_ as calcMA,E as calcMACD,W as calcRSI,I as calcSMA,ae as calcWMA,V as calcWR,D as chunkArray,q as decodeGBK,_e as default,U as parseResponse,m as safeNumber,b as safeNumberOrNull};
|