@363045841yyt/klinechart 0.6.9 → 0.7.0

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.
Files changed (87) hide show
  1. package/README.md +1 -0
  2. package/dist/favicon.ico +0 -0
  3. package/dist/index.cjs +5 -5
  4. package/dist/index.js +8980 -2945
  5. package/dist/klinechart.css +1 -1
  6. package/dist/mock-stock-data.json +1 -0
  7. package/dist/src/api/data/baostock.d.ts +4 -0
  8. package/dist/src/components/IndicatorSelector.vue.d.ts +0 -10
  9. package/dist/src/components/KLineChart.vue.d.ts +1 -1
  10. package/dist/src/config/chartSettings.d.ts +6 -0
  11. package/dist/src/core/chart.d.ts +43 -10
  12. package/dist/src/core/controller/interaction.d.ts +2 -30
  13. package/dist/src/core/controller/markerInteraction.d.ts +28 -0
  14. package/dist/src/core/controller/pinchTracker.d.ts +18 -0
  15. package/dist/src/core/controller/tooltipPosition.d.ts +21 -0
  16. package/dist/src/core/drawing/plugin.d.ts +19 -0
  17. package/dist/src/core/indicators/atrState.d.ts +16 -0
  18. package/dist/src/core/indicators/calculators.d.ts +196 -0
  19. package/dist/src/core/indicators/chaikinVolState.d.ts +18 -0
  20. package/dist/src/core/indicators/cmfState.d.ts +16 -0
  21. package/dist/src/core/indicators/demaState.d.ts +16 -0
  22. package/dist/src/core/indicators/donchianState.d.ts +23 -0
  23. package/dist/src/core/indicators/fibState.d.ts +26 -0
  24. package/dist/src/core/indicators/hmaState.d.ts +16 -0
  25. package/dist/src/core/indicators/hvState.d.ts +18 -0
  26. package/dist/src/core/indicators/ichimokuState.d.ts +44 -0
  27. package/dist/src/core/indicators/indicatorRuntime.d.ts +55 -0
  28. package/dist/src/core/indicators/kamaState.d.ts +20 -0
  29. package/dist/src/core/indicators/keltnerState.d.ts +27 -0
  30. package/dist/src/core/indicators/mfiState.d.ts +16 -0
  31. package/dist/src/core/indicators/obvState.d.ts +14 -0
  32. package/dist/src/core/indicators/parkinsonState.d.ts +18 -0
  33. package/dist/src/core/indicators/pivotState.d.ts +29 -0
  34. package/dist/src/core/indicators/pvtState.d.ts +14 -0
  35. package/dist/src/core/indicators/rocState.d.ts +16 -0
  36. package/dist/src/core/indicators/sarState.d.ts +26 -0
  37. package/dist/src/core/indicators/scheduler.d.ts +100 -2
  38. package/dist/src/core/indicators/stateComposer.d.ts +81 -0
  39. package/dist/src/core/indicators/structureState.d.ts +43 -0
  40. package/dist/src/core/indicators/supertrendState.d.ts +22 -0
  41. package/dist/src/core/indicators/temaState.d.ts +16 -0
  42. package/dist/src/core/indicators/trixState.d.ts +20 -0
  43. package/dist/src/core/indicators/vmaState.d.ts +16 -0
  44. package/dist/src/core/indicators/volumeProfileState.d.ts +34 -0
  45. package/dist/src/core/indicators/vwapState.d.ts +16 -0
  46. package/dist/src/core/indicators/wmaState.d.ts +16 -0
  47. package/dist/src/core/indicators/workerProtocol.d.ts +308 -1
  48. package/dist/src/core/indicators/zonesState.d.ts +26 -0
  49. package/dist/src/core/paneRenderer.d.ts +3 -1
  50. package/dist/src/core/renderers/Indicator/atr.d.ts +17 -0
  51. package/dist/src/core/renderers/Indicator/chaikinVol.d.ts +4 -0
  52. package/dist/src/core/renderers/Indicator/cmf.d.ts +4 -0
  53. package/dist/src/core/renderers/Indicator/dema.d.ts +5 -0
  54. package/dist/src/core/renderers/Indicator/donchian.d.ts +5 -0
  55. package/dist/src/core/renderers/Indicator/fib.d.ts +4 -0
  56. package/dist/src/core/renderers/Indicator/hma.d.ts +5 -0
  57. package/dist/src/core/renderers/Indicator/hv.d.ts +4 -0
  58. package/dist/src/core/renderers/Indicator/ichimoku.d.ts +5 -0
  59. package/dist/src/core/renderers/Indicator/index.d.ts +28 -1
  60. package/dist/src/core/renderers/Indicator/indicatorData.d.ts +13 -0
  61. package/dist/src/core/renderers/Indicator/kama.d.ts +5 -0
  62. package/dist/src/core/renderers/Indicator/keltner.d.ts +5 -0
  63. package/dist/src/core/renderers/Indicator/mfi.d.ts +4 -0
  64. package/dist/src/core/renderers/Indicator/obv.d.ts +4 -0
  65. package/dist/src/core/renderers/Indicator/parkinson.d.ts +4 -0
  66. package/dist/src/core/renderers/Indicator/pivot.d.ts +4 -0
  67. package/dist/src/core/renderers/Indicator/pvt.d.ts +4 -0
  68. package/dist/src/core/renderers/Indicator/roc.d.ts +5 -0
  69. package/dist/src/core/renderers/Indicator/sar.d.ts +5 -0
  70. package/dist/src/core/renderers/Indicator/scale/atr_scale.d.ts +11 -0
  71. package/dist/src/core/renderers/Indicator/structure.d.ts +4 -0
  72. package/dist/src/core/renderers/Indicator/subPaneConfig.d.ts +9 -0
  73. package/dist/src/core/renderers/Indicator/supertrend.d.ts +5 -0
  74. package/dist/src/core/renderers/Indicator/tema.d.ts +5 -0
  75. package/dist/src/core/renderers/Indicator/trix.d.ts +5 -0
  76. package/dist/src/core/renderers/Indicator/vma.d.ts +4 -0
  77. package/dist/src/core/renderers/Indicator/volumeProfile.d.ts +4 -0
  78. package/dist/src/core/renderers/Indicator/vwap.d.ts +4 -0
  79. package/dist/src/core/renderers/Indicator/wma.d.ts +5 -0
  80. package/dist/src/core/renderers/Indicator/zones.d.ts +4 -0
  81. package/dist/src/core/renderers/webgl/candleSurface.d.ts +16 -5
  82. package/dist/src/core/renderers/webgl/sharedWebGLSurface.d.ts +33 -0
  83. package/dist/src/core/subPaneManager.d.ts +22 -0
  84. package/dist/src/semantic/types.d.ts +95 -0
  85. package/dist/src/test-setup.d.ts +6 -0
  86. package/package.json +1 -1
  87. /package/dist/src/api/data/{baostock.test.d.ts → baostock.integration.test.d.ts} +0 -0
@@ -0,0 +1,44 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ /**
3
+ * 一目均衡表数据点:5 条线在同一根 K 线槽位
4
+ * - tenkan (转换线) = (HH9 + LL9) / 2,当根 K 线计算
5
+ * - kijun (基准线) = (HH26 + LL26) / 2,当根 K 线计算
6
+ * - spanA (先行带 A) = (tenkan[t-displacement] + kijun[t-displacement]) / 2,前置位移
7
+ * - spanB (先行带 B) = (HH52[t-displacement] + LL52[t-displacement]) / 2,前置位移
8
+ * - chikou (迟行线) = close[t+displacement],后置位移
9
+ *
10
+ * 任一字段都可能 undefined(数据不足或位移外)。
11
+ */
12
+ export interface IchimokuPoint {
13
+ tenkan?: number;
14
+ kijun?: number;
15
+ spanA?: number;
16
+ spanB?: number;
17
+ chikou?: number;
18
+ }
19
+ export interface IchimokuRenderState extends BaseIndicatorState {
20
+ timestamp: number;
21
+ series: (IchimokuPoint | undefined)[];
22
+ params: {
23
+ tenkanPeriod: number;
24
+ kijunPeriod: number;
25
+ spanBPeriod: number;
26
+ displacement: number;
27
+ showTenkan: boolean;
28
+ showKijun: boolean;
29
+ showSpanA: boolean;
30
+ showSpanB: boolean;
31
+ showCloud: boolean;
32
+ showChikou: boolean;
33
+ };
34
+ valueMin: number;
35
+ valueMax: number;
36
+ visibleMin: number;
37
+ visibleMax: number;
38
+ }
39
+ export declare const createIchimokuStateKey: (paneId: string) => `indicator:${string}:${string}`;
40
+ export declare const DEFAULT_ICHIMOKU_TENKAN = 9;
41
+ export declare const DEFAULT_ICHIMOKU_KIJUN = 26;
42
+ export declare const DEFAULT_ICHIMOKU_SPAN_B = 52;
43
+ export declare const DEFAULT_ICHIMOKU_DISPLACEMENT = 26;
44
+ export declare const EMPTY_ICHIMOKU_STATE: IchimokuRenderState;
@@ -21,6 +21,34 @@ export declare class IndicatorRuntime {
21
21
  private cachedKstSeries;
22
22
  private cachedFastkSeries;
23
23
  private cachedMacdSeries;
24
+ private cachedAtrSeries;
25
+ private cachedWmaSeries;
26
+ private cachedDemaSeries;
27
+ private cachedTemaSeries;
28
+ private cachedHmaSeries;
29
+ private cachedKamaSeries;
30
+ private cachedSarSeries;
31
+ private cachedSupertrendSeries;
32
+ private cachedKeltnerSeries;
33
+ private cachedDonchianSeries;
34
+ private cachedIchimokuSeries;
35
+ private cachedRocSeries;
36
+ private cachedTrixSeries;
37
+ private cachedTrixSignalSeries;
38
+ private cachedHvSeries;
39
+ private cachedParkinsonSeries;
40
+ private cachedChaikinVolSeries;
41
+ private cachedVmaSeries;
42
+ private cachedObvSeries;
43
+ private cachedPvtSeries;
44
+ private cachedVwapSeries;
45
+ private cachedCmfSeries;
46
+ private cachedMfiSeries;
47
+ private cachedPivotSeries;
48
+ private cachedFibSeries;
49
+ private cachedStructureSeries;
50
+ private cachedZonesSeries;
51
+ private cachedVolumeProfileSeries;
24
52
  private dirtyData;
25
53
  private dirtyMAConfig;
26
54
  private dirtyBollConfig;
@@ -34,6 +62,33 @@ export declare class IndicatorRuntime {
34
62
  private dirtyKstConfig;
35
63
  private dirtyFastkConfig;
36
64
  private dirtyMacdConfig;
65
+ private dirtyAtrConfig;
66
+ private dirtyWmaConfig;
67
+ private dirtyDemaConfig;
68
+ private dirtyTemaConfig;
69
+ private dirtyHmaConfig;
70
+ private dirtyKamaConfig;
71
+ private dirtySarConfig;
72
+ private dirtySupertrendConfig;
73
+ private dirtyKeltnerConfig;
74
+ private dirtyDonchianConfig;
75
+ private dirtyIchimokuConfig;
76
+ private dirtyRocConfig;
77
+ private dirtyTrixConfig;
78
+ private dirtyHvConfig;
79
+ private dirtyParkinsonConfig;
80
+ private dirtyChaikinVolConfig;
81
+ private dirtyVmaConfig;
82
+ private dirtyObvConfig;
83
+ private dirtyPvtConfig;
84
+ private dirtyVwapConfig;
85
+ private dirtyCmfConfig;
86
+ private dirtyMfiConfig;
87
+ private dirtyPivotConfig;
88
+ private dirtyFibConfig;
89
+ private dirtyStructureConfig;
90
+ private dirtyZonesConfig;
91
+ private dirtyVolumeProfileConfig;
37
92
  private getDefaultConfig;
38
93
  /**
39
94
  * 更新数据
@@ -0,0 +1,20 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface KAMARenderState extends BaseIndicatorState {
3
+ timestamp: number;
4
+ series: (number | undefined)[];
5
+ params: {
6
+ period: number;
7
+ fastPeriod: number;
8
+ slowPeriod: number;
9
+ showKAMA: boolean;
10
+ };
11
+ valueMin: number;
12
+ valueMax: number;
13
+ visibleMin: number;
14
+ visibleMax: number;
15
+ }
16
+ export declare const createKAMAStateKey: (paneId: string) => `indicator:${string}:${string}`;
17
+ export declare const DEFAULT_KAMA_PERIOD = 10;
18
+ export declare const DEFAULT_KAMA_FAST_PERIOD = 2;
19
+ export declare const DEFAULT_KAMA_SLOW_PERIOD = 30;
20
+ export declare const EMPTY_KAMA_STATE: KAMARenderState;
@@ -0,0 +1,27 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface KeltnerPoint {
3
+ upper: number;
4
+ middle: number;
5
+ lower: number;
6
+ }
7
+ export interface KeltnerRenderState extends BaseIndicatorState {
8
+ timestamp: number;
9
+ series: (KeltnerPoint | undefined)[];
10
+ params: {
11
+ emaPeriod: number;
12
+ atrPeriod: number;
13
+ multiplier: number;
14
+ showUpper: boolean;
15
+ showMiddle: boolean;
16
+ showLower: boolean;
17
+ };
18
+ valueMin: number;
19
+ valueMax: number;
20
+ visibleMin: number;
21
+ visibleMax: number;
22
+ }
23
+ export declare const createKeltnerStateKey: (paneId: string) => `indicator:${string}:${string}`;
24
+ export declare const DEFAULT_KELTNER_EMA_PERIOD = 20;
25
+ export declare const DEFAULT_KELTNER_ATR_PERIOD = 10;
26
+ export declare const DEFAULT_KELTNER_MULTIPLIER = 2;
27
+ export declare const EMPTY_KELTNER_STATE: KeltnerRenderState;
@@ -0,0 +1,16 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface MFIRenderState extends BaseIndicatorState {
3
+ timestamp: number;
4
+ series: (number | undefined)[];
5
+ params: {
6
+ period: number;
7
+ showMFI: boolean;
8
+ };
9
+ valueMin: number;
10
+ valueMax: number;
11
+ visibleMin: number;
12
+ visibleMax: number;
13
+ }
14
+ export declare const createMFIStateKey: (paneId: string) => `indicator:${string}:${string}`;
15
+ export declare const DEFAULT_MFI_PERIOD = 14;
16
+ export declare const EMPTY_MFI_STATE: MFIRenderState;
@@ -0,0 +1,14 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface OBVRenderState extends BaseIndicatorState {
3
+ timestamp: number;
4
+ series: (number | undefined)[];
5
+ params: {
6
+ showOBV: boolean;
7
+ };
8
+ valueMin: number;
9
+ valueMax: number;
10
+ visibleMin: number;
11
+ visibleMax: number;
12
+ }
13
+ export declare const createOBVStateKey: (paneId: string) => `indicator:${string}:${string}`;
14
+ export declare const EMPTY_OBV_STATE: OBVRenderState;
@@ -0,0 +1,18 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface ParkinsonRenderState extends BaseIndicatorState {
3
+ timestamp: number;
4
+ series: (number | undefined)[];
5
+ params: {
6
+ period: number;
7
+ annualizationFactor: number;
8
+ showParkinson: boolean;
9
+ };
10
+ valueMin: number;
11
+ valueMax: number;
12
+ visibleMin: number;
13
+ visibleMax: number;
14
+ }
15
+ export declare const createParkinsonStateKey: (paneId: string) => `indicator:${string}:${string}`;
16
+ export declare const DEFAULT_PARKINSON_PERIOD = 20;
17
+ export declare const DEFAULT_PARKINSON_ANNUALIZATION = 252;
18
+ export declare const EMPTY_PARKINSON_STATE: ParkinsonRenderState;
@@ -0,0 +1,29 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface PivotPoint {
3
+ pp: number;
4
+ r1: number;
5
+ r2: number;
6
+ r3: number;
7
+ s1: number;
8
+ s2: number;
9
+ s3: number;
10
+ }
11
+ export interface PivotRenderState extends BaseIndicatorState {
12
+ timestamp: number;
13
+ series: (PivotPoint | undefined)[];
14
+ params: {
15
+ showPP: boolean;
16
+ showR1: boolean;
17
+ showR2: boolean;
18
+ showR3: boolean;
19
+ showS1: boolean;
20
+ showS2: boolean;
21
+ showS3: boolean;
22
+ };
23
+ valueMin: number;
24
+ valueMax: number;
25
+ visibleMin: number;
26
+ visibleMax: number;
27
+ }
28
+ export declare const createPivotStateKey: (paneId: string) => `indicator:${string}:${string}`;
29
+ export declare const EMPTY_PIVOT_STATE: PivotRenderState;
@@ -0,0 +1,14 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface PVTRenderState extends BaseIndicatorState {
3
+ timestamp: number;
4
+ series: (number | undefined)[];
5
+ params: {
6
+ showPVT: boolean;
7
+ };
8
+ valueMin: number;
9
+ valueMax: number;
10
+ visibleMin: number;
11
+ visibleMax: number;
12
+ }
13
+ export declare const createPVTStateKey: (paneId: string) => `indicator:${string}:${string}`;
14
+ export declare const EMPTY_PVT_STATE: PVTRenderState;
@@ -0,0 +1,16 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface ROCRenderState extends BaseIndicatorState {
3
+ timestamp: number;
4
+ series: (number | undefined)[];
5
+ params: {
6
+ period: number;
7
+ showROC: boolean;
8
+ };
9
+ valueMin: number;
10
+ valueMax: number;
11
+ visibleMin: number;
12
+ visibleMax: number;
13
+ }
14
+ export declare const createROCStateKey: (paneId: string) => `indicator:${string}:${string}`;
15
+ export declare const DEFAULT_ROC_PERIOD = 12;
16
+ export declare const EMPTY_ROC_STATE: ROCRenderState;
@@ -0,0 +1,26 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ /**
3
+ * SAR 点:value 是 SAR 价格,trend = 'up' 表示 SAR 在 K 线下方(多头止损)
4
+ * 'down' 表示 SAR 在 K 线上方(空头止损)。
5
+ */
6
+ export interface SARPoint {
7
+ value: number;
8
+ trend: 'up' | 'down';
9
+ }
10
+ export interface SARRenderState extends BaseIndicatorState {
11
+ timestamp: number;
12
+ series: (SARPoint | undefined)[];
13
+ params: {
14
+ step: number;
15
+ maxStep: number;
16
+ showSAR: boolean;
17
+ };
18
+ valueMin: number;
19
+ valueMax: number;
20
+ visibleMin: number;
21
+ visibleMax: number;
22
+ }
23
+ export declare const createSARStateKey: (paneId: string) => `indicator:${string}:${string}`;
24
+ export declare const DEFAULT_SAR_STEP = 0.02;
25
+ export declare const DEFAULT_SAR_MAX_STEP = 0.2;
26
+ export declare const EMPTY_SAR_STATE: SARRenderState;
@@ -1,6 +1,6 @@
1
1
  import { PluginHost } from '../../plugin';
2
2
  import { KLineData } from '../../types/price';
3
- import { BOLLSchedulerConfig, EXPMASchedulerConfig, ENESchedulerConfig, RSISchedulerConfig, CCISchedulerConfig, STOCHSchedulerConfig, MOMSchedulerConfig, WMSRSchedulerConfig, KSTSchedulerConfig, FASTKSchedulerConfig, MACDSchedulerConfig } from './workerProtocol';
3
+ import { BOLLSchedulerConfig, EXPMASchedulerConfig, ENESchedulerConfig, RSISchedulerConfig, CCISchedulerConfig, STOCHSchedulerConfig, MOMSchedulerConfig, WMSRSchedulerConfig, KSTSchedulerConfig, FASTKSchedulerConfig, MACDSchedulerConfig, ATRSchedulerConfig, WMASchedulerConfig, DEMASchedulerConfig, TEMASchedulerConfig, HMASchedulerConfig, KAMASchedulerConfig, SARSchedulerConfig, SuperTrendSchedulerConfig, KeltnerSchedulerConfig, DonchianSchedulerConfig, IchimokuSchedulerConfig, ROCSchedulerConfig, TRIXSchedulerConfig, HVSchedulerConfig, ParkinsonSchedulerConfig, ChaikinVolSchedulerConfig, VMASchedulerConfig, OBVSchedulerConfig, PVTSchedulerConfig, VWAPSchedulerConfig, CMFSchedulerConfig, MFISchedulerConfig, PivotSchedulerConfig, FibSchedulerConfig, StructureSchedulerConfig, ZonesSchedulerConfig, VolumeProfileSchedulerConfig } from './workerProtocol';
4
4
  import { MAFlags } from './calculators';
5
5
  /**
6
6
  * 可见范围
@@ -9,7 +9,7 @@ interface VisibleRange {
9
9
  start: number;
10
10
  end: number;
11
11
  }
12
- export type { BOLLSchedulerConfig, EXPMASchedulerConfig, ENESchedulerConfig, RSISchedulerConfig, CCISchedulerConfig, STOCHSchedulerConfig, MOMSchedulerConfig, WMSRSchedulerConfig, KSTSchedulerConfig, FASTKSchedulerConfig, MACDSchedulerConfig, };
12
+ export type { BOLLSchedulerConfig, EXPMASchedulerConfig, ENESchedulerConfig, RSISchedulerConfig, CCISchedulerConfig, STOCHSchedulerConfig, MOMSchedulerConfig, WMSRSchedulerConfig, KSTSchedulerConfig, FASTKSchedulerConfig, MACDSchedulerConfig, ATRSchedulerConfig, WMASchedulerConfig, DEMASchedulerConfig, TEMASchedulerConfig, HMASchedulerConfig, KAMASchedulerConfig, SARSchedulerConfig, SuperTrendSchedulerConfig, KeltnerSchedulerConfig, DonchianSchedulerConfig, IchimokuSchedulerConfig, ROCSchedulerConfig, TRIXSchedulerConfig, HVSchedulerConfig, ParkinsonSchedulerConfig, ChaikinVolSchedulerConfig, VMASchedulerConfig, OBVSchedulerConfig, PVTSchedulerConfig, VWAPSchedulerConfig, CMFSchedulerConfig, MFISchedulerConfig, PivotSchedulerConfig, FibSchedulerConfig, StructureSchedulerConfig, ZonesSchedulerConfig, VolumeProfileSchedulerConfig, };
13
13
  /**
14
14
  * IndicatorScheduler - 主线程 facade
15
15
  */
@@ -41,6 +41,10 @@ export declare class IndicatorScheduler {
41
41
  * 设置重绘回调
42
42
  */
43
43
  setInvalidateCallback(callback: () => void): void;
44
+ /**
45
+ * 副图增删后通知 scheduler 刷新 active mask
46
+ */
47
+ onSubPaneChanged(): void;
44
48
  /**
45
49
  * 设置活跃副图 paneId 提供者(来自 Chart.getSubPaneIndicators)
46
50
  */
@@ -118,6 +122,100 @@ export declare class IndicatorScheduler {
118
122
  * MACD 配置变更
119
123
  */
120
124
  updateMACDConfig(config: Partial<MACDSchedulerConfig>, paneId?: string): void;
125
+ /**
126
+ * ATR 配置变更
127
+ */
128
+ updateATRConfig(config: Partial<ATRSchedulerConfig>, paneId?: string): void;
129
+ /**
130
+ * WMA 配置变更
131
+ */
132
+ updateWMAConfig(config: Partial<WMASchedulerConfig>, paneId?: string): void;
133
+ /**
134
+ * DEMA 配置变更
135
+ */
136
+ updateDEMAConfig(config: Partial<DEMASchedulerConfig>, paneId?: string): void;
137
+ /**
138
+ * TEMA 配置变更
139
+ */
140
+ updateTEMAConfig(config: Partial<TEMASchedulerConfig>, paneId?: string): void;
141
+ /**
142
+ * HMA 配置变更
143
+ */
144
+ updateHMAConfig(config: Partial<HMASchedulerConfig>, paneId?: string): void;
145
+ /**
146
+ * KAMA 配置变更
147
+ */
148
+ updateKAMAConfig(config: Partial<KAMASchedulerConfig>, paneId?: string): void;
149
+ /**
150
+ * SAR 配置变更
151
+ */
152
+ updateSARConfig(config: Partial<SARSchedulerConfig>, paneId?: string): void;
153
+ /**
154
+ * SuperTrend 配置变更
155
+ */
156
+ updateSuperTrendConfig(config: Partial<SuperTrendSchedulerConfig>, paneId?: string): void;
157
+ /**
158
+ * Keltner 配置变更
159
+ */
160
+ updateKeltnerConfig(config: Partial<KeltnerSchedulerConfig>, paneId?: string): void;
161
+ /**
162
+ * Donchian 配置变更
163
+ */
164
+ updateDonchianConfig(config: Partial<DonchianSchedulerConfig>, paneId?: string): void;
165
+ /**
166
+ * Ichimoku 配置变更
167
+ */
168
+ updateIchimokuConfig(config: Partial<IchimokuSchedulerConfig>, paneId?: string): void;
169
+ /**
170
+ * ROC 配置变更
171
+ */
172
+ updateROCConfig(config: Partial<ROCSchedulerConfig>, paneId?: string): void;
173
+ /**
174
+ * TRIX 配置变更
175
+ */
176
+ updateTRIXConfig(config: Partial<TRIXSchedulerConfig>, paneId?: string): void;
177
+ /**
178
+ * HV 配置变更
179
+ */
180
+ updateHVConfig(config: Partial<HVSchedulerConfig>, paneId?: string): void;
181
+ /**
182
+ * Parkinson 配置变更
183
+ */
184
+ updateParkinsonConfig(config: Partial<ParkinsonSchedulerConfig>, paneId?: string): void;
185
+ /**
186
+ * ChaikinVol 配置变更
187
+ */
188
+ updateChaikinVolConfig(config: Partial<ChaikinVolSchedulerConfig>, paneId?: string): void;
189
+ /**
190
+ * VMA 配置变更
191
+ */
192
+ updateVMAConfig(config: Partial<VMASchedulerConfig>, paneId?: string): void;
193
+ /**
194
+ * OBV 配置变更
195
+ */
196
+ updateOBVConfig(config: Partial<OBVSchedulerConfig>, paneId?: string): void;
197
+ /**
198
+ * PVT 配置变更
199
+ */
200
+ updatePVTConfig(config: Partial<PVTSchedulerConfig>, paneId?: string): void;
201
+ /**
202
+ * VWAP 配置变更
203
+ */
204
+ updateVWAPConfig(config: Partial<VWAPSchedulerConfig>, paneId?: string): void;
205
+ /** CMF 配置变更 */
206
+ updateCMFConfig(config: Partial<CMFSchedulerConfig>, paneId?: string): void;
207
+ /** MFI 配置变更 */
208
+ updateMFIConfig(config: Partial<MFISchedulerConfig>, paneId?: string): void;
209
+ /** Pivot 配置变更 */
210
+ updatePivotConfig(config: Partial<PivotSchedulerConfig>, paneId?: string): void;
211
+ /** Fib 配置变更 */
212
+ updateFibConfig(config: Partial<FibSchedulerConfig>, paneId?: string): void;
213
+ /** Structure 配置变更 */
214
+ updateStructureConfig(config: Partial<StructureSchedulerConfig>, paneId?: string): void;
215
+ /** Zones 配置变更 */
216
+ updateZonesConfig(config: Partial<ZonesSchedulerConfig>, paneId?: string): void;
217
+ /** Volume Profile 配置变更 */
218
+ updateVolumeProfileConfig(config: Partial<VolumeProfileSchedulerConfig>, paneId?: string): void;
121
219
  /**
122
220
  * 设置当前激活的主图指标
123
221
  */
@@ -10,6 +10,33 @@ import { WMSRRenderState } from './wmsrState';
10
10
  import { KSTRenderState } from './kstState';
11
11
  import { FASTKRenderState } from './fastkState';
12
12
  import { MACDRenderState } from './macdState';
13
+ import { ATRRenderState } from './atrState';
14
+ import { WMARenderState } from './wmaState';
15
+ import { DEMARenderState } from './demaState';
16
+ import { TEMARenderState } from './temaState';
17
+ import { HMARenderState } from './hmaState';
18
+ import { KAMARenderState } from './kamaState';
19
+ import { SARRenderState } from './sarState';
20
+ import { SuperTrendRenderState } from './supertrendState';
21
+ import { KeltnerRenderState } from './keltnerState';
22
+ import { DonchianRenderState } from './donchianState';
23
+ import { IchimokuRenderState } from './ichimokuState';
24
+ import { ROCRenderState } from './rocState';
25
+ import { TRIXRenderState } from './trixState';
26
+ import { HVRenderState } from './hvState';
27
+ import { ParkinsonRenderState } from './parkinsonState';
28
+ import { ChaikinVolRenderState } from './chaikinVolState';
29
+ import { VMARenderState } from './vmaState';
30
+ import { OBVRenderState } from './obvState';
31
+ import { PVTRenderState } from './pvtState';
32
+ import { VWAPRenderState } from './vwapState';
33
+ import { CMFRenderState } from './cmfState';
34
+ import { MFIRenderState } from './mfiState';
35
+ import { PivotRenderState } from './pivotState';
36
+ import { FibRenderState } from './fibState';
37
+ import { StructureRenderState } from './structureState';
38
+ import { ZonesRenderState } from './zonesState';
39
+ import { VolumeProfileRenderState } from './volumeProfileState';
13
40
  import { IndicatorSeriesBundle } from './workerProtocol';
14
41
  /**
15
42
  * 可见范围
@@ -27,6 +54,33 @@ type VisibleSubIndicatorStates = {
27
54
  kst: KSTRenderState;
28
55
  fastk: FASTKRenderState;
29
56
  macd: MACDRenderState;
57
+ atr: ATRRenderState;
58
+ wma: WMARenderState;
59
+ dema: DEMARenderState;
60
+ tema: TEMARenderState;
61
+ hma: HMARenderState;
62
+ kama: KAMARenderState;
63
+ sar: SARRenderState;
64
+ supertrend: SuperTrendRenderState;
65
+ keltner: KeltnerRenderState;
66
+ donchian: DonchianRenderState;
67
+ ichimoku: IchimokuRenderState;
68
+ roc: ROCRenderState;
69
+ trix: TRIXRenderState;
70
+ hv: HVRenderState;
71
+ parkinson: ParkinsonRenderState;
72
+ chaikinVol: ChaikinVolRenderState;
73
+ vma: VMARenderState;
74
+ obv: OBVRenderState;
75
+ pvt: PVTRenderState;
76
+ vwap: VWAPRenderState;
77
+ cmf: CMFRenderState;
78
+ mfi: MFIRenderState;
79
+ pivot: PivotRenderState;
80
+ fib: FibRenderState;
81
+ structure: StructureRenderState;
82
+ zones: ZonesRenderState;
83
+ volumeProfile: VolumeProfileRenderState;
30
84
  };
31
85
  type VisibleSubIndicatorMask = {
32
86
  rsi?: boolean;
@@ -37,6 +91,33 @@ type VisibleSubIndicatorMask = {
37
91
  kst?: boolean;
38
92
  fastk?: boolean;
39
93
  macd?: boolean;
94
+ atr?: boolean;
95
+ wma?: boolean;
96
+ dema?: boolean;
97
+ tema?: boolean;
98
+ hma?: boolean;
99
+ kama?: boolean;
100
+ sar?: boolean;
101
+ supertrend?: boolean;
102
+ keltner?: boolean;
103
+ donchian?: boolean;
104
+ ichimoku?: boolean;
105
+ roc?: boolean;
106
+ trix?: boolean;
107
+ hv?: boolean;
108
+ parkinson?: boolean;
109
+ chaikinVol?: boolean;
110
+ vma?: boolean;
111
+ obv?: boolean;
112
+ pvt?: boolean;
113
+ vwap?: boolean;
114
+ cmf?: boolean;
115
+ mfi?: boolean;
116
+ pivot?: boolean;
117
+ fib?: boolean;
118
+ structure?: boolean;
119
+ zones?: boolean;
120
+ volumeProfile?: boolean;
40
121
  };
41
122
  type ComposedRenderStates = VisibleSubIndicatorStates & {
42
123
  ma: MARenderState;
@@ -0,0 +1,43 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface SwingPoint {
3
+ index: number;
4
+ price: number;
5
+ kind: 'high' | 'low';
6
+ label: 'HH' | 'HL' | 'LH' | 'LL';
7
+ confirmed: boolean;
8
+ }
9
+ export type StructureEventKind = 'BOS' | 'CHOCH';
10
+ export interface StructureEvent {
11
+ kind: StructureEventKind;
12
+ index: number;
13
+ triggerPrice: number;
14
+ brokenLevel: number;
15
+ brokenSwingIndex: number;
16
+ direction: 'up' | 'down';
17
+ }
18
+ export interface StructureSnapshot {
19
+ swings: SwingPoint[];
20
+ events: StructureEvent[];
21
+ trend: 'up' | 'down' | 'range';
22
+ }
23
+ export interface StructureRenderState extends BaseIndicatorState {
24
+ timestamp: number;
25
+ series: StructureSnapshot;
26
+ params: {
27
+ leftWindow: number;
28
+ rightWindow: number;
29
+ breakoutSource: 'close' | 'wick';
30
+ showSwingLabels: boolean;
31
+ showBOS: boolean;
32
+ showCHOCH: boolean;
33
+ showProvisional: boolean;
34
+ };
35
+ valueMin: number;
36
+ valueMax: number;
37
+ visibleMin: number;
38
+ visibleMax: number;
39
+ }
40
+ export declare const createStructureStateKey: (paneId: string) => `indicator:${string}:${string}`;
41
+ export declare const DEFAULT_STRUCTURE_LEFT = 2;
42
+ export declare const DEFAULT_STRUCTURE_RIGHT = 2;
43
+ export declare const EMPTY_STRUCTURE_STATE: StructureRenderState;
@@ -0,0 +1,22 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface SuperTrendPoint {
3
+ value: number;
4
+ trend: 'up' | 'down';
5
+ }
6
+ export interface SuperTrendRenderState extends BaseIndicatorState {
7
+ timestamp: number;
8
+ series: (SuperTrendPoint | undefined)[];
9
+ params: {
10
+ atrPeriod: number;
11
+ multiplier: number;
12
+ showSuperTrend: boolean;
13
+ };
14
+ valueMin: number;
15
+ valueMax: number;
16
+ visibleMin: number;
17
+ visibleMax: number;
18
+ }
19
+ export declare const createSuperTrendStateKey: (paneId: string) => `indicator:${string}:${string}`;
20
+ export declare const DEFAULT_SUPERTREND_ATR_PERIOD = 10;
21
+ export declare const DEFAULT_SUPERTREND_MULTIPLIER = 3;
22
+ export declare const EMPTY_SUPERTREND_STATE: SuperTrendRenderState;
@@ -0,0 +1,16 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface TEMARenderState extends BaseIndicatorState {
3
+ timestamp: number;
4
+ series: (number | undefined)[];
5
+ params: {
6
+ period: number;
7
+ showTEMA: boolean;
8
+ };
9
+ valueMin: number;
10
+ valueMax: number;
11
+ visibleMin: number;
12
+ visibleMax: number;
13
+ }
14
+ export declare const createTEMAStateKey: (paneId: string) => `indicator:${string}:${string}`;
15
+ export declare const DEFAULT_TEMA_PERIOD = 20;
16
+ export declare const EMPTY_TEMA_STATE: TEMARenderState;
@@ -0,0 +1,20 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface TRIXRenderState extends BaseIndicatorState {
3
+ timestamp: number;
4
+ series: (number | undefined)[];
5
+ params: {
6
+ period: number;
7
+ signalPeriod: number;
8
+ showTRIX: boolean;
9
+ showSignal: boolean;
10
+ };
11
+ signalSeries: (number | undefined)[];
12
+ valueMin: number;
13
+ valueMax: number;
14
+ visibleMin: number;
15
+ visibleMax: number;
16
+ }
17
+ export declare const createTRIXStateKey: (paneId: string) => `indicator:${string}:${string}`;
18
+ export declare const DEFAULT_TRIX_PERIOD = 15;
19
+ export declare const DEFAULT_TRIX_SIGNAL_PERIOD = 9;
20
+ export declare const EMPTY_TRIX_STATE: TRIXRenderState;
@@ -0,0 +1,16 @@
1
+ import { BaseIndicatorState } from '../../plugin';
2
+ export interface VMARenderState extends BaseIndicatorState {
3
+ timestamp: number;
4
+ series: (number | undefined)[];
5
+ params: {
6
+ period: number;
7
+ showVMA: boolean;
8
+ };
9
+ valueMin: number;
10
+ valueMax: number;
11
+ visibleMin: number;
12
+ visibleMax: number;
13
+ }
14
+ export declare const createVMAStateKey: (paneId: string) => `indicator:${string}:${string}`;
15
+ export declare const DEFAULT_VMA_PERIOD = 5;
16
+ export declare const EMPTY_VMA_STATE: VMARenderState;