6 changed files with 120 additions and 4 deletions
@ -0,0 +1,21 @@
|
||||
package sig |
||||
|
||||
import "sig-pub/pkg/indicator" |
||||
|
||||
type IndicatorSummary struct { |
||||
indicator.IIndicatorSummary |
||||
indicatorContext IOffsetIndicatorContext |
||||
summaryIndicator indicator.ISummaryIndicator |
||||
} |
||||
|
||||
func NewIndicatorSummary(summaryIndicator indicator.ISummaryIndicator, indicatorContext IOffsetIndicatorContext) *IndicatorSummary { |
||||
return &IndicatorSummary{ |
||||
summaryIndicator: summaryIndicator, |
||||
indicatorContext: indicatorContext, |
||||
} |
||||
} |
||||
|
||||
func (s *IndicatorSummary) Summary(offset, count int16) (summary any, ok bool) { |
||||
|
||||
return |
||||
} |
||||
@ -0,0 +1,47 @@
|
||||
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 |
||||
} |
||||
Loading…
Reference in new issue