Documentation
¶
Index ¶
- Constants
- func Asc[T cmp.Ordered](x, y T) int
- func Desc[T cmp.Ordered](x, y T) int
- type Analysis
- type DataSample
- type KLineSample
- type OperationalSignal
- type Pattern
- type TendencyDirection
- type Triangle
- func (this *Triangle) Analyze(data []float64) []num.LinerTrend
- func (this *Triangle) Detect(data []float64) (neck, support, pressure float64, ...)
- func (this *Triangle) Export(data []float64) []plot.Series
- func (this *Triangle) ExportSeries(sample DataSample) []plot.Series
- func (this *Triangle) Fit() (neckLine, supportLine, pressureLine num.Line)
- func (this *Triangle) IsUp() bool
- func (this *Triangle) Space(periods int)
- type Wave
- type Waves
- type WavesTendency
- type Wedge
- func (this *Wedge) Cross() (dp, top, bottom num.DataPoint, ok bool)
- func (this *Wedge) ExportSeries(sample DataSample) []plot.Series
- func (this *Wedge) Fit() (neckLine, supportLine, pressureLine num.Line)
- func (this *Wedge) NeckLines() []num.Line
- func (this *Wedge) NeckSeries(sample DataSample) []plot.Series
Constants ¶
View Source
const ( DoubleBottom = "W底" DoubleTop = "M头" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Analysis ¶
type Analysis interface { // Normalize 归一化处理(Initialize) Normalize() error // Process 加工处理 Process() error // At 获取数据, 返回即时值, 最高值, 最低值 At(n int) (current, high, low float64) // Match 匹配 Match() }
Analysis 分析接口
type DataSample ¶
type DataSample interface { Time(n int) string // 时间 Len() int // 数据长度 Current(n int) float64 // 当前值 High(n int) float64 // 最高 Low(n int) float64 // 最低 Volume(n int) float64 // 量 Chart(name string) *plot.Chart // 图表 }
DataSample 数据样本
type KLineSample ¶
type KLineSample struct {
// contains filtered or unexported fields
}
KLineSample K线样板的实现
func (KLineSample) Current ¶
func (k KLineSample) Current(n int) float64
func (KLineSample) High ¶
func (k KLineSample) High(n int) float64
func (KLineSample) Len ¶
func (k KLineSample) Len() int
func (KLineSample) Low ¶
func (k KLineSample) Low(n int) float64
func (KLineSample) Time ¶
func (k KLineSample) Time(n int) string
func (KLineSample) Volume ¶ added in v0.5.9
func (k KLineSample) Volume(n int) float64
type OperationalSignal ¶
type OperationalSignal struct { Signal TendencyDirection // 操作信号 Digits int // 保留小数点几位 }
OperationalSignal 操作信号
type Pattern ¶
type Pattern interface { // Fit 拟合, 输出支撑线, 颈线, 压力线 Fit() (neckLine, supportLine, pressureLine num.Line) // ExportSeries 输出图表 ExportSeries(sample DataSample) []plot.Series // NeckSeries 输出颈线 NeckSeries(sample DataSample) []plot.Series }
Pattern 模式, 形态
type TendencyDirection ¶
type TendencyDirection = uint8
TendencyDirection 交易方向
const ( TradingKeep TendencyDirection = 0x00 // 持股 TradingBuy TendencyDirection = 1 << 6 // 买入,01xxxxxx TradingSell TendencyDirection = 1 << 7 // 卖出,10xxxxxx TradingBottomDivergence TendencyDirection = 0x01 // 底背离 TradingTopDivergence TendencyDirection = 0x02 // 顶背离 TradingConsistentRise TendencyDirection = 0x03 // 一致性上涨 TradingConsistentDecline TendencyDirection = 0x04 // 一致性下跌 )
type Triangle ¶ added in v0.6.0
type Triangle struct { OperationalSignal Top num.DataPoint // 顶或者底作为颈线 Left num.DataPoint // 左 Right num.DataPoint // 右 PremiumRate float64 // 交易信号触发后的溢价率 Name string // 形态名称 }
Triangle 三角形, W底和M头
双底的颈线有两个, 水平方向的TOP以及TOP于左右连线的平行线, 上升空间为top到底部区间的2倍
func MatchTriangle ¶ added in v0.6.0
MatchTriangle 模式匹配 三角形
func (*Triangle) Analyze ¶ added in v0.6.0
func (this *Triangle) Analyze(data []float64) []num.LinerTrend
Analyze 趋势分析
func (*Triangle) Detect ¶ added in v0.6.0
func (this *Triangle) Detect(data []float64) (neck, support, pressure float64, neckTendency, supportTendency, pressureTendency int)
Detect 检测最近的趋势
func (*Triangle) ExportSeries ¶ added in v0.6.0
func (this *Triangle) ExportSeries(sample DataSample) []plot.Series
type Waves ¶
type Waves struct { Data []float64 // 原始数据 Peaks []num.DataPoint // 波峰位置存储 Valleys []num.DataPoint // 波谷位置存储 PeakCount int // 所识别的波峰计数 ValleyCount int // 所识别的波谷计数 Digits int // 小数点几位 State int8 // 点状态 LastHigh num.DataPoint // 最新的高点 LastLow num.DataPoint // 最新的地点 }
Waves 波浪 波峰波谷
func HighAndLow ¶ added in v0.6.5
func HighAndLow(sample DataSample, code ...string) Waves
HighAndLow 关注低点高点变化的波浪
func PeaksAndValleys ¶ added in v0.6.1
func PeaksAndValleys(sample DataSample, code ...string) Waves
PeaksAndValleys 创建一个新的波浪
高点的波峰, 低点的波谷
type WavesTendency ¶ added in v0.6.1
type WavesTendency = int
WavesTendency 波段趋势
const ( TendencyPrice WavesTendency = 0 // 股价主导 TendencyLinear WavesTendency = 1 // 线性趋势主导 TendencyPriceAndLinear WavesTendency = 2 // 股价和趋势并存 )
type Wedge ¶
type Wedge struct { OperationalSignal TopLeft num.DataPoint // 顶 - 左 TopRight num.DataPoint // 顶 - 右 BottomLeft num.DataPoint // 底 - 左 BottomRight num.DataPoint // 底 - 右 }
Wedge 楔形
func (*Wedge) ExportSeries ¶
func (this *Wedge) ExportSeries(sample DataSample) []plot.Series
func (*Wedge) NeckSeries ¶ added in v0.6.1
func (this *Wedge) NeckSeries(sample DataSample) []plot.Series
Click to show internal directories.
Click to hide internal directories.