@363045841yyt/klinechart 0.5.5 → 0.6.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.
- package/README.md +9 -7
- package/dist/index.cjs +9 -9
- package/dist/index.js +3126 -2692
- package/dist/klinechart.css +1 -1
- package/dist/src/components/KLineChart.vue.d.ts +1 -1
- package/dist/src/composables/useFullscreenTeleportTarget.d.ts +3 -0
- package/dist/src/config/chartSettings.d.ts +1 -0
- package/dist/src/core/chart.d.ts +11 -2
- package/dist/src/core/controller/interaction.d.ts +4 -0
- package/dist/src/core/indicators/bollState.d.ts +34 -0
- package/dist/src/core/indicators/calculators.d.ts +129 -0
- package/dist/src/core/indicators/cciState.d.ts +15 -0
- package/dist/src/core/indicators/eneState.d.ts +30 -0
- package/dist/src/core/indicators/expmaState.d.ts +30 -0
- package/dist/src/core/indicators/fastkState.d.ts +15 -0
- package/dist/src/core/indicators/kstState.d.ts +21 -0
- package/dist/src/core/indicators/maState.d.ts +26 -0
- package/dist/src/core/indicators/momState.d.ts +15 -0
- package/dist/src/core/indicators/rsiState.d.ts +39 -0
- package/dist/src/core/indicators/scheduler.d.ts +244 -0
- package/dist/src/core/indicators/stochState.d.ts +18 -0
- package/dist/src/core/indicators/wmsrState.d.ts +15 -0
- package/dist/src/core/renderers/Indicator/boll.d.ts +9 -26
- package/dist/src/core/renderers/Indicator/cci.d.ts +2 -19
- package/dist/src/core/renderers/Indicator/ene.d.ts +9 -18
- package/dist/src/core/renderers/Indicator/expma.d.ts +9 -17
- package/dist/src/core/renderers/Indicator/fastk.d.ts +2 -19
- package/dist/src/core/renderers/Indicator/index.d.ts +10 -10
- package/dist/src/core/renderers/Indicator/kst.d.ts +2 -34
- package/dist/src/core/renderers/Indicator/ma.d.ts +10 -10
- package/dist/src/core/renderers/Indicator/mainIndicatorLegend.d.ts +3 -3
- package/dist/src/core/renderers/Indicator/mom.d.ts +2 -19
- package/dist/src/core/renderers/Indicator/rsi.d.ts +3 -27
- package/dist/src/core/renderers/Indicator/scale/indicator_scale.d.ts +3 -0
- package/dist/src/core/renderers/Indicator/stoch.d.ts +2 -28
- package/dist/src/core/renderers/Indicator/wmsr.d.ts +2 -19
- package/dist/src/core/scale/logFormula.d.ts +66 -0
- package/dist/src/core/scale/priceScale.d.ts +36 -2
- package/dist/src/core/theme/fonts.d.ts +11 -0
- package/dist/src/core/utils/tickPosition.d.ts +24 -0
- package/dist/src/plugin/types.d.ts +4 -0
- package/package.json +9 -1
- package/dist/src/semantic/schema.json.d.ts +0 -259
- package/dist/src/utils/kline/ma.d.ts +0 -2
|
@@ -1,41 +1,16 @@
|
|
|
1
|
-
import { RendererPluginWithHost,
|
|
2
|
-
import { KLineData } from '../../../types/price';
|
|
3
|
-
export interface STOCHConfig {
|
|
4
|
-
/** K 周期(默认 9) */
|
|
5
|
-
n?: number;
|
|
6
|
-
/** D 周期(默认 3) */
|
|
7
|
-
m?: number;
|
|
8
|
-
/** 是否显示 K 线 */
|
|
9
|
-
showK?: boolean;
|
|
10
|
-
/** 是否显示 D 线 */
|
|
11
|
-
showD?: boolean;
|
|
12
|
-
}
|
|
13
|
-
interface STOCHPoint {
|
|
14
|
-
k: number;
|
|
15
|
-
d: number;
|
|
16
|
-
}
|
|
17
|
-
export interface STOCHRenderState extends BaseIndicatorState {
|
|
18
|
-
valueMin: number;
|
|
19
|
-
valueMax: number;
|
|
20
|
-
}
|
|
1
|
+
import { RendererPluginWithHost, PluginHost } from '../../../plugin';
|
|
21
2
|
export interface STOCHRendererOptions {
|
|
22
3
|
/** 目标 pane ID(默认 'sub') */
|
|
23
4
|
paneId?: string;
|
|
24
|
-
/** 初始配置 */
|
|
25
|
-
config?: STOCHConfig;
|
|
26
5
|
}
|
|
27
6
|
/**
|
|
28
7
|
* 创建 STOCH 渲染器插件
|
|
29
8
|
*/
|
|
30
9
|
export declare function createSTOCHRendererPlugin(options?: STOCHRendererOptions): RendererPluginWithHost;
|
|
31
|
-
/**
|
|
32
|
-
* 计算指定索引处的 STOCH 值
|
|
33
|
-
*/
|
|
34
|
-
export declare function calcSTOCHAtIndex(data: KLineData[], index: number, n: number, m: number): STOCHPoint | undefined;
|
|
35
10
|
/**
|
|
36
11
|
* 获取 STOCH 标题信息(供 paneTitle 使用)
|
|
37
12
|
*/
|
|
38
|
-
export declare function getSTOCHTitleInfo(
|
|
13
|
+
export declare function getSTOCHTitleInfo(index: number, n: number, m: number, pluginHost: PluginHost, paneId?: string): {
|
|
39
14
|
name: string;
|
|
40
15
|
params: number[];
|
|
41
16
|
values: Array<{
|
|
@@ -44,4 +19,3 @@ export declare function getSTOCHTitleInfo(data: KLineData[], index: number, n?:
|
|
|
44
19
|
color: string;
|
|
45
20
|
}>;
|
|
46
21
|
} | null;
|
|
47
|
-
export {};
|
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
import { RendererPluginWithHost,
|
|
2
|
-
import { KLineData } from '../../../types/price';
|
|
3
|
-
export interface WMSRConfig {
|
|
4
|
-
/** 周期(默认 14) */
|
|
5
|
-
period?: number;
|
|
6
|
-
/** 是否显示 WMSR 线 */
|
|
7
|
-
showWMSR?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface WMSRRenderState extends BaseIndicatorState {
|
|
10
|
-
valueMin: number;
|
|
11
|
-
valueMax: number;
|
|
12
|
-
}
|
|
1
|
+
import { RendererPluginWithHost, PluginHost } from '../../../plugin';
|
|
13
2
|
export interface WMSRRendererOptions {
|
|
14
3
|
/** 目标 pane ID(默认 'sub') */
|
|
15
4
|
paneId?: string;
|
|
16
|
-
/** 初始配置 */
|
|
17
|
-
config?: WMSRConfig;
|
|
18
5
|
}
|
|
19
6
|
/**
|
|
20
7
|
* 创建 WMSR 渲染器插件
|
|
21
8
|
*/
|
|
22
9
|
export declare function createWMSRRendererPlugin(options?: WMSRRendererOptions): RendererPluginWithHost;
|
|
23
|
-
/**
|
|
24
|
-
* 计算指定索引处的 WMSR 值
|
|
25
|
-
*/
|
|
26
|
-
export declare function calcWMSRAtIndex(data: KLineData[], index: number, period: number): number | undefined;
|
|
27
10
|
/**
|
|
28
11
|
* 获取 WMSR 标题信息(供 paneTitle 使用)
|
|
29
12
|
*/
|
|
30
|
-
export declare function getWMSRTitleInfo(
|
|
13
|
+
export declare function getWMSRTitleInfo(index: number, period: number, pluginHost: PluginHost, paneId?: string): {
|
|
31
14
|
name: string;
|
|
32
15
|
params: number[];
|
|
33
16
|
values: Array<{
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { PriceRange } from './price';
|
|
2
|
+
/**
|
|
3
|
+
* LogFormula 接口
|
|
4
|
+
* 用于对数变换的动态偏移,保证极小值下的精度
|
|
5
|
+
*
|
|
6
|
+
* - logicalOffset: 逻辑偏移,使输出值落在合理范围
|
|
7
|
+
* - coordOffset: 坐标偏移,避免 log10(0) 并提升精度
|
|
8
|
+
*/
|
|
9
|
+
export interface LogFormula {
|
|
10
|
+
logicalOffset: number;
|
|
11
|
+
coordOffset: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 真实价格 → log 逻辑空间
|
|
15
|
+
* 公式: sign(price) * (log10(|price| + coordOffset) + logicalOffset)
|
|
16
|
+
*
|
|
17
|
+
* @param price 真实价格(可为负数)
|
|
18
|
+
* @param f LogFormula
|
|
19
|
+
* @returns log 逻辑空间值
|
|
20
|
+
*/
|
|
21
|
+
export declare function toLog(price: number, f: LogFormula): number;
|
|
22
|
+
/**
|
|
23
|
+
* log 逻辑空间 → 真实价格
|
|
24
|
+
* 公式: sign(logical) * (10^(|logical| - logicalOffset) - coordOffset)
|
|
25
|
+
*
|
|
26
|
+
* @param logical log 逻辑空间值
|
|
27
|
+
* @param f LogFormula
|
|
28
|
+
* @returns 真实价格
|
|
29
|
+
*/
|
|
30
|
+
export declare function fromLog(logical: number, f: LogFormula): number;
|
|
31
|
+
/**
|
|
32
|
+
* 根据价格范围动态计算 LogFormula
|
|
33
|
+
*
|
|
34
|
+
* 对于常规价格范围 (diff >= 1),使用默认值。
|
|
35
|
+
* 对于极小价格范围 (diff < 1),自动增大 logicalOffset 以维持精度。
|
|
36
|
+
*
|
|
37
|
+
* @param range 价格范围,可为 null
|
|
38
|
+
* @returns 最优的 LogFormula
|
|
39
|
+
*/
|
|
40
|
+
export declare function logFormulaForPriceRange(range: PriceRange | null): LogFormula;
|
|
41
|
+
/**
|
|
42
|
+
* 范围转 log 空间
|
|
43
|
+
* 将价格的 min/max 都转换到 log 空间
|
|
44
|
+
*
|
|
45
|
+
* @param range 真实价格范围
|
|
46
|
+
* @param f LogFormula
|
|
47
|
+
* @returns log 空间的价格范围
|
|
48
|
+
*/
|
|
49
|
+
export declare function convertPriceRangeToLog(range: PriceRange, f: LogFormula): PriceRange;
|
|
50
|
+
/**
|
|
51
|
+
* 范围从 log 空间转回
|
|
52
|
+
* 将 log 空间的 min/max 转换回真实价格
|
|
53
|
+
*
|
|
54
|
+
* @param range log 空间的价格范围
|
|
55
|
+
* @param f LogFormula
|
|
56
|
+
* @returns 真实价格范围
|
|
57
|
+
*/
|
|
58
|
+
export declare function convertPriceRangeFromLog(range: PriceRange, f: LogFormula): PriceRange;
|
|
59
|
+
/**
|
|
60
|
+
* 判断两个 LogFormula 是否相同
|
|
61
|
+
*
|
|
62
|
+
* @param a LogFormula A
|
|
63
|
+
* @param b LogFormula B
|
|
64
|
+
* @returns 是否相同
|
|
65
|
+
*/
|
|
66
|
+
export declare function logFormulasAreSame(a: LogFormula, b: LogFormula): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PriceRange } from './price';
|
|
2
|
+
import { ScaleType } from '../utils/tickPosition';
|
|
2
3
|
/**
|
|
3
4
|
* Pane 级别的价格坐标系(价格 -> pane 内 Y)
|
|
4
5
|
* - y=0 在 pane 顶部,y=height 在 pane 底部
|
|
@@ -8,10 +9,15 @@ export declare class PriceScale {
|
|
|
8
9
|
private height;
|
|
9
10
|
private paddingTop;
|
|
10
11
|
private paddingBottom;
|
|
11
|
-
/** 价格偏移量(用于上下拖动平移价格轴)
|
|
12
|
+
/** 价格偏移量(用于上下拖动平移价格轴)
|
|
13
|
+
* 在对数模式下,此偏移量为 log 空间偏移 */
|
|
12
14
|
private priceOffset;
|
|
13
15
|
/** 垂直缩放系数(1=默认,>1 放大,<1 缩小) */
|
|
14
16
|
private verticalScale;
|
|
17
|
+
/** 刻度类型:线性或对数 */
|
|
18
|
+
private scaleType;
|
|
19
|
+
/** 对数变换公式(动态计算,适配极小价格) */
|
|
20
|
+
private logFormula;
|
|
15
21
|
setRange(r: PriceRange): void;
|
|
16
22
|
setHeight(h: number): void;
|
|
17
23
|
setPadding(top: number, bottom: number): void;
|
|
@@ -20,7 +26,9 @@ export declare class PriceScale {
|
|
|
20
26
|
getPaddingBottom(): number;
|
|
21
27
|
/**
|
|
22
28
|
* 设置价格偏移量
|
|
23
|
-
* @param offset
|
|
29
|
+
* @param offset 价格偏移
|
|
30
|
+
* - 线性模式:真实价格的线性偏移
|
|
31
|
+
* - 对数模式:log 空间的偏移量
|
|
24
32
|
*/
|
|
25
33
|
setPriceOffset(offset: number): void;
|
|
26
34
|
/**
|
|
@@ -41,13 +49,39 @@ export declare class PriceScale {
|
|
|
41
49
|
*/
|
|
42
50
|
scaleByDelta(deltaY: number): void;
|
|
43
51
|
getVerticalScale(): number;
|
|
52
|
+
/**
|
|
53
|
+
* 设置刻度类型
|
|
54
|
+
* 切换时会自动转换 priceOffset 以保持视口位置
|
|
55
|
+
*/
|
|
56
|
+
setScaleType(type: ScaleType): void;
|
|
57
|
+
/**
|
|
58
|
+
* 获取当前刻度类型
|
|
59
|
+
*/
|
|
60
|
+
getScaleType(): ScaleType;
|
|
61
|
+
/**
|
|
62
|
+
* 获取显示范围(考虑 priceOffset 和 verticalScale)
|
|
63
|
+
*
|
|
64
|
+
* 对数模式下:
|
|
65
|
+
* - 内部计算在 log 空间进行
|
|
66
|
+
* - 返回的价格为真实价格
|
|
67
|
+
*/
|
|
44
68
|
getDisplayRange(baseRange?: PriceRange): PriceRange;
|
|
69
|
+
/**
|
|
70
|
+
* 价格 → Y 坐标
|
|
71
|
+
* 统一使用 getDisplayRange 的结果进行映射
|
|
72
|
+
*/
|
|
45
73
|
priceToY(price: number): number;
|
|
74
|
+
/**
|
|
75
|
+
* Y 坐标 → 价格
|
|
76
|
+
* 统一使用 getDisplayRange 的结果进行映射
|
|
77
|
+
*/
|
|
46
78
|
yToPrice(y: number): number;
|
|
47
79
|
/**
|
|
48
80
|
* 根据像素偏移计算价格偏移
|
|
49
81
|
* @param deltaY Y轴像素偏移(正数向下拖动)
|
|
50
82
|
* @returns 对应的价格偏移量
|
|
83
|
+
* - 线性模式:真实价格的偏移
|
|
84
|
+
* - 对数模式:log 空间的偏移
|
|
51
85
|
*/
|
|
52
86
|
deltaYToPriceOffset(deltaY: number): number;
|
|
53
87
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图表字体配置
|
|
3
|
+
* 字体栈:Trebuchet MS (Windows系统字体) -> Roboto -> Ubuntu -> 通用无衬线字体
|
|
4
|
+
* 通过 Google Fonts CDN 加载 Roboto 和 Ubuntu
|
|
5
|
+
*/
|
|
6
|
+
/** 数字和文本的标准字体栈 */
|
|
7
|
+
export declare const FONT_FAMILY = "\"Trebuchet MS\", Roboto, Ubuntu, sans-serif";
|
|
8
|
+
/** 获取指定字号的字体字符串,用于 Canvas ctx.font */
|
|
9
|
+
export declare function getFont(size: number, options?: {
|
|
10
|
+
bold?: boolean;
|
|
11
|
+
}): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface TickPosition {
|
|
2
|
+
index: number;
|
|
3
|
+
t: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
export type ScaleType = 'linear' | 'log';
|
|
7
|
+
export interface CalculateTickPositionsOptions {
|
|
8
|
+
height: number;
|
|
9
|
+
paddingTop: number;
|
|
10
|
+
paddingBottom: number;
|
|
11
|
+
isMain?: boolean;
|
|
12
|
+
hideEdgeTicks?: boolean;
|
|
13
|
+
scaleType?: ScaleType;
|
|
14
|
+
}
|
|
15
|
+
export declare function calculateTickPositions(options: CalculateTickPositionsOptions): TickPosition[];
|
|
16
|
+
export interface TickPositionWithValue extends TickPosition {
|
|
17
|
+
value: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CalculateValueTickPositionsOptions extends CalculateTickPositionsOptions {
|
|
20
|
+
valueMin: number;
|
|
21
|
+
valueMax: number;
|
|
22
|
+
logBase?: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function calculateValueTickPositions(options: CalculateValueTickPositionsOptions): TickPositionWithValue[];
|
|
@@ -116,6 +116,7 @@ export interface PaneInfo {
|
|
|
116
116
|
maxPrice: number;
|
|
117
117
|
minPrice: number;
|
|
118
118
|
};
|
|
119
|
+
getScaleType(): 'linear' | 'log';
|
|
119
120
|
};
|
|
120
121
|
priceRange: {
|
|
121
122
|
maxPrice: number;
|
|
@@ -147,6 +148,8 @@ export interface YAxisLabel {
|
|
|
147
148
|
price: number;
|
|
148
149
|
/** 标签在轴上的Y坐标(世界坐标,相对pane) */
|
|
149
150
|
y: number;
|
|
151
|
+
/** 标签类型,用于区分不同渲染外观 */
|
|
152
|
+
type?: 'lastPrice' | 'extrema' | 'anchor' | string;
|
|
150
153
|
/** 标签样式覆盖 */
|
|
151
154
|
style?: {
|
|
152
155
|
bgColor?: string;
|
|
@@ -350,6 +353,7 @@ export interface DrawingDefinition<TParams = Record<string, unknown>> {
|
|
|
350
353
|
export declare const GLOBAL_PANE_ID: unique symbol;
|
|
351
354
|
/** 优先级推荐范围 */
|
|
352
355
|
export declare const RENDERER_PRIORITY: {
|
|
356
|
+
readonly LAST_PRICE_LABEL: -25;
|
|
353
357
|
readonly SYSTEM_YAXIS: -20;
|
|
354
358
|
readonly SYSTEM_XAXIS: -20;
|
|
355
359
|
readonly BACKGROUND: 0;
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@363045841yyt/klinechart",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "A lightweight financial K-line charting library with first-class AI Agent support, crisp ResizeObserver-driven rendering, and plugin-based architecture. Focused on quantitative trading scenarios with TradingView-level interaction experience.",
|
|
5
|
+
"author": "363045841 <slslswbsy@qq.com>",
|
|
4
6
|
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/363045841/KLineChartQuant.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": "https://github.com/363045841/KLineChartQuant/issues",
|
|
12
|
+
"homepage": "https://363045841.github.io/KLineChartQuant/",
|
|
5
13
|
"keywords": [
|
|
6
14
|
"kline-chart",
|
|
7
15
|
"candlestick-chart",
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://kmap.dev/schemas/semantic-chart-config/1.0.0",
|
|
4
|
-
"title": "SemanticChartConfig",
|
|
5
|
-
"description": "Agent 语义化图表配置",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"required": ["version", "data"],
|
|
8
|
-
"additionalProperties": false,
|
|
9
|
-
"properties": {
|
|
10
|
-
"version": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
|
|
13
|
-
"description": "semver 版本号"
|
|
14
|
-
},
|
|
15
|
-
"data": { "$ref": "#/$defs/DataConfig" },
|
|
16
|
-
"indicators": { "$ref": "#/$defs/IndicatorsConfig" },
|
|
17
|
-
"markers": { "$ref": "#/$defs/MarkersConfig" },
|
|
18
|
-
"chart": { "$ref": "#/$defs/ChartOptions" },
|
|
19
|
-
"theme": { "$ref": "#/$defs/ThemeConfig" }
|
|
20
|
-
},
|
|
21
|
-
"$defs": {
|
|
22
|
-
"DataConfig": {
|
|
23
|
-
"type": "object",
|
|
24
|
-
"required": ["source", "symbol", "startDate", "endDate", "period", "adjust"],
|
|
25
|
-
"additionalProperties": false,
|
|
26
|
-
"properties": {
|
|
27
|
-
"source": { "type": "string", "enum": ["baostock", "dongcai"] },
|
|
28
|
-
"symbol": { "type": "string", "pattern": "^[0-9]{6}$" },
|
|
29
|
-
"exchange": { "type": "string", "enum": ["SH", "SZ", "BJ"] },
|
|
30
|
-
"startDate": { "type": "string", "format": "date" },
|
|
31
|
-
"endDate": { "type": "string", "format": "date" },
|
|
32
|
-
"period": {
|
|
33
|
-
"type": "string",
|
|
34
|
-
"enum": ["daily", "weekly", "monthly", "5min", "15min", "30min", "60min"]
|
|
35
|
-
},
|
|
36
|
-
"adjust": { "type": "string", "enum": ["qfq", "hfq", "none"] }
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"IndicatorsConfig": {
|
|
40
|
-
"type": "object",
|
|
41
|
-
"additionalProperties": false,
|
|
42
|
-
"properties": {
|
|
43
|
-
"main": {
|
|
44
|
-
"type": "array",
|
|
45
|
-
"items": { "$ref": "#/$defs/MainIndicatorConfig" },
|
|
46
|
-
"maxItems": 5
|
|
47
|
-
},
|
|
48
|
-
"sub": {
|
|
49
|
-
"type": "array",
|
|
50
|
-
"items": { "$ref": "#/$defs/SubIndicatorConfig" },
|
|
51
|
-
"maxItems": 5
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
"MainIndicatorConfig": {
|
|
56
|
-
"type": "object",
|
|
57
|
-
"required": ["type", "enabled"],
|
|
58
|
-
"additionalProperties": false,
|
|
59
|
-
"properties": {
|
|
60
|
-
"type": { "type": "string", "enum": ["MA", "BOLL"] },
|
|
61
|
-
"enabled": { "type": "boolean" },
|
|
62
|
-
"params": { "type": "object" }
|
|
63
|
-
},
|
|
64
|
-
"allOf": [
|
|
65
|
-
{
|
|
66
|
-
"if": {
|
|
67
|
-
"properties": { "type": { "const": "MA" } },
|
|
68
|
-
"required": ["type"]
|
|
69
|
-
},
|
|
70
|
-
"then": {
|
|
71
|
-
"properties": {
|
|
72
|
-
"params": {
|
|
73
|
-
"type": "object",
|
|
74
|
-
"additionalProperties": false,
|
|
75
|
-
"properties": {
|
|
76
|
-
"periods": {
|
|
77
|
-
"type": "array",
|
|
78
|
-
"items": { "type": "integer", "minimum": 1, "maximum": 250 },
|
|
79
|
-
"minItems": 1,
|
|
80
|
-
"maxItems": 5
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"else": {
|
|
87
|
-
"properties": {
|
|
88
|
-
"params": {
|
|
89
|
-
"type": "object",
|
|
90
|
-
"additionalProperties": false,
|
|
91
|
-
"properties": {
|
|
92
|
-
"period": { "type": "integer", "minimum": 1, "maximum": 100 },
|
|
93
|
-
"multiplier": { "type": "number", "minimum": 0.1, "maximum": 5 }
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
},
|
|
101
|
-
"SubIndicatorConfig": {
|
|
102
|
-
"type": "object",
|
|
103
|
-
"required": ["type", "enabled"],
|
|
104
|
-
"additionalProperties": false,
|
|
105
|
-
"properties": {
|
|
106
|
-
"type": {
|
|
107
|
-
"type": "string",
|
|
108
|
-
"enum": ["VOLUME", "MACD", "RSI", "CCI", "STOCH", "MOM", "WMSR", "KST", "FASTK"]
|
|
109
|
-
},
|
|
110
|
-
"enabled": { "type": "boolean" },
|
|
111
|
-
"params": { "type": "object" }
|
|
112
|
-
},
|
|
113
|
-
"allOf": [
|
|
114
|
-
{
|
|
115
|
-
"if": { "properties": { "type": { "const": "MACD" } } },
|
|
116
|
-
"then": {
|
|
117
|
-
"properties": {
|
|
118
|
-
"params": {
|
|
119
|
-
"type": "object",
|
|
120
|
-
"additionalProperties": false,
|
|
121
|
-
"properties": {
|
|
122
|
-
"fast": { "type": "integer", "minimum": 1, "maximum": 50 },
|
|
123
|
-
"slow": { "type": "integer", "minimum": 1, "maximum": 100 },
|
|
124
|
-
"signal": { "type": "integer", "minimum": 1, "maximum": 50 }
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"if": { "properties": { "type": { "const": "RSI" } } },
|
|
132
|
-
"then": {
|
|
133
|
-
"properties": {
|
|
134
|
-
"params": {
|
|
135
|
-
"type": "object",
|
|
136
|
-
"additionalProperties": false,
|
|
137
|
-
"properties": {
|
|
138
|
-
"period1": { "type": "integer", "minimum": 1, "maximum": 100 },
|
|
139
|
-
"period2": { "type": "integer", "minimum": 1, "maximum": 100 },
|
|
140
|
-
"period3": { "type": "integer", "minimum": 1, "maximum": 100 }
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
]
|
|
147
|
-
},
|
|
148
|
-
"MarkersConfig": {
|
|
149
|
-
"type": "object",
|
|
150
|
-
"additionalProperties": false,
|
|
151
|
-
"properties": {
|
|
152
|
-
"showVolumePriceMarkers": { "type": "boolean" },
|
|
153
|
-
"showExtremaMarkers": { "type": "boolean" },
|
|
154
|
-
"customMarkers": {
|
|
155
|
-
"type": "array",
|
|
156
|
-
"items": { "$ref": "#/$defs/CustomMarker" },
|
|
157
|
-
"maxItems": 100
|
|
158
|
-
},
|
|
159
|
-
"legend": { "$ref": "#/$defs/LegendConfig" }
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
"CustomMarker": {
|
|
163
|
-
"type": "object",
|
|
164
|
-
"required": ["id", "date", "shape"],
|
|
165
|
-
"additionalProperties": false,
|
|
166
|
-
"properties": {
|
|
167
|
-
"id": { "type": "string", "maxLength": 64 },
|
|
168
|
-
"date": {
|
|
169
|
-
"type": "string",
|
|
170
|
-
"description": "日期时间字符串,日K用 YYYY-MM-DD,分钟K用 YYYY-MM-DD HH:mm",
|
|
171
|
-
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}( [0-9]{2}:[0-9]{2})?$"
|
|
172
|
-
},
|
|
173
|
-
"shape": {
|
|
174
|
-
"type": "string",
|
|
175
|
-
"enum": ["arrow_up", "arrow_down", "flag", "circle", "rectangle", "diamond"]
|
|
176
|
-
},
|
|
177
|
-
"groupKey": { "type": "string", "maxLength": 32 },
|
|
178
|
-
"offset": {
|
|
179
|
-
"type": "object",
|
|
180
|
-
"additionalProperties": false,
|
|
181
|
-
"properties": {
|
|
182
|
-
"x": { "type": "number", "minimum": -500, "maximum": 500 },
|
|
183
|
-
"y": { "type": "number", "minimum": -500, "maximum": 500 }
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
"style": { "$ref": "#/$defs/MarkerStyle" },
|
|
187
|
-
"label": { "$ref": "#/$defs/MarkerLabel" },
|
|
188
|
-
"metadata": {
|
|
189
|
-
"type": "object",
|
|
190
|
-
"maxProperties": 20,
|
|
191
|
-
"additionalProperties": {
|
|
192
|
-
"type": ["string", "number", "boolean", "null"],
|
|
193
|
-
"maxLength": 200
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
"MarkerStyle": {
|
|
199
|
-
"type": "object",
|
|
200
|
-
"additionalProperties": false,
|
|
201
|
-
"properties": {
|
|
202
|
-
"fillColor": { "type": "string", "pattern": "^(#[0-9a-fA-F]{3,8}|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)|rgba\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*[\\d.]+\\s*\\))$" },
|
|
203
|
-
"strokeColor": { "type": "string", "pattern": "^(#[0-9a-fA-F]{3,8}|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)|rgba\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*[\\d.]+\\s*\\))$" },
|
|
204
|
-
"textColor": { "type": "string", "pattern": "^(#[0-9a-fA-F]{3,8}|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)|rgba\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*[\\d.]+\\s*\\))$" },
|
|
205
|
-
"size": { "type": "number", "minimum": 4, "maximum": 50 },
|
|
206
|
-
"lineWidth": { "type": "number", "minimum": 0.5, "maximum": 10 },
|
|
207
|
-
"opacity": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
"MarkerLabel": {
|
|
211
|
-
"type": "object",
|
|
212
|
-
"required": ["text"],
|
|
213
|
-
"additionalProperties": false,
|
|
214
|
-
"properties": {
|
|
215
|
-
"text": { "type": "string", "maxLength": 50 },
|
|
216
|
-
"position": { "type": "string", "enum": ["left", "right", "top", "bottom", "inside"] },
|
|
217
|
-
"align": { "type": "string", "enum": ["start", "center", "end"] },
|
|
218
|
-
"fontSize": { "type": "number", "minimum": 8, "maximum": 24 },
|
|
219
|
-
"offset": {
|
|
220
|
-
"type": "object",
|
|
221
|
-
"additionalProperties": false,
|
|
222
|
-
"properties": {
|
|
223
|
-
"x": { "type": "number", "minimum": -500, "maximum": 500 },
|
|
224
|
-
"y": { "type": "number", "minimum": -500, "maximum": 500 }
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
"LegendConfig": {
|
|
230
|
-
"type": "object",
|
|
231
|
-
"additionalProperties": false,
|
|
232
|
-
"properties": {
|
|
233
|
-
"enabled": { "type": "boolean" },
|
|
234
|
-
"position": { "type": "string", "enum": ["bottom-right", "bottom-left", "top-right", "top-left"] },
|
|
235
|
-
"onClick": { "type": "string", "enum": ["highlight", "toggle", "none"] }
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
"ChartOptions": {
|
|
239
|
-
"type": "object",
|
|
240
|
-
"additionalProperties": false,
|
|
241
|
-
"properties": {
|
|
242
|
-
"kWidth": { "type": "number", "minimum": 2, "maximum": 50 },
|
|
243
|
-
"kGap": { "type": "number", "minimum": 0, "maximum": 20 },
|
|
244
|
-
"autoScrollToRight": { "type": "boolean" }
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
"ThemeConfig": {
|
|
248
|
-
"type": "object",
|
|
249
|
-
"additionalProperties": false,
|
|
250
|
-
"properties": {
|
|
251
|
-
"priceUpColor": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
|
|
252
|
-
"priceDownColor": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" }
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
;
|
|
258
|
-
|
|
259
|
-
export default _default;
|