From 356a1ed9701eb4a03846920ece6b16a3723145be Mon Sep 17 00:00:00 2001 From: strange Date: Sun, 14 Dec 2025 22:44:34 +0800 Subject: [PATCH] plot --- README.md | 10 ++++++++++ go.mod | 1 - go.sum | 2 -- pkg/indicator/indicator_plot.go | 12 ++++++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4dc0883..bf293c8 100644 --- a/README.md +++ b/README.md @@ -133,3 +133,13 @@ RSI[1,2,3,4] -> RSI[0] [Alphalens 因子评估库](https://github.com/quantopian/alphalens) [词法解析](https://github.com/alecthomas/participle) + +```text +plot: [ + {state: "vector", type: Hist, props: {color: red}, exprs: [ + {expr: "vector < 0", props: {color: green}}, + ]}, + {state: "dif", type: Line, props: {color: red},}, + {state: "dea", type: Line, props: {color: red},}, +] +``` diff --git a/go.mod b/go.mod index 2551535..54d3103 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,6 @@ require ( github.com/jhump/protoreflect/v2 v2.0.0-beta.2 github.com/klauspost/compress v1.18.0 github.com/lib/pq v1.10.9 - github.com/markcheno/go-talib v0.0.0-20250114000313-ec55a20c902f github.com/mostynb/go-grpc-compression v1.2.3 github.com/nats-io/nats.go v1.47.0 github.com/redis/go-redis/v9 v9.7.3 diff --git a/go.sum b/go.sum index 470f2ee..f41aeb6 100644 --- a/go.sum +++ b/go.sum @@ -224,8 +224,6 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/markcheno/go-talib v0.0.0-20250114000313-ec55a20c902f h1:iKq//xEUUaeRoXNcAshpK4W8eSm7HtgI0aNznWtX7lk= -github.com/markcheno/go-talib v0.0.0-20250114000313-ec55a20c902f/go.mod h1:3YUtoVrKWu2ql+iAeRyepSz3fy6a+19hJzGS88+u4u0= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= diff --git a/pkg/indicator/indicator_plot.go b/pkg/indicator/indicator_plot.go index 5ba17a0..7c7ed76 100644 --- a/pkg/indicator/indicator_plot.go +++ b/pkg/indicator/indicator_plot.go @@ -1,5 +1,17 @@ package indicator +type Plot0 struct { + State string `json:"state"` // vector, stateName + Type PlotSeriesType `json:"series"` // 绘图类型 线/柱 + Props PlotProps `json:"props"` // 绘图属性 + Exps []PlotExp `json:"exps"` // 绘图条件表达式 +} + +type PlotExp struct { + Exp string `json:"exp"` // 绘图条件表达式 + Props PlotProps `json:"props"` // 条件表达式成立时绘图属性 +} + // 指标绘图 type Plot struct { Props PlotProps // 长度颜色等属性