stock-sdk 1.8.2 → 1.8.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
@@ -12,46 +12,10 @@ interface RateLimiterOptions {
12
12
  maxBurst?: number;
13
13
  }
14
14
 
15
- /**
16
- * 熔断器 - 防止雪崩效应
17
- *
18
- * 状态机:
19
- * - CLOSED: 正常状态,允许所有请求
20
- * - OPEN: 熔断状态,拒绝所有请求
21
- * - HALF_OPEN: 半开状态,允许少量请求探测
22
- */
23
- /**
24
- * 熔断器状态
25
- */
26
- type CircuitState = 'CLOSED' | 'OPEN' | 'HALF_OPEN';
27
- /**
28
- * 熔断器配置
29
- */
30
- interface CircuitBreakerOptions {
31
- /** 触发熔断的失败次数阈值,默认 5 */
32
- failureThreshold?: number;
33
- /** 熔断持续时间(毫秒),默认 30000 (30秒) */
34
- resetTimeout?: number;
35
- /** 半开状态允许的探测请求数,默认 1 */
36
- halfOpenRequests?: number;
37
- /** 状态变化回调 */
38
- onStateChange?: (from: CircuitState, to: CircuitState) => void;
39
- }
40
-
41
15
  /**
42
16
  * 已知的数据源名称
43
17
  */
44
18
  type ProviderName = 'tencent' | 'eastmoney' | 'sina' | 'linkdiary' | 'unknown';
45
- /**
46
- * HTTP 错误类
47
- */
48
- declare class HttpError extends Error {
49
- readonly status: number;
50
- readonly statusText: string;
51
- readonly url?: string | undefined;
52
- readonly provider?: string | undefined;
53
- constructor(status: number, statusText: string, url?: string | undefined, provider?: string | undefined);
54
- }
55
19
  /**
56
20
  * 重试配置选项
57
21
  */
@@ -92,6 +56,89 @@ interface ProviderRequestPolicy {
92
56
  /** 熔断器配置(连续失败时暂停请求) */
93
57
  circuitBreaker?: CircuitBreakerOptions;
94
58
  }
59
+
60
+ /**
61
+ * SDK 统一错误码
62
+ */
63
+ type SdkErrorCode = 'NETWORK_ERROR' | 'TIMEOUT' | 'HTTP_ERROR' | 'RATE_LIMITED' | 'CIRCUIT_OPEN' | 'UPSTREAM_EMPTY' | 'INVALID_SYMBOL' | 'INVALID_ARGUMENT' | 'NOT_FOUND';
64
+ /**
65
+ * SDK 错误构造参数
66
+ */
67
+ interface SdkErrorOptions {
68
+ code: SdkErrorCode;
69
+ message: string;
70
+ provider?: ProviderName;
71
+ url?: string;
72
+ status?: number;
73
+ details?: Record<string, unknown>;
74
+ cause?: unknown;
75
+ }
76
+ /**
77
+ * SDK 标准错误
78
+ */
79
+ declare class SdkError extends Error {
80
+ readonly code: SdkErrorCode;
81
+ readonly provider?: ProviderName;
82
+ readonly url?: string;
83
+ readonly status?: number;
84
+ readonly details?: Record<string, unknown>;
85
+ constructor(options: SdkErrorOptions);
86
+ }
87
+ /**
88
+ * HTTP 错误类
89
+ */
90
+ declare class HttpError extends SdkError {
91
+ readonly status: number;
92
+ readonly statusText: string;
93
+ constructor(status: number, statusText: string, url?: string, provider?: ProviderName);
94
+ }
95
+ /**
96
+ * 标准化后的请求错误元数据。
97
+ * 为保持兼容,网络类错误会尽量复用原始 Error 实例,并附加这些字段。
98
+ */
99
+ interface RequestErrorMetadata {
100
+ sdkCode?: SdkErrorCode;
101
+ provider?: ProviderName;
102
+ url?: string;
103
+ status?: number;
104
+ details?: Record<string, unknown>;
105
+ }
106
+ /**
107
+ * 带标准化元数据的请求错误。
108
+ */
109
+ type RequestError = Error & RequestErrorMetadata;
110
+ /**
111
+ * 读取错误上的 SDK 标准错误码。
112
+ */
113
+ declare function getSdkErrorCode(error: unknown): SdkErrorCode | undefined;
114
+
115
+ /**
116
+ * 熔断器 - 防止雪崩效应
117
+ *
118
+ * 状态机:
119
+ * - CLOSED: 正常状态,允许所有请求
120
+ * - OPEN: 熔断状态,拒绝所有请求
121
+ * - HALF_OPEN: 半开状态,允许少量请求探测
122
+ */
123
+
124
+ /**
125
+ * 熔断器状态
126
+ */
127
+ type CircuitState = 'CLOSED' | 'OPEN' | 'HALF_OPEN';
128
+ /**
129
+ * 熔断器配置
130
+ */
131
+ interface CircuitBreakerOptions {
132
+ /** 触发熔断的失败次数阈值,默认 5 */
133
+ failureThreshold?: number;
134
+ /** 熔断持续时间(毫秒),默认 30000 (30秒) */
135
+ resetTimeout?: number;
136
+ /** 半开状态允许的探测请求数,默认 1 */
137
+ halfOpenRequests?: number;
138
+ /** 状态变化回调 */
139
+ onStateChange?: (from: CircuitState, to: CircuitState) => void;
140
+ }
141
+
95
142
  /**
96
143
  * 请求客户端配置选项
97
144
  */
@@ -412,6 +459,7 @@ interface FundQuote {
412
459
  navDate: string;
413
460
  raw: string[];
414
461
  }
462
+
415
463
  /**
416
464
  * A 股历史 K 线(日/周/月)
417
465
  */
@@ -463,7 +511,7 @@ interface MinuteTimeline {
463
511
  avgPrice: number | null;
464
512
  }
465
513
  /**
466
- * A 股分钟 K 线(5/15/30/60 分钟)
514
+ * A 股分钟 K 线(5/15/30/60
467
515
  */
468
516
  interface MinuteKline {
469
517
  /** 时间 YYYY-MM-DD HH:mm */
@@ -476,47 +524,53 @@ interface MinuteKline {
476
524
  high: number | null;
477
525
  /** 最低价 */
478
526
  low: number | null;
479
- /** 涨跌幅% */
480
- changePercent: number | null;
481
- /** 涨跌额 */
482
- change: number | null;
483
527
  /** 成交量 */
484
528
  volume: number | null;
485
529
  /** 成交额 */
486
530
  amount: number | null;
487
531
  /** 振幅% */
488
532
  amplitude: number | null;
533
+ /** 涨跌幅% */
534
+ changePercent: number | null;
535
+ /** 涨跌额 */
536
+ change: number | null;
489
537
  /** 换手率% */
490
538
  turnoverRate: number | null;
491
539
  }
492
540
  /**
493
- * 当日分时走势数据(腾讯数据源)
541
+ * 当日分时项
494
542
  */
495
543
  interface TodayTimeline {
496
544
  /** 时间 HH:mm */
497
545
  time: string;
498
- /** 成交价 */
546
+ /** 当前价 */
499
547
  price: number;
500
- /** 累计成交量(股) */
548
+ /** 均价 */
549
+ avgPrice: number;
550
+ /** 累计成交量(股) */
501
551
  volume: number;
502
- /** 累计成交额(元) */
552
+ /** 累计成交额(元) */
503
553
  amount: number;
504
- /** 当日均价(累计成交额 / 累计成交量 × 100) */
505
- avgPrice: number;
506
554
  }
507
555
  /**
508
- * 当日分时走势响应
556
+ * 当日分时响应
509
557
  */
510
558
  interface TodayTimelineResponse {
511
559
  /** 股票代码 */
512
560
  code: string;
513
- /** 交易日期 YYYYMMDD */
561
+ /** 交易日期 YYYY-MM-DD */
514
562
  date: string;
515
- /** 分时数据列表 */
563
+ /**
564
+ * 昨收价
565
+ * - 由 SDK 解析腾讯接口的 `quoteFields[4]` 得到
566
+ * - 上游异常或接口未返回时可能为 `0` 或 `undefined`
567
+ */
568
+ preClose?: number;
569
+ /** 当日分时序列 */
516
570
  data: TodayTimeline[];
517
571
  }
518
572
  /**
519
- * 港股/美股历史 K 线
573
+ * 港股 / 美股历史 K 线
520
574
  */
521
575
  interface HKUSHistoryKline {
522
576
  /** 日期 YYYY-MM-DD */
@@ -546,15 +600,16 @@ interface HKUSHistoryKline {
546
600
  /** 换手率% */
547
601
  turnoverRate: number | null;
548
602
  }
603
+
549
604
  /**
550
- * 行业板块信息
605
+ * 行业板块列表项
551
606
  */
552
607
  interface IndustryBoard {
553
608
  /** 排名 */
554
609
  rank: number;
555
610
  /** 板块名称 */
556
611
  name: string;
557
- /** 板块代码 */
612
+ /** 板块代码,如 BK1027 */
558
613
  code: string;
559
614
  /** 最新价 */
560
615
  price: number | null;
@@ -570,25 +625,23 @@ interface IndustryBoard {
570
625
  riseCount: number | null;
571
626
  /** 下跌家数 */
572
627
  fallCount: number | null;
573
- /** 领涨股票名称 */
628
+ /** 领涨股名称 */
574
629
  leadingStock: string | null;
575
- /** 领涨股票涨跌幅% */
630
+ /** 领涨股涨跌幅% */
576
631
  leadingStockChangePercent: number | null;
577
632
  }
578
633
  /**
579
- * 行业板块实时行情
634
+ * 行业板块实时行情指标
580
635
  */
581
636
  interface IndustryBoardSpot {
582
- /** 指标名称 */
583
637
  item: string;
584
- /** 指标值 */
585
638
  value: number | null;
586
639
  }
587
640
  /**
588
641
  * 行业板块成分股
589
642
  */
590
643
  interface IndustryBoardConstituent {
591
- /** 序号 */
644
+ /** 排名 */
592
645
  rank: number;
593
646
  /** 股票代码 */
594
647
  code: string;
@@ -610,13 +663,13 @@ interface IndustryBoardConstituent {
610
663
  high: number | null;
611
664
  /** 最低价 */
612
665
  low: number | null;
613
- /** 今开 */
666
+ /** 开盘价 */
614
667
  open: number | null;
615
668
  /** 昨收 */
616
669
  prevClose: number | null;
617
670
  /** 换手率% */
618
671
  turnoverRate: number | null;
619
- /** 市盈率-动态 */
672
+ /** 市盈率 */
620
673
  pe: number | null;
621
674
  /** 市净率 */
622
675
  pb: number | null;
@@ -625,447 +678,343 @@ interface IndustryBoardConstituent {
625
678
  * 行业板块历史 K 线
626
679
  */
627
680
  interface IndustryBoardKline {
628
- /** 日期 */
629
681
  date: string;
630
- /** 开盘价 */
631
682
  open: number | null;
632
- /** 收盘价 */
633
683
  close: number | null;
634
- /** 最高价 */
635
684
  high: number | null;
636
- /** 最低价 */
637
685
  low: number | null;
638
- /** 涨跌幅% */
639
- changePercent: number | null;
640
- /** 涨跌额 */
641
- change: number | null;
642
- /** 成交量 */
643
686
  volume: number | null;
644
- /** 成交额 */
645
687
  amount: number | null;
646
- /** 振幅% */
647
688
  amplitude: number | null;
648
- /** 换手率% */
689
+ changePercent: number | null;
690
+ change: number | null;
649
691
  turnoverRate: number | null;
650
692
  }
651
693
  /**
652
- * 行业板块 1 分钟分时数据
694
+ * 行业板块 1 分钟分时
653
695
  */
654
696
  interface IndustryBoardMinuteTimeline {
655
- /** 日期时间 */
656
697
  time: string;
657
- /** 开盘价 */
658
698
  open: number | null;
659
- /** 收盘价 */
660
699
  close: number | null;
661
- /** 最高价 */
662
700
  high: number | null;
663
- /** 最低价 */
664
701
  low: number | null;
665
- /** 成交量 */
666
702
  volume: number | null;
667
- /** 成交额 */
668
703
  amount: number | null;
669
704
  /** 最新价 */
670
705
  price: number | null;
706
+ /**
707
+ * @deprecated 旧类型字段,请改用 `price`
708
+ */
709
+ avgPrice: number | null;
671
710
  }
672
711
  /**
673
- * 行业板块分钟 K 线
712
+ * 行业板块分钟 K 线(5/15/30/60)
674
713
  */
675
714
  interface IndustryBoardMinuteKline {
676
- /** 日期时间 */
677
715
  time: string;
678
- /** 开盘价 */
679
716
  open: number | null;
680
- /** 收盘价 */
681
717
  close: number | null;
682
- /** 最高价 */
683
718
  high: number | null;
684
- /** 最低价 */
685
719
  low: number | null;
686
- /** 涨跌幅% */
687
- changePercent: number | null;
688
- /** 涨跌额 */
689
- change: number | null;
690
- /** 成交量 */
691
720
  volume: number | null;
692
- /** 成交额 */
693
721
  amount: number | null;
694
- /** 振幅% */
695
722
  amplitude: number | null;
696
- /** 换手率% */
723
+ changePercent: number | null;
724
+ change: number | null;
697
725
  turnoverRate: number | null;
698
726
  }
699
727
  /**
700
- * 概念板块信息(结构同行业板块)
728
+ * 概念板块类型复用行业板块结构
701
729
  */
702
730
  type ConceptBoard = IndustryBoard;
703
- /**
704
- * 概念板块实时行情(结构同行业板块)
705
- */
706
731
  type ConceptBoardSpot = IndustryBoardSpot;
707
- /**
708
- * 概念板块成分股(结构同行业板块)
709
- */
710
732
  type ConceptBoardConstituent = IndustryBoardConstituent;
711
- /**
712
- * 概念板块历史 K 线(结构同行业板块)
713
- */
714
733
  type ConceptBoardKline = IndustryBoardKline;
715
- /**
716
- * 概念板块 1 分钟分时数据(结构同行业板块)
717
- */
718
734
  type ConceptBoardMinuteTimeline = IndustryBoardMinuteTimeline;
719
- /**
720
- * 概念板块分钟 K 线(结构同行业板块)
721
- */
722
735
  type ConceptBoardMinuteKline = IndustryBoardMinuteKline;
736
+
723
737
  /**
724
738
  * 国内期货交易所
725
739
  */
726
740
  type FuturesExchange = 'SHFE' | 'DCE' | 'CZCE' | 'INE' | 'CFFEX' | 'GFEX';
727
741
  /**
728
- * 国内/全球期货历史 K 线
742
+ * 期货 K 线
729
743
  */
730
744
  interface FuturesKline {
731
- /** 日期 YYYY-MM-DD */
732
745
  date: string;
733
- /** 合约代码 */
734
746
  code: string;
735
- /** 合约名称 */
736
747
  name: string;
737
- /** 开盘价 */
738
748
  open: number | null;
739
- /** 收盘价 */
740
749
  close: number | null;
741
- /** 最高价 */
742
750
  high: number | null;
743
- /** 最低价 */
744
751
  low: number | null;
745
- /** 成交量 */
746
752
  volume: number | null;
747
- /** 成交额 */
748
753
  amount: number | null;
749
- /** 振幅% */
750
754
  amplitude: number | null;
751
- /** 涨跌幅% */
752
755
  changePercent: number | null;
753
- /** 涨跌额 */
754
756
  change: number | null;
755
- /** 换手率% */
756
757
  turnoverRate: number | null;
757
- /** 持仓量(期货特有) */
758
758
  openInterest: number | null;
759
759
  }
760
760
  /**
761
- * 全球期货实时行情
761
+ * 全球期货实时报价
762
762
  */
763
763
  interface GlobalFuturesQuote {
764
- /** 合约代码,如 HG00Y */
765
764
  code: string;
766
- /** 名称,如 COMEX铜 */
767
765
  name: string;
768
- /** 最新价 */
769
766
  price: number | null;
770
- /** 涨跌额 */
771
767
  change: number | null;
772
- /** 涨跌幅% */
773
768
  changePercent: number | null;
774
- /** 今开 */
775
769
  open: number | null;
776
- /** 最高 */
777
770
  high: number | null;
778
- /** 最低 */
779
771
  low: number | null;
780
- /** 昨结算价 */
781
772
  prevSettle: number | null;
782
- /** 成交量 */
783
773
  volume: number | null;
784
- /** 买盘量 */
785
774
  buyVolume: number | null;
786
- /** 卖盘量 */
787
775
  sellVolume: number | null;
788
- /** 持仓量 */
789
776
  openInterest: number | null;
790
777
  }
791
778
  /**
792
- * 期货库存品种信息
779
+ * 期货库存品种
793
780
  */
794
781
  interface FuturesInventorySymbol {
795
- /** 品种代码 */
796
782
  code: string;
797
- /** 品种名称 */
798
783
  name: string;
799
- /** 市场代码 */
800
784
  marketCode: string;
801
785
  }
802
786
  /**
803
787
  * 期货库存数据
804
788
  */
805
789
  interface FuturesInventory {
806
- /** 品种代码,如 RB */
807
790
  code: string;
808
- /** 日期 */
809
791
  date: string;
810
- /** 库存量 */
811
792
  inventory: number | null;
812
- /** 增减 */
813
793
  change: number | null;
814
794
  }
815
795
  /**
816
- * COMEX 黄金/白银库存
796
+ * COMEX 库存数据
817
797
  */
818
798
  interface ComexInventory {
819
- /** 日期 */
820
799
  date: string;
821
- /** 品种(黄金/白银) */
822
800
  name: string;
823
- /** 库存量(吨) */
824
801
  storageTon: number | null;
825
- /** 库存量(盎司) */
826
802
  storageOunce: number | null;
803
+ /**
804
+ * @deprecated 请改用 `storageTon`
805
+ */
806
+ inventory: number | null;
807
+ /**
808
+ * @deprecated COMEX 接口当前未提供稳定的变动字段,始终返回 `null`
809
+ */
810
+ change: number | null;
811
+ /**
812
+ * @deprecated 请改用 `name`
813
+ */
814
+ market: 'gold' | 'silver';
827
815
  }
816
+
828
817
  /**
829
- * 股票搜索结果
830
- */
831
- interface SearchResult {
832
- /** 股票代码(完整,如 sh600519) */
833
- code: string;
834
- /** 股票名称 */
835
- name: string;
836
- /** 市场标识 (sh/sz/hk/us) */
837
- market: string;
838
- /** 资产类别 (GP-A/GP/KJ 等) */
839
- type: string;
840
- }
841
- /**
842
- * 分红派送详情
843
- */
844
- interface DividendDetail {
845
- /** 股票代码 */
846
- code: string;
847
- /** 股票名称 */
848
- name: string;
849
- /** 报告期 YYYY-MM-DD */
850
- reportDate: string | null;
851
- /** 预案公告日 YYYY-MM-DD */
852
- planNoticeDate: string | null;
853
- /** 业绩披露日期 YYYY-MM-DD */
854
- disclosureDate: string | null;
855
- /** 送转总比例(每10股送转X股) */
856
- assignTransferRatio: number | null;
857
- /** 送股比例(每10股送X股) */
858
- bonusRatio: number | null;
859
- /** 转股比例(每10股转X股) */
860
- transferRatio: number | null;
861
- /** 每10股派息(税前),单位:元 */
862
- dividendPretax: number | null;
863
- /** 分红描述(如:10派2.36元(含税,扣税后2.124元)) */
864
- dividendDesc: string | null;
865
- /** 股息率 */
866
- dividendYield: number | null;
867
- /** 每股收益(元) */
868
- eps: number | null;
869
- /** 每股净资产(元) */
870
- bps: number | null;
871
- /** 每股公积金(元) */
872
- capitalReserve: number | null;
873
- /** 每股未分配利润(元) */
874
- unassignedProfit: number | null;
875
- /** 净利润同比增长(%) */
876
- netProfitYoy: number | null;
877
- /** 总股本(股) */
878
- totalShares: number | null;
879
- /** 股权登记日 YYYY-MM-DD */
880
- equityRecordDate: string | null;
881
- /** 除权除息日 YYYY-MM-DD */
882
- exDividendDate: string | null;
883
- /** 现金分红发放日 YYYY-MM-DD */
884
- payDate: string | null;
885
- /** 方案进度(如:实施分配、股东大会预案等) */
886
- assignProgress: string | null;
887
- /** 最新公告日期 YYYY-MM-DD */
888
- noticeDate: string | null;
889
- }
890
- /**
891
- * 中金所股指期权品种代码
818
+ * 中金所股指期权产品
892
819
  */
893
820
  type IndexOptionProduct = 'ho' | 'io' | 'mo';
894
821
  /**
895
- * 期权 T 型报价单条数据(看涨 / 看跌共用)
822
+ * 期权 T 型报价项
896
823
  */
897
824
  interface OptionTQuote {
898
- /** 合约标识,如 io2504C3600 */
899
825
  symbol: string;
900
- /** 买量 */
901
826
  buyVolume: number | null;
902
- /** 买价 */
903
827
  buyPrice: number | null;
904
- /** 最新价 */
905
828
  price: number | null;
906
- /** 卖价 */
907
829
  askPrice: number | null;
908
- /** 卖量 */
909
830
  askVolume: number | null;
910
- /** 持仓量 */
911
831
  openInterest: number | null;
912
- /** 涨跌 */
913
832
  change: number | null;
914
- /** 行权价(仅看涨合约含此字段,看跌为 null) */
915
833
  strikePrice: number | null;
916
834
  }
917
835
  /**
918
836
  * 期权 T 型报价结果
919
837
  */
920
838
  interface OptionTQuoteResult {
921
- /** 看涨合约列表 */
922
839
  calls: OptionTQuote[];
923
- /** 看跌合约列表 */
924
840
  puts: OptionTQuote[];
925
841
  }
926
842
  /**
927
843
  * 期权日 K 线
928
844
  */
929
845
  interface OptionKline {
930
- /** 日期 YYYY-MM-DD */
931
846
  date: string;
932
- /** 开盘价 */
933
847
  open: number | null;
934
- /** 最高价 */
935
848
  high: number | null;
936
- /** 最低价 */
937
849
  low: number | null;
938
- /** 收盘价 */
939
850
  close: number | null;
940
- /** 成交量 */
941
851
  volume: number | null;
942
852
  }
943
853
  /**
944
- * 期权分钟行情
854
+ * 期权分钟数据
945
855
  */
946
856
  interface OptionMinute {
947
- /** 时间 HH:mm:ss */
948
857
  time: string;
949
- /** 日期 YYYY-MM-DD */
950
858
  date: string;
951
- /** 价格 */
952
859
  price: number | null;
953
- /** 成交量 */
954
860
  volume: number | null;
955
- /** 持仓量 */
956
861
  openInterest: number | null;
957
- /** 均价 */
958
862
  avgPrice: number | null;
959
863
  }
960
864
  /**
961
- * ETF 期权到期月份信息
865
+ * ETF 期权月份信息
962
866
  */
963
867
  interface ETFOptionMonth {
964
- /** 到期月份数组 YYYY-MM */
965
868
  months: string[];
966
- /** 标的证券代码 */
967
869
  stockId: string;
968
- /** 当前品种标识 */
969
870
  cateId: string;
970
- /** 可选品种列表 */
971
871
  cateList: string[];
972
872
  }
973
873
  /**
974
- * ETF 期权到期日信息
874
+ * ETF 期权到期信息
975
875
  */
976
876
  interface ETFOptionExpireDay {
977
- /** 到期日 YYYY-MM-DD */
978
877
  expireDay: string;
979
- /** 距到期剩余天数 */
980
878
  remainderDays: number;
981
- /** 标的证券代码 */
982
879
  stockId: string;
983
- /** 标的名称 */
984
880
  name: string;
985
881
  }
986
882
  /**
987
- * 上交所 ETF 期权品种
883
+ * ETF 期权品种
988
884
  */
989
885
  type ETFOptionCate = '50ETF' | '300ETF' | '500ETF' | '科创50' | '科创板50';
990
886
  /**
991
- * 中金所期权实时行情(东方财富)
887
+ * 中金所期权实时行情
992
888
  */
993
889
  interface CFFEXOptionQuote {
994
- /** 合约代码,如 MO2603-P-8200 */
995
890
  code: string;
996
- /** 合约名称 */
997
891
  name: string;
998
- /** 最新价 */
999
892
  price: number | null;
1000
- /** 涨跌额 */
1001
893
  change: number | null;
1002
- /** 涨跌幅% */
1003
894
  changePercent: number | null;
1004
- /** 成交量 */
1005
895
  volume: number | null;
1006
- /** 成交额 */
1007
896
  amount: number | null;
1008
- /** 持仓量 */
1009
897
  openInterest: number | null;
1010
- /** 行权价 */
1011
898
  strikePrice: number | null;
1012
- /** 剩余天数 */
1013
899
  remainDays: number | null;
1014
- /** 日增 */
1015
900
  dailyChange: number | null;
1016
- /** 昨结算价 */
1017
901
  prevSettle: number | null;
1018
- /** 今开 */
1019
902
  open: number | null;
1020
903
  }
1021
904
  /**
1022
- * 期权龙虎榜条目
905
+ * 期权龙虎榜项
1023
906
  */
1024
907
  interface OptionLHBItem {
1025
- /** 交易类型(认沽交易量/认沽持仓量/认购交易量/认购持仓量) */
1026
908
  tradeType: string;
1027
- /** 交易日期 YYYY-MM-DD */
1028
909
  date: string;
1029
- /** 标的代码 */
1030
910
  symbol: string;
1031
- /** 标的名称 */
1032
911
  targetName: string;
1033
- /** 会员简称 */
1034
- memberName: string;
1035
- /** 排名 */
1036
912
  rank: number;
1037
- /** 卖量 */
913
+ memberName: string;
1038
914
  sellVolume: number | null;
1039
- /** 卖量变化 */
1040
915
  sellVolumeChange: number | null;
1041
- /** 净卖量 */
1042
916
  netSellVolume: number | null;
1043
- /** 卖量占比 */
1044
917
  sellVolumeRatio: number | null;
1045
- /** 买量 */
1046
918
  buyVolume: number | null;
1047
- /** 买量变化 */
1048
919
  buyVolumeChange: number | null;
1049
- /** 净买量 */
1050
920
  netBuyVolume: number | null;
1051
- /** 买量占比 */
1052
921
  buyVolumeRatio: number | null;
1053
- /** 卖持仓 */
1054
922
  sellPosition: number | null;
1055
- /** 卖持仓变化 */
1056
923
  sellPositionChange: number | null;
1057
- /** 净卖持仓 */
1058
924
  netSellPosition: number | null;
1059
- /** 卖持仓占比 */
1060
925
  sellPositionRatio: number | null;
1061
- /** 买持仓 */
1062
926
  buyPosition: number | null;
1063
- /** 买持仓变化 */
1064
927
  buyPositionChange: number | null;
1065
- /** 净买持仓 */
1066
928
  netBuyPosition: number | null;
1067
- /** 买持仓占比 */
1068
929
  buyPositionRatio: number | null;
930
+ /**
931
+ * @deprecated 请改用 `date`
932
+ */
933
+ tradeDate: string;
934
+ /**
935
+ * @deprecated 旧字段,使用当前数据时优先读取 `buyVolume` / `sellVolume`
936
+ */
937
+ volume: number | null;
938
+ /**
939
+ * @deprecated 旧字段,使用当前数据时优先读取 `buyVolumeChange` / `sellVolumeChange`
940
+ */
941
+ volumeChange: number | null;
942
+ /**
943
+ * @deprecated 旧字段,历史实现中无稳定金额语义,当前返回最接近的持仓值
944
+ */
945
+ amount: number | null;
946
+ /**
947
+ * @deprecated 旧字段,历史实现中无稳定金额变动语义,当前返回最接近的持仓变动值
948
+ */
949
+ amountChange: number | null;
950
+ /**
951
+ * @deprecated 请改用 `buyPosition` / `sellPosition`
952
+ */
953
+ openInterest: number | null;
954
+ /**
955
+ * @deprecated 请改用 `buyPositionChange` / `sellPositionChange`
956
+ */
957
+ openInterestChange: number | null;
958
+ /**
959
+ * @deprecated 请改用更细粒度的 `tradeType`
960
+ */
961
+ side: 'buy' | 'sell' | 'net' | null;
962
+ }
963
+
964
+ /**
965
+ * 标准化的搜索结果资产分类
966
+ * - 由 `SearchResult.type` 原始字符串归一化得到
967
+ * - 用于跨数据源做统一的资产类型判断
968
+ */
969
+ type SearchResultType = 'stock' | 'index' | 'fund' | 'bond' | 'futures' | 'option' | 'other';
970
+ /**
971
+ * 搜索结果
972
+ *
973
+ * @remarks
974
+ * `type` 字段保留上游原始资产类型字符串(如 `'GP-A'`、`'ZS'`、`'KJ'` 等),
975
+ * 以保持向后兼容;如需基于统一分类做判断,请使用 `category`。
976
+ */
977
+ interface SearchResult {
978
+ /** 股票代码(完整,如 `sh600519`) */
979
+ code: string;
980
+ /** 名称 */
981
+ name: string;
982
+ /** 市场标识,如 `sh` / `sz` / `hk` / `us` */
983
+ market: string;
984
+ /** 上游原始资产类型字符串,如 `'GP-A'` / `'ZS'` / `'KJ'` */
985
+ type: string;
986
+ /**
987
+ * 标准化后的资产分类(在原始 `type` 基础上做归一化)
988
+ * - 不影响 `type` 原值,可放心用于 `switch` 等场景
989
+ */
990
+ category?: SearchResultType;
991
+ }
992
+ /**
993
+ * 分红派送详情
994
+ */
995
+ interface DividendDetail {
996
+ code: string;
997
+ name: string;
998
+ reportDate: string | null;
999
+ planNoticeDate: string | null;
1000
+ disclosureDate: string | null;
1001
+ assignTransferRatio: number | null;
1002
+ bonusRatio: number | null;
1003
+ transferRatio: number | null;
1004
+ dividendPretax: number | null;
1005
+ dividendDesc: string | null;
1006
+ dividendYield: number | null;
1007
+ eps: number | null;
1008
+ bps: number | null;
1009
+ capitalReserve: number | null;
1010
+ unassignedProfit: number | null;
1011
+ netProfitYoy: number | null;
1012
+ totalShares: number | null;
1013
+ equityRecordDate: string | null;
1014
+ exDividendDate: string | null;
1015
+ payDate: string | null;
1016
+ assignProgress: string | null;
1017
+ noticeDate: string | null;
1069
1018
  }
1070
1019
 
1071
1020
  /**
@@ -1149,18 +1098,6 @@ interface GetUSCodeListOptions {
1149
1098
  market?: USMarket;
1150
1099
  }
1151
1100
 
1152
- /**
1153
- * 腾讯 Smartbox 搜索接口
1154
- * 支持浏览器(JSONP)和 Node.js(fetch)双端
1155
- */
1156
-
1157
- /** 全局变量声明(浏览器环境)*/
1158
- declare global {
1159
- interface Window {
1160
- v_hint?: string;
1161
- }
1162
- }
1163
-
1164
1101
  /**
1165
1102
  * 东方财富 - A 股 K 线
1166
1103
  */
@@ -1851,17 +1788,83 @@ type KlineWithIndicators<T extends HistoryKline | HKUSHistoryKline> = T & {
1851
1788
  */
1852
1789
  declare function addIndicators<T extends HistoryKline | HKUSHistoryKline>(klines: T[], options?: IndicatorOptions): KlineWithIndicators<T>[];
1853
1790
 
1791
+ type BaseKline = HistoryKline | HKUSHistoryKline;
1792
+ type IndicatorKey = keyof IndicatorOptions;
1793
+ interface IndicatorComputationContext {
1794
+ closes: (number | null)[];
1795
+ ohlcv: OHLCV[];
1796
+ }
1797
+ interface IndicatorLookback {
1798
+ bars: number;
1799
+ emaBased?: boolean;
1800
+ }
1801
+ interface IndicatorDescriptor<K extends IndicatorKey = IndicatorKey> {
1802
+ key: K;
1803
+ estimateLookback: (option: IndicatorOptions[K]) => IndicatorLookback;
1804
+ compute: (context: IndicatorComputationContext, option: IndicatorOptions[K]) => unknown[];
1805
+ }
1806
+ type IndicatorDescriptorMap = {
1807
+ [K in IndicatorKey]: IndicatorDescriptor<K>;
1808
+ };
1809
+ declare function buildIndicatorContext<T extends BaseKline>(klines: T[]): IndicatorComputationContext;
1810
+ declare const INDICATOR_REGISTRY: IndicatorDescriptorMap;
1811
+ declare function getEnabledIndicatorKeys(options: IndicatorOptions): IndicatorKey[];
1812
+ declare function estimateIndicatorLookback(options: IndicatorOptions): {
1813
+ maxLookback: number;
1814
+ hasEmaBasedIndicator: boolean;
1815
+ requiredBars: number;
1816
+ };
1817
+
1854
1818
  /**
1855
- * Stock SDK - 门面类
1856
- * 统一对外接口,组合各模块
1819
+ * 腾讯 Smartbox 搜索接口
1820
+ * 支持浏览器(JSONP)和 Node.js(fetch)双端
1857
1821
  */
1858
1822
 
1823
+ /** 全局变量声明(浏览器环境)*/
1824
+ declare global {
1825
+ interface Window {
1826
+ v_hint?: string;
1827
+ }
1828
+ }
1829
+
1830
+ type MarketType = 'A' | 'HK' | 'US';
1859
1831
  /**
1860
- * 市场类型
1832
+ * `getKlineWithIndicators` 的请求参数
1861
1833
  */
1862
- type MarketType = 'A' | 'HK' | 'US';
1834
+ interface KlineWithIndicatorsOptions {
1835
+ /**
1836
+ * 市场类型
1837
+ * - 不传时由 SDK 根据 `symbol` 自动识别
1838
+ * - A 股 / 港股 / 美股 => 'A' / 'HK' / 'US'
1839
+ */
1840
+ market?: MarketType;
1841
+ /** K 线周期,默认 `'daily'` */
1842
+ period?: 'daily' | 'weekly' | 'monthly';
1843
+ /** 复权方式:`''` 不复权 / `'qfq'` 前复权 / `'hfq'` 后复权 */
1844
+ adjust?: '' | 'qfq' | 'hfq';
1845
+ /**
1846
+ * 起始日期(`YYYYMMDD` 或 `YYYY-MM-DD`)
1847
+ * - SDK 会根据指标依赖自动向前多取若干 bar,以保证首日指标有效
1848
+ */
1849
+ startDate?: string;
1850
+ /** 结束日期(`YYYYMMDD` 或 `YYYY-MM-DD`) */
1851
+ endDate?: string;
1852
+ /**
1853
+ * 指标配置
1854
+ * - 仅传入 key(如 `{ ma: [5, 10] }`)即可启用对应指标
1855
+ * - 完整选项参见 `IndicatorOptions`
1856
+ */
1857
+ indicators?: IndicatorOptions;
1858
+ }
1859
+
1863
1860
  declare class StockSDK {
1864
- private client;
1861
+ private readonly client;
1862
+ private readonly quoteService;
1863
+ private readonly boardService;
1864
+ private readonly klineService;
1865
+ private readonly futuresService;
1866
+ private readonly optionsService;
1867
+ private readonly indicatorService;
1865
1868
  /**
1866
1869
  * 创建 Stock SDK 实例。
1867
1870
  * 旧的全局 `timeout` / `retry` / `rateLimit` / `circuitBreaker` 配置继续有效,
@@ -1869,452 +1872,281 @@ declare class StockSDK {
1869
1872
  */
1870
1873
  constructor(options?: RequestClientOptions);
1871
1874
  /**
1872
- * 获取 A 股 / 指数 全量行情
1873
- * @param codes 股票代码数组,如 ['sz000858', 'sh600000']
1875
+ * 获取 A 股完整行情(腾讯接口)
1876
+ * @param codes 股票代码数组(如 `['sh600519', 'sz000001']`)
1874
1877
  */
1875
1878
  getFullQuotes(codes: string[]): Promise<FullQuote[]>;
1876
1879
  /**
1877
- * 获取简要行情
1878
- * @param codes 股票代码数组,如 ['sz000858', 'sh000001']
1880
+ * 获取 A 股简化行情(腾讯接口)
1881
+ * @param codes 股票代码数组
1879
1882
  */
1880
1883
  getSimpleQuotes(codes: string[]): Promise<SimpleQuote[]>;
1881
1884
  /**
1882
- * 获取港股扩展行情
1883
- * @param codes 港股代码数组,如 ['09988', '00700']
1885
+ * 获取港股行情
1886
+ * @param codes 港股代码数组(如 `['hk00700']`)
1884
1887
  */
1885
1888
  getHKQuotes(codes: string[]): Promise<HKQuote[]>;
1886
1889
  /**
1887
- * 获取美股简要行情
1888
- * @param codes 美股代码数组,如 ['BABA', 'AAPL']
1890
+ * 获取美股行情
1891
+ * @param codes 美股代码数组(如 `['usAAPL']`)
1889
1892
  */
1890
1893
  getUSQuotes(codes: string[]): Promise<USQuote[]>;
1891
1894
  /**
1892
- * 获取公募基金行情
1893
- * @param codes 基金代码数组,如 ['000001', '110011']
1895
+ * 获取基金行情(场内/场外)
1896
+ * @param codes 基金代码数组
1894
1897
  */
1895
1898
  getFundQuotes(codes: string[]): Promise<FundQuote[]>;
1896
1899
  /**
1897
- * 获取资金流向
1898
- * @param codes 股票代码数组,如 ['sz000858', 'sh600000']
1900
+ * 获取资金流向数据
1901
+ * @param codes 股票代码数组
1899
1902
  */
1900
1903
  getFundFlow(codes: string[]): Promise<FundFlow[]>;
1901
1904
  /**
1902
- * 获取盘口大单占比
1903
- * @param codes 股票代码数组,如 ['sz000858', 'sh600000']
1905
+ * 获取盘口大单/异动数据
1906
+ * @param codes 股票代码数组
1904
1907
  */
1905
1908
  getPanelLargeOrder(codes: string[]): Promise<PanelLargeOrder[]>;
1906
1909
  /**
1907
- * 获取当日分时走势数据
1908
- * @param code 股票代码,如 'sz000001' 或 'sh600000'
1910
+ * 获取当日分时数据
1911
+ * @param code 单只股票代码
1909
1912
  */
1910
1913
  getTodayTimeline(code: string): Promise<TodayTimelineResponse>;
1911
1914
  /**
1912
- * 获取行业板块名称列表
1913
- * @returns 行业板块列表
1915
+ * 获取行业板块列表(东方财富)
1914
1916
  */
1915
1917
  getIndustryList(): Promise<IndustryBoard[]>;
1916
1918
  /**
1917
- * 获取行业板块实时行情
1918
- * @param symbol 行业板块名称(如"小金属")或代码(如"BK1027")
1919
- * @returns 实时行情指标列表
1919
+ * 获取行业板块成分股实时行情
1920
+ * @param symbol 行业板块代码
1920
1921
  */
1921
1922
  getIndustrySpot(symbol: string): Promise<IndustryBoardSpot[]>;
1922
1923
  /**
1923
- * 获取行业板块成分股
1924
- * @param symbol 行业板块名称(如"小金属")或代码(如"BK1027")
1925
- * @returns 成分股列表
1924
+ * 获取行业板块成分股列表
1925
+ * @param symbol 行业板块代码
1926
1926
  */
1927
1927
  getIndustryConstituents(symbol: string): Promise<IndustryBoardConstituent[]>;
1928
1928
  /**
1929
- * 获取行业板块历史 K 线(日/周/月)
1930
- * @param symbol 行业板块名称(如"小金属")或代码(如"BK1027")
1931
- * @param options 配置选项
1932
- * @returns 历史 K 线数据
1929
+ * 获取行业板块历史 K 线
1930
+ * @param symbol 行业板块代码
1931
+ * @param options K 线参数
1933
1932
  */
1934
1933
  getIndustryKline(symbol: string, options?: IndustryBoardKlineOptions): Promise<IndustryBoardKline[]>;
1935
1934
  /**
1936
- * 获取行业板块分时行情(1/5/15/30/60 分钟)
1937
- * @param symbol 行业板块名称(如"小金属")或代码(如"BK1027")
1938
- * @param options 配置选项
1939
- * @returns 分时行情数据
1935
+ * 获取行业板块分时/分钟 K 线
1936
+ * @param symbol 行业板块代码
1937
+ * @param options 周期参数(不传周期则返回当日分时)
1940
1938
  */
1941
1939
  getIndustryMinuteKline(symbol: string, options?: IndustryBoardMinuteKlineOptions): Promise<IndustryBoardMinuteTimeline[] | IndustryBoardMinuteKline[]>;
1942
1940
  /**
1943
- * 获取概念板块名称列表
1944
- * @returns 概念板块列表
1941
+ * 获取概念板块列表(东方财富)
1945
1942
  */
1946
1943
  getConceptList(): Promise<ConceptBoard[]>;
1947
1944
  /**
1948
- * 获取概念板块实时行情
1949
- * @param symbol 概念板块名称(如"人工智能")或代码(如"BK0800")
1950
- * @returns 实时行情指标列表
1945
+ * 获取概念板块成分股实时行情
1946
+ * @param symbol 概念板块代码
1951
1947
  */
1952
1948
  getConceptSpot(symbol: string): Promise<ConceptBoardSpot[]>;
1953
1949
  /**
1954
- * 获取概念板块成分股
1955
- * @param symbol 概念板块名称(如"人工智能")或代码(如"BK0800")
1956
- * @returns 成分股列表
1950
+ * 获取概念板块成分股列表
1951
+ * @param symbol 概念板块代码
1957
1952
  */
1958
1953
  getConceptConstituents(symbol: string): Promise<ConceptBoardConstituent[]>;
1959
1954
  /**
1960
- * 获取概念板块历史 K 线(日/周/月)
1961
- * @param symbol 概念板块名称(如"人工智能")或代码(如"BK0800")
1962
- * @param options 配置选项
1963
- * @returns 历史 K 线数据
1955
+ * 获取概念板块历史 K 线
1956
+ * @param symbol 概念板块代码
1957
+ * @param options K 线参数
1964
1958
  */
1965
1959
  getConceptKline(symbol: string, options?: ConceptBoardKlineOptions): Promise<ConceptBoardKline[]>;
1966
1960
  /**
1967
- * 获取概念板块分时行情(1/5/15/30/60 分钟)
1968
- * @param symbol 概念板块名称(如"人工智能")或代码(如"BK0800")
1969
- * @param options 配置选项
1970
- * @returns 分时行情数据
1961
+ * 获取概念板块分时/分钟 K 线
1962
+ * @param symbol 概念板块代码
1963
+ * @param options 周期参数(不传周期则返回当日分时)
1971
1964
  */
1972
1965
  getConceptMinuteKline(symbol: string, options?: ConceptBoardMinuteKlineOptions): Promise<ConceptBoardMinuteTimeline[] | ConceptBoardMinuteKline[]>;
1973
1966
  /**
1974
- * 获取 A 股历史 K 线(日/周/月)
1967
+ * 获取 A 股历史 K 线(日/周/月,含复权)
1968
+ * @param symbol 股票代码
1969
+ * @param options K 线参数
1975
1970
  */
1976
1971
  getHistoryKline(symbol: string, options?: HistoryKlineOptions): Promise<HistoryKline[]>;
1977
1972
  /**
1978
- * 获取 A 股分钟 K 线或分时数据
1973
+ * 获取 A 股分时/分钟 K 线
1974
+ * @param symbol 股票代码
1975
+ * @param options 周期参数(不传周期则返回当日分时)
1979
1976
  */
1980
1977
  getMinuteKline(symbol: string, options?: MinuteKlineOptions): Promise<MinuteTimeline[] | MinuteKline[]>;
1981
1978
  /**
1982
- * 获取港股历史 K 线(日/周/月)
1979
+ * 获取港股历史 K 线
1980
+ * @param symbol 港股代码
1981
+ * @param options K 线参数
1983
1982
  */
1984
1983
  getHKHistoryKline(symbol: string, options?: HKKlineOptions): Promise<HKUSHistoryKline[]>;
1985
1984
  /**
1986
- * 获取美股历史 K 线(日/周/月)
1985
+ * 获取美股历史 K 线
1986
+ * @param symbol 美股代码
1987
+ * @param options K 线参数
1987
1988
  */
1988
1989
  getUSHistoryKline(symbol: string, options?: USKlineOptions): Promise<HKUSHistoryKline[]>;
1989
1990
  /**
1990
- * 搜索股票
1991
- * @param keyword 关键词(股票代码、名称、拼音)
1991
+ * 模糊搜索股票/指数/基金等
1992
+ * @param keyword 关键词(代码 / 名称 / 拼音)
1992
1993
  */
1993
1994
  search(keyword: string): Promise<SearchResult[]>;
1994
1995
  /**
1995
- * 从远程获取 A 股代码列表
1996
- * @param options 配置选项
1997
- *
1998
- * @example
1999
- * // 获取全部 A 股(带交易所前缀)
2000
- * const codes = await sdk.getAShareCodeList();
2001
- *
2002
- * @example
2003
- * // 获取全部 A 股(不带交易所前缀)
2004
- * const codes = await sdk.getAShareCodeList({ simple: true });
2005
- *
2006
- * @example
2007
- * // 获取科创板股票
2008
- * const codes = await sdk.getAShareCodeList({ market: 'kc' });
2009
- *
2010
- * @example
2011
- * // 获取创业板股票(不带前缀)
2012
- * const codes = await sdk.getAShareCodeList({ simple: true, market: 'cy' });
1996
+ * 获取 A 股全量代码列表
1997
+ * @param options 过滤选项;传 `boolean` 兼容旧版「是否包含交易所前缀」用法
2013
1998
  */
2014
1999
  getAShareCodeList(options?: GetAShareCodeListOptions | boolean): Promise<string[]>;
2015
2000
  /**
2016
- * 从远程获取美股代码列表
2017
- * @param options 配置选项
2018
- *
2019
- * @example
2020
- * // 获取全部美股(带市场前缀)
2021
- * const codes = await sdk.getUSCodeList();
2022
- * // ['105.AAPL', '106.BABA', ...]
2023
- *
2024
- * @example
2025
- * // 获取全部美股(不带市场前缀)
2026
- * const codes = await sdk.getUSCodeList({ simple: true });
2027
- * // ['AAPL', 'BABA', ...]
2028
- *
2029
- * @example
2030
- * // 筛选纳斯达克股票
2031
- * const codes = await sdk.getUSCodeList({ market: 'NASDAQ' });
2032
- * // ['105.AAPL', ...]
2033
- *
2034
- * @example
2035
- * // 筛选纽交所股票
2036
- * const codes = await sdk.getUSCodeList({ market: 'NYSE' });
2037
- * // ['106.BABA', ...]
2001
+ * 获取美股全量代码列表
2002
+ * @param options 过滤选项;传 `boolean` 兼容旧版「是否包含市场前缀」用法
2038
2003
  */
2039
2004
  getUSCodeList(options?: GetUSCodeListOptions | boolean): Promise<string[]>;
2040
2005
  /**
2041
- * 从远程获取港股代码列表
2006
+ * 获取港股全量代码列表
2042
2007
  */
2043
2008
  getHKCodeList(): Promise<string[]>;
2044
2009
  /**
2045
- * 从远程获取基金代码列表
2046
- * @returns 基金代码数组(6 位代码)
2047
- *
2048
- * @example
2049
- * const codes = await sdk.getFundCodeList();
2050
- * console.log(codes.length); // 26068
2010
+ * 获取基金全量代码列表
2051
2011
  */
2052
2012
  getFundCodeList(): Promise<string[]>;
2053
2013
  /**
2054
- * 获取全部 A 股实时行情
2055
- * @param options 配置选项
2056
- *
2057
- * @example
2058
- * // 获取全部 A 股行情
2059
- * const quotes = await sdk.getAllAShareQuotes();
2060
- *
2061
- * @example
2062
- * // 获取科创板行情
2063
- * const kcQuotes = await sdk.getAllAShareQuotes({ market: 'kc' });
2064
- *
2065
- * @example
2066
- * // 获取创业板行情
2067
- * const cyQuotes = await sdk.getAllAShareQuotes({ market: 'cy' });
2014
+ * 批量拉取全部 A 股完整行情
2015
+ * @param options 批量请求参数(如批大小、并发等)
2068
2016
  */
2069
2017
  getAllAShareQuotes(options?: GetAllAShareQuotesOptions): Promise<FullQuote[]>;
2070
2018
  /**
2071
- * 获取全部港股实时行情
2019
+ * 批量拉取全部港股行情
2020
+ * @param options 批量请求参数
2072
2021
  */
2073
2022
  getAllHKShareQuotes(options?: GetAllAShareQuotesOptions): Promise<HKQuote[]>;
2074
2023
  /**
2075
- * 获取全部美股实时行情
2076
- * @param options 配置选项
2077
- *
2078
- * @example
2079
- * // 获取全部美股行情
2080
- * const quotes = await sdk.getAllUSShareQuotes();
2081
- *
2082
- * @example
2083
- * // 获取纳斯达克股票行情
2084
- * const nasdaqQuotes = await sdk.getAllUSShareQuotes({ market: 'NASDAQ' });
2085
- *
2086
- * @example
2087
- * // 获取纽交所股票行情(带进度回调)
2088
- * const nyseQuotes = await sdk.getAllUSShareQuotes({
2089
- * market: 'NYSE',
2090
- * onProgress: (completed, total) => console.log(`${completed}/${total}`)
2091
- * });
2024
+ * 批量拉取全部美股行情
2025
+ * @param options 批量请求参数
2092
2026
  */
2093
2027
  getAllUSShareQuotes(options?: GetAllUSQuotesOptions): Promise<USQuote[]>;
2094
2028
  /**
2095
- * 获取全部股票实时行情(使用自定义股票代码列表)
2029
+ * 按给定代码列表批量拉取完整行情
2030
+ * @param codes 股票代码数组
2031
+ * @param options 批量请求参数
2096
2032
  */
2097
2033
  getAllQuotesByCodes(codes: string[], options?: GetAllAShareQuotesOptions): Promise<FullQuote[]>;
2098
2034
  /**
2099
- * 批量混合查询,返回原始解析结果(key + fields)
2100
- * @param params 'sz000858,s_sh000001,jj000001'
2035
+ * 直接调用腾讯批量行情原始接口(高级用法)
2036
+ * @param params 拼接后的查询参数(如 `'sh600519,sz000001'`)
2101
2037
  */
2102
2038
  batchRaw(params: string): Promise<{
2103
2039
  key: string;
2104
2040
  fields: string[];
2105
2041
  }[]>;
2106
2042
  /**
2107
- * 获取 A 股交易日历
2108
- * @returns 交易日期字符串数组,格式如 ['1990-12-19', '1990-12-20', ...]
2043
+ * 获取交易日历(A 股)
2109
2044
  */
2110
2045
  getTradingCalendar(): Promise<string[]>;
2111
2046
  /**
2112
- * 获取股票分红派送详情
2113
- * @param symbol - 股票代码(纯数字或带交易所前缀),如 '600519' 或 'sh600519'
2114
- * @returns 分红派送详情列表,按报告日期降序排列
2115
- *
2116
- * @example
2117
- * // 获取贵州茅台的分红历史
2118
- * const dividends = await sdk.getDividendDetail('600519');
2119
- * console.log(dividends[0].dividendPretax); // 每10股派息(税前)
2047
+ * 获取分红配股明细
2048
+ * @param symbol 股票代码
2120
2049
  */
2121
2050
  getDividendDetail(symbol: string): Promise<DividendDetail[]>;
2122
2051
  /**
2123
- * 获取国内期货历史 K 线(日/周/月)
2124
- * @param symbol - 合约代码,如 'rb2605'(具体合约)或 'RBM'(主连)
2125
- * @param options - 配置选项
2126
- * @returns 期货 K 线数据数组
2127
- *
2128
- * @example
2129
- * // 获取螺纹钢主连日K
2130
- * const klines = await sdk.getFuturesKline('RBM');
2131
- *
2132
- * @example
2133
- * // 获取沪深300期货具体合约周K
2134
- * const klines = await sdk.getFuturesKline('IF2604', { period: 'weekly' });
2052
+ * 获取国内期货历史 K 线
2053
+ * @param symbol 期货合约代码
2054
+ * @param options K 线参数
2135
2055
  */
2136
2056
  getFuturesKline(symbol: string, options?: FuturesKlineOptions): Promise<FuturesKline[]>;
2137
2057
  /**
2138
2058
  * 获取全球期货实时行情
2139
- * @param options - 配置选项
2140
- * @returns 全球期货行情数组
2141
- *
2142
- * @example
2143
- * const quotes = await sdk.getGlobalFuturesSpot();
2144
- * console.log(quotes[0].name); // "COMEX铜"
2059
+ * @param options 筛选选项
2145
2060
  */
2146
2061
  getGlobalFuturesSpot(options?: GlobalFuturesSpotOptions): Promise<GlobalFuturesQuote[]>;
2147
2062
  /**
2148
- * 获取全球期货历史 K 线(日/周/月)
2149
- * @param symbol - 合约代码,如 'HG00Y'(COMEX铜连续)
2150
- * @param options - 配置选项
2151
- * @returns 期货 K 线数据数组
2152
- *
2153
- * @example
2154
- * const klines = await sdk.getGlobalFuturesKline('HG00Y');
2063
+ * 获取全球期货历史 K 线
2064
+ * @param symbol 期货合约代码
2065
+ * @param options K 线参数
2155
2066
  */
2156
2067
  getGlobalFuturesKline(symbol: string, options?: GlobalFuturesKlineOptions): Promise<FuturesKline[]>;
2157
2068
  /**
2158
2069
  * 获取期货库存品种列表
2159
- * @returns 品种列表(code + name + marketCode)
2160
- *
2161
- * @example
2162
- * const symbols = await sdk.getFuturesInventorySymbols();
2163
- * console.log(symbols); // [{code: 'rb', name: '螺纹钢', marketCode: '...'}]
2164
2070
  */
2165
2071
  getFuturesInventorySymbols(): Promise<FuturesInventorySymbol[]>;
2166
2072
  /**
2167
- * 获取期货库存数据
2168
- * @param symbol - 品种代码(从 getFuturesInventorySymbols 获取)
2169
- * @param options - 配置选项
2170
- * @returns 库存数据数组
2171
- *
2172
- * @example
2173
- * const inventory = await sdk.getFuturesInventory('rb');
2073
+ * 获取指定品种的期货库存历史
2074
+ * @param symbol 品种代码
2075
+ * @param options 查询参数
2174
2076
  */
2175
2077
  getFuturesInventory(symbol: string, options?: FuturesInventoryOptions): Promise<FuturesInventory[]>;
2176
2078
  /**
2177
- * 获取 COMEX 黄金/白银库存数据
2178
- * @param symbol - 'gold' 或 'silver'
2179
- * @param options - 配置选项
2180
- * @returns COMEX 库存数据数组
2181
- *
2182
- * @example
2183
- * const goldInventory = await sdk.getComexInventory('gold');
2079
+ * 获取 COMEX 黄金/白银库存
2080
+ * @param symbol `'gold'``'silver'`
2081
+ * @param options 查询参数
2184
2082
  */
2185
2083
  getComexInventory(symbol: 'gold' | 'silver', options?: ComexInventoryOptions): Promise<ComexInventory[]>;
2186
2084
  /**
2187
- * 获取中金所股指期权 T 型报价(看涨 + 看跌)
2188
- * @param product - 品种代码 'ho'(上证50) / 'io'(沪深300) / 'mo'(中证1000)
2189
- * @param contract - 合约代码,如 'io2504'
2190
- *
2191
- * @example
2192
- * const spot = await sdk.getIndexOptionSpot('io', 'io2504');
2193
- * console.log(spot.calls[0].strikePrice); // 行权价
2085
+ * 获取股指期权 T 型报价
2086
+ * @param product 期权品种
2087
+ * @param contract 合约月份等参数
2194
2088
  */
2195
2089
  getIndexOptionSpot(product: IndexOptionProduct, contract: string): Promise<OptionTQuoteResult>;
2196
2090
  /**
2197
- * 获取中金所股指期权合约日 K 线
2198
- * @param symbol - 合约代码(含看涨/看跌标识),如 'io2504C3600'
2199
- *
2200
- * @example
2201
- * const klines = await sdk.getIndexOptionKline('io2504C3600');
2091
+ * 获取股指期权日 K 线
2092
+ * @param symbol 合约代码
2202
2093
  */
2203
2094
  getIndexOptionKline(symbol: string): Promise<OptionKline[]>;
2204
2095
  /**
2205
- * 获取中金所全部期权实时行情列表
2206
- *
2207
- * @example
2208
- * const quotes = await sdk.getCFFEXOptionQuotes();
2209
- * console.log(quotes[0].code); // 'MO2603-P-8200'
2096
+ * 获取中金所期权当日报价(IO/MO 等)
2097
+ * @param options 筛选选项
2210
2098
  */
2211
2099
  getCFFEXOptionQuotes(options?: CFFEXOptionQuotesOptions): Promise<CFFEXOptionQuote[]>;
2212
2100
  /**
2213
- * 获取上交所 ETF 期权到期月份列表
2214
- * @param cate - 品种名称,如 '50ETF', '300ETF'
2215
- *
2216
- * @example
2217
- * const info = await sdk.getETFOptionMonths('50ETF');
2218
- * console.log(info.months); // ['2026-03', '2026-04', ...]
2101
+ * 获取 ETF 期权可用月份
2102
+ * @param cate ETF 期权品种
2219
2103
  */
2220
2104
  getETFOptionMonths(cate: ETFOptionCate): Promise<ETFOptionMonth>;
2221
2105
  /**
2222
- * 获取上交所 ETF 期权到期日与剩余天数
2223
- * @param cate - 品种名称
2224
- * @param month - 到期月份 YYYY-MM
2225
- *
2226
- * @example
2227
- * const info = await sdk.getETFOptionExpireDay('50ETF', '2026-03');
2228
- * console.log(info.remainderDays); // 12
2106
+ * 获取 ETF 期权指定月份的合约列表/到期日
2107
+ * @param cate ETF 期权品种
2108
+ * @param month 月份(如 `'202405'`)
2229
2109
  */
2230
2110
  getETFOptionExpireDay(cate: ETFOptionCate, month: string): Promise<ETFOptionExpireDay>;
2231
2111
  /**
2232
- * 获取上交所 ETF 期权当日分钟行情
2233
- * @param code - 期权代码(纯数字),如 '10009633'
2112
+ * 获取 ETF 期权当日分时
2113
+ * @param code 合约代码
2234
2114
  */
2235
2115
  getETFOptionMinute(code: string): Promise<OptionMinute[]>;
2236
2116
  /**
2237
- * 获取上交所 ETF 期权历史日 K 线
2238
- * @param code - 期权代码(纯数字),如 '10009633'
2117
+ * 获取 ETF 期权日 K 线
2118
+ * @param code 合约代码
2239
2119
  */
2240
2120
  getETFOptionDailyKline(code: string): Promise<OptionKline[]>;
2241
2121
  /**
2242
- * 获取上交所 ETF 期权 5 日分钟行情
2243
- * @param code - 期权代码(纯数字),如 '10009633'
2122
+ * 获取 ETF 期权 5 日分时
2123
+ * @param code 合约代码
2244
2124
  */
2245
2125
  getETFOption5DayMinute(code: string): Promise<OptionMinute[]>;
2246
2126
  /**
2247
2127
  * 获取商品期权 T 型报价
2248
- * @param variety - 品种代码(如 'au', 'cu', 'SR')
2249
- * @param contract - 合约代码,如 'au2506'
2250
- *
2251
- * @example
2252
- * const spot = await sdk.getCommodityOptionSpot('au', 'au2506');
2128
+ * @param variety 品种
2129
+ * @param contract 合约
2253
2130
  */
2254
2131
  getCommodityOptionSpot(variety: string, contract: string): Promise<OptionTQuoteResult>;
2255
2132
  /**
2256
- * 获取商品期权合约日 K 线
2257
- * @param symbol - 合约代码(含看涨/看跌标识),如 'm2409C3200'
2133
+ * 获取商品期权日 K 线
2134
+ * @param symbol 合约代码
2258
2135
  */
2259
2136
  getCommodityOptionKline(symbol: string): Promise<OptionKline[]>;
2260
2137
  /**
2261
2138
  * 获取期权龙虎榜
2262
- * @param symbol - 标的代码 '510050' / '510300' / '159919'
2263
- * @param date - 交易日期 YYYY-MM-DD
2264
- *
2265
- * @example
2266
- * const lhb = await sdk.getOptionLHB('510050', '2022-01-21');
2139
+ * @param symbol 合约代码
2140
+ * @param date 日期 `YYYY-MM-DD`
2267
2141
  */
2268
2142
  getOptionLHB(symbol: string, date: string): Promise<OptionLHBItem[]>;
2269
2143
  /**
2270
- * 市场类型识别
2271
- */
2272
- private detectMarket;
2273
- /**
2274
- * 安全获取数组最大值
2275
- */
2276
- private safeMax;
2277
- /**
2278
- * 计算各指标所需的最大前置天数
2279
- */
2280
- private calcRequiredLookback;
2281
- /**
2282
- * 计算实际请求的开始日期
2283
- */
2284
- private calcActualStartDate;
2285
- /**
2286
- * 计算实际请求的开始日期(交易日历)
2287
- */
2288
- private calcActualStartDateByCalendar;
2289
- /**
2290
- * 统一日期格式为 YYYY-MM-DD
2291
- */
2292
- private normalizeDate;
2293
- /**
2294
- * 压缩日期格式为 YYYYMMDD
2295
- */
2296
- private toCompactDate;
2297
- /**
2298
- * 日期字符串转时间戳
2299
- */
2300
- private dateToTimestamp;
2301
- /**
2302
- * 获取带技术指标的历史 K 线
2144
+ * 获取带技术指标的 K 线(A 股 / 港股 / 美股自动识别)
2145
+ * @param symbol 股票代码
2146
+ * @param options 配置(市场、周期、复权、日期范围、指标列表等)
2147
+ * @see {@link KlineWithIndicatorsOptions}
2303
2148
  */
2304
- getKlineWithIndicators(symbol: string, options?: {
2305
- /** 市场类型,不传则自动识别 */
2306
- market?: MarketType;
2307
- /** K 线周期 */
2308
- period?: 'daily' | 'weekly' | 'monthly';
2309
- /** 复权类型 */
2310
- adjust?: '' | 'qfq' | 'hfq';
2311
- /** 开始日期 YYYYMMDD */
2312
- startDate?: string;
2313
- /** 结束日期 YYYYMMDD */
2314
- endDate?: string;
2315
- /** 技术指标配置 */
2316
- indicators?: IndicatorOptions;
2317
- }): Promise<KlineWithIndicators<HistoryKline | HKUSHistoryKline>[]>;
2149
+ getKlineWithIndicators(symbol: string, options?: KlineWithIndicatorsOptions): Promise<KlineWithIndicators<HistoryKline | HKUSHistoryKline>[]>;
2318
2150
  }
2319
2151
 
2320
- export { type AShareMarket, type ATROptions, type BIASOptions, type BOLLOptions, type CCIOptions, type CFFEXOptionQuote, type CFFEXOptionQuotesOptions, type ComexInventory, type ComexInventoryOptions, type ConceptBoard, type ConceptBoardConstituent, type ConceptBoardKline, type ConceptBoardKlineOptions, type ConceptBoardMinuteKline, type ConceptBoardMinuteKlineOptions, type ConceptBoardMinuteTimeline, type ConceptBoardSpot, type DMIOptions$1 as DMIOptions, type DMIResult$1 as DMIResult, type DividendDetail, type ETFOptionCate, type ETFOptionExpireDay, type ETFOptionMonth, type FullQuote, type FundFlow, type FundQuote, type FuturesExchange, type FuturesInventory, type FuturesInventoryOptions, type FuturesInventorySymbol, type FuturesKline, type FuturesKlineOptions, type GetAShareCodeListOptions, type GetAllAShareQuotesOptions, type GlobalFuturesKlineOptions, type GlobalFuturesQuote, type GlobalFuturesSpotOptions, type HKQuote, type HKUSHistoryKline, type HistoryKline, HttpError, type IndexOptionProduct, type IndicatorOptions, type IndustryBoard, type IndustryBoardConstituent, type IndustryBoardKline, type IndustryBoardKlineOptions, type IndustryBoardMinuteKline, type IndustryBoardMinuteKlineOptions, type IndustryBoardMinuteTimeline, type IndustryBoardSpot, type JsonpOptions, type KCOptions$1 as KCOptions, type KCResult$1 as KCResult, type KDJOptions, type KlineWithIndicators, type MACDOptions, type MAOptions, type MarketType, type MinuteKline, type MinuteTimeline, type OBVOptions$1 as OBVOptions, type OBVResult$1 as OBVResult, type OptionKline, type OptionLHBItem, type OptionMinute, type OptionTQuote, type OptionTQuoteResult, type PanelLargeOrder, type ProviderName, type ProviderRequestPolicy, type ROCOptions$1 as ROCOptions, type ROCResult$1 as ROCResult, type RSIOptions, type RequestClientOptions, type RetryOptions, type SAROptions$1 as SAROptions, type SARResult$1 as SARResult, type SearchResult, type SimpleQuote, StockSDK, type TodayTimeline, type TodayTimelineResponse, type USQuote, type WROptions, addIndicators, asyncPool, calcATR, calcBIAS, calcBOLL, calcCCI, calcDMI, calcEMA, calcKC, calcKDJ, calcMA, calcMACD, calcOBV, calcROC, calcRSI, calcSAR, calcSMA, calcWMA, calcWR, chunkArray, decodeGBK, StockSDK as default, extractJsonFromJsonp, jsonpRequest, parseResponse, safeNumber, safeNumberOrNull };
2152
+ export { type AShareMarket, type ATROptions, type BIASOptions, type BOLLOptions, type CCIOptions, type CFFEXOptionQuote, type CFFEXOptionQuotesOptions, type ComexInventory, type ComexInventoryOptions, type ConceptBoard, type ConceptBoardConstituent, type ConceptBoardKline, type ConceptBoardKlineOptions, type ConceptBoardMinuteKline, type ConceptBoardMinuteKlineOptions, type ConceptBoardMinuteTimeline, type ConceptBoardSpot, type DMIOptions$1 as DMIOptions, type DMIResult$1 as DMIResult, type DividendDetail, type ETFOptionCate, type ETFOptionExpireDay, type ETFOptionMonth, type FullQuote, type FundFlow, type FundQuote, type FuturesExchange, type FuturesInventory, type FuturesInventoryOptions, type FuturesInventorySymbol, type FuturesKline, type FuturesKlineOptions, type GetAShareCodeListOptions, type GetAllAShareQuotesOptions, type GlobalFuturesKlineOptions, type GlobalFuturesQuote, type GlobalFuturesSpotOptions, type HKQuote, type HKUSHistoryKline, type HistoryKline, HttpError, INDICATOR_REGISTRY, type IndexOptionProduct, type IndicatorKey, type IndicatorOptions, type IndustryBoard, type IndustryBoardConstituent, type IndustryBoardKline, type IndustryBoardKlineOptions, type IndustryBoardMinuteKline, type IndustryBoardMinuteKlineOptions, type IndustryBoardMinuteTimeline, type IndustryBoardSpot, type JsonpOptions, type KCOptions$1 as KCOptions, type KCResult$1 as KCResult, type KDJOptions, type KlineWithIndicators, type MACDOptions, type MAOptions, type MarketType, type MinuteKline, type MinuteTimeline, type OBVOptions$1 as OBVOptions, type OBVResult$1 as OBVResult, type OptionKline, type OptionLHBItem, type OptionMinute, type OptionTQuote, type OptionTQuoteResult, type PanelLargeOrder, type ProviderName, type ProviderRequestPolicy, type ROCOptions$1 as ROCOptions, type ROCResult$1 as ROCResult, type RSIOptions, type RequestClientOptions, type RequestError, type RetryOptions, type SAROptions$1 as SAROptions, type SARResult$1 as SARResult, SdkError, type SearchResult, type SearchResultType, type SimpleQuote, StockSDK, type TodayTimeline, type TodayTimelineResponse, type USQuote, type WROptions, addIndicators, asyncPool, buildIndicatorContext, calcATR, calcBIAS, calcBOLL, calcCCI, calcDMI, calcEMA, calcKC, calcKDJ, calcMA, calcMACD, calcOBV, calcROC, calcRSI, calcSAR, calcSMA, calcWMA, calcWR, chunkArray, decodeGBK, StockSDK as default, estimateIndicatorLookback, extractJsonFromJsonp, getEnabledIndicatorKeys, getSdkErrorCode, jsonpRequest, parseResponse, safeNumber, safeNumberOrNull };