You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.0 KiB
47 lines
1.0 KiB
package indicator |
|
|
|
import "sig-pub/pkg/types" |
|
|
|
// VRVP 成交量分布图 |
|
type VRVP struct { |
|
} |
|
|
|
func (c *VRVP) Meta() IndicatorMeta { |
|
return IndicatorMeta{ |
|
Name: "VRVP", |
|
Input: []types.InputArg{ |
|
{Name: "window", Type: types.InputTypeUInt, Desc: "窗口大小", Default: 10}, |
|
}, |
|
State: []string{"sig"}, |
|
Plots: []Plot{ |
|
{Name: "RVI", State: "vector", Type: PlotLine, Props: PlotProps{"color": ColorGreen}}, |
|
{Name: "Signal", State: "sig", Type: PlotLine, Props: PlotProps{"color": ColorRed}}, |
|
}, |
|
} |
|
} |
|
|
|
func (s *VRVP) Init(input types.Input) (err error) { // 校验参数并初始化 |
|
// s.rate = input.Float("rate") |
|
// s.rate2 = input.Float("rate2") |
|
return |
|
} |
|
|
|
// Accumulate 计算累加值 |
|
func (v *VRVP) Accumulate(ctx IIndicatorContext) { |
|
} |
|
|
|
// Summary 计算完毕获取计算结果 |
|
func (v *VRVP) Summary(ctx IIndicatorContext) (summary any, ok bool) { |
|
|
|
return |
|
} |
|
|
|
type RVVPSummary struct { |
|
TotalVolume float64 |
|
Buckets []PriceBucket |
|
} |
|
|
|
type PriceBucket struct { |
|
Price float64 |
|
Volume float64 |
|
}
|
|
|