Documentation ¶
Index ¶
- Constants
- func CalculateKLinesEMA(allKLines []types.KLine, priceF KLinePriceMapper, window int) float64
- func KLineClosePriceMapper(k types.KLine) float64
- func KLineOpenPriceMapper(k types.KLine) float64
- func KLineTypicalPriceMapper(k types.KLine) float64
- func MapKLinePrice(kLines []types.KLine, f KLinePriceMapper) (prices []float64)
- type AD
- type BOLL
- func (inc *BOLL) Bind(updater KLineWindowUpdater)
- func (inc *BOLL) EmitUpdate(sma float64, upBand float64, downBand float64)
- func (inc *BOLL) LastDownBand() float64
- func (inc *BOLL) LastSMA() float64
- func (inc *BOLL) LastStdDev() float64
- func (inc *BOLL) LastUpBand() float64
- func (inc *BOLL) OnUpdate(cb func(sma float64, upBand float64, downBand float64))
- type EWMA
- type KLinePriceMapper
- type KLineWindowUpdater
- type MACD
- type OBV
- type SMA
- type STOCH
- type VWAP
Constants ¶
const DPeriod int = 3
const MaxNumOfEWMA = 1_000
const MaxNumOfEWMATruncateSize = 500
const MaxNumOfSMA = 1_000
const MaxNumOfSMATruncateSize = 500
Variables ¶
This section is empty.
Functions ¶
func CalculateKLinesEMA ¶ added in v1.3.1
func CalculateKLinesEMA(allKLines []types.KLine, priceF KLinePriceMapper, window int) float64
func KLineClosePriceMapper ¶ added in v1.2.1
func KLineOpenPriceMapper ¶ added in v1.2.1
func KLineTypicalPriceMapper ¶ added in v1.16.0
func MapKLinePrice ¶ added in v1.2.1
func MapKLinePrice(kLines []types.KLine, f KLinePriceMapper) (prices []float64)
Types ¶
type AD ¶ added in v1.16.0
type AD struct { types.IntervalWindow Values types.Float64Slice PrePrice float64 EndTime time.Time UpdateCallbacks []func(value float64) }
ad implements accumulation/distribution indicator
Accumulation/Distribution Indicator (A/D) - https://www.investopedia.com/terms/a/accumulationdistribution.asp
func (*AD) Bind ¶ added in v1.16.0
func (inc *AD) Bind(updater KLineWindowUpdater)
func (*AD) EmitUpdate ¶ added in v1.16.0
type BOLL ¶
type BOLL struct { types.IntervalWindow // times of Std, generally it's 2 K float64 SMA types.Float64Slice StdDev types.Float64Slice UpBand types.Float64Slice DownBand types.Float64Slice EndTime time.Time // contains filtered or unexported fields }
func (*BOLL) Bind ¶
func (inc *BOLL) Bind(updater KLineWindowUpdater)
func (*BOLL) EmitUpdate ¶
func (*BOLL) LastDownBand ¶
func (*BOLL) LastStdDev ¶
func (*BOLL) LastUpBand ¶
type EWMA ¶
type EWMA struct { types.IntervalWindow Values types.Float64Slice LastOpenTime time.Time UpdateCallbacks []func(value float64) }
func (*EWMA) Bind ¶
func (inc *EWMA) Bind(updater KLineWindowUpdater)
func (*EWMA) EmitUpdate ¶ added in v1.2.1
type KLinePriceMapper ¶ added in v1.2.1
type KLineWindowUpdater ¶
type KLineWindowUpdater interface {
OnKLineWindowUpdate(func(interval types.Interval, window types.KLineWindow))
}
type MACD ¶ added in v1.16.0
type MACD struct { types.IntervalWindow // 9 ShortPeriod int // 12 LongPeriod int // 26 Values types.Float64Slice FastEWMA EWMA SlowEWMA EWMA SignalLine EWMA Histogram types.Float64Slice EndTime time.Time UpdateCallbacks []func(value float64) }
func (*MACD) Bind ¶ added in v1.16.0
func (inc *MACD) Bind(updater KLineWindowUpdater)
func (*MACD) EmitUpdate ¶ added in v1.16.0
type OBV ¶ added in v1.16.0
type OBV struct { types.IntervalWindow Values types.Float64Slice PrePrice float64 EndTime time.Time UpdateCallbacks []func(value float64) }
obv implements on-balance volume indicator
On-Balance Volume (OBV) Definition - https://www.investopedia.com/terms/o/onbalancevolume.asp
func (*OBV) Bind ¶ added in v1.16.0
func (inc *OBV) Bind(updater KLineWindowUpdater)
func (*OBV) EmitUpdate ¶ added in v1.16.0
type SMA ¶
type SMA struct { types.IntervalWindow Values types.Float64Slice EndTime time.Time UpdateCallbacks []func(value float64) }
func (*SMA) Bind ¶
func (inc *SMA) Bind(updater KLineWindowUpdater)
func (*SMA) EmitUpdate ¶ added in v1.2.1
type STOCH ¶ added in v1.17.0
type STOCH struct { types.IntervalWindow K types.Float64Slice D types.Float64Slice KLineWindow types.KLineWindow EndTime time.Time UpdateCallbacks []func(k float64, d float64) }
stoch implements stochastic oscillator indicator
Stochastic Oscillator - https://www.investopedia.com/terms/s/stochasticoscillator.asp
func (*STOCH) Bind ¶ added in v1.17.0
func (inc *STOCH) Bind(updater KLineWindowUpdater)
func (*STOCH) EmitUpdate ¶ added in v1.17.0
type VWAP ¶ added in v1.16.0
type VWAP struct { types.IntervalWindow Values types.Float64Slice WeightedSum float64 VolumeSum float64 EndTime time.Time UpdateCallbacks []func(value float64) }
vwap implements the volume weighted average price (VWAP) indicator:
Volume Weighted Average Price (VWAP) Definition - https://www.investopedia.com/terms/v/vwap.asp
Volume-Weighted Average Price (VWAP) Explained - https://academy.binance.com/en/articles/volume-weighted-average-price-vwap-explained
func (*VWAP) Bind ¶ added in v1.16.0
func (inc *VWAP) Bind(updater KLineWindowUpdater)