chip

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReboundWithSupport = ShortTermRebound | StrongSupport   // 0001 0001
	BreakoutSignals    = ShortTermBreakout | VolumeBreakout // 0000 0110
)

组合信号示例

Functions

func FiveYearsAgoJanFirst

func FiveYearsAgoJanFirst() time.Time

FiveYearsAgoJanFirst 获取五年前的1月1日零点

Types

type ChipDistribution

type ChipDistribution struct {
	Capital      float64 // 流通股本
	Digits       int     // 小数点位数
	HoldingPrice float64 // 目标价格
	LastClose    float64 // 最新收盘
	High         float64 // 最高价
	Low          float64 // 最低价
	// contains filtered or unexported fields
}

ChipDistribution 筹码分布计算器

func NewChipDistribution

func NewChipDistribution(cfg Config) *ChipDistribution

NewChipDistribution 创建新的筹码分布计算实例

func (*ChipDistribution) Calculate

func (cd *ChipDistribution) Calculate() error

Calculate 执行筹码分布计算

func (*ChipDistribution) FindMainPeaks

func (cd *ChipDistribution) FindMainPeaks(targetPrice float64) (upper, lower PeakSignal, err error)

FindMainPeaks 直接使用当前chip

func (*ChipDistribution) LoadCSV

func (cd *ChipDistribution) LoadCSV(code, date string) error

LoadCSV 加载数据

func (*ChipDistribution) RealVolume

func (cd *ChipDistribution) RealVolume(proportion float64) float64

type Config

type Config struct {
	PriceStep    float64 // 价格最小变动单位
	DecayFactor  float64 // 衰减系数
	ModelType    int     // 计算模型 (1:三角形 2:均匀)
	SearchWindow int     // 峰值搜索窗口大小
}

Config 计算配置参数

type DailyData

type DailyData struct {
	base.KLine
	TurnoverRate float64
	Avg          float64
}

DailyData 日线数据结构

type PeakSignal

type PeakSignal struct {
	Closest            float64 // 最近峰值价格
	Extremum           float64 // 极值价格, 筹码最密集的价位
	CurrentToPeakVol   float64 // 当前价格到峰值的累计筹码
	CurrentToPeakRatio float64 // 当前价格到峰值的累计筹码占比 (0~1)
	PeakVolume         float64 // 峰值对应筹码量
	PeakRatio          float64 // 峰值价位本身的筹码占比 (0~1)

	// 以下为扩展分析字段
	LeftVolume    float64 // 峰值左侧筹码总量
	RightVolume   float64 // 峰值右侧筹码总量
	AvgHoldDays   int     // 峰值区平均持仓天数
	Concentration float64 // 筹码集中度 (标准差)

}

PeakSignal 峰值信号

type TechSignal

type TechSignal uint64

TechSignal 技术信号位掩码 (支持组合信号)

const (
	ShortTermRebound  TechSignal = 1 << iota // 短线止跌     (0000 0001)
	ShortTermBreakout                        // 短线突破     (0000 0010)
	VolumeBreakout                           // 放量突破     (0000 0100)
	VolumeBreakdown                          // 放量破位     (0000 1000)
	StrongSupport                            // 强支撑       (0001 0000)

)

func (*TechSignal) Add

func (ts *TechSignal) Add(signal TechSignal)

Add 添加信号

func (TechSignal) Has

func (ts TechSignal) Has(signal TechSignal) bool

Has 判断是否包含某信号

func (*TechSignal) Remove

func (ts *TechSignal) Remove(signal TechSignal)

Remove 移除信号

func (TechSignal) String

func (ts TechSignal) String() string

转换为可读字符串

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL