Documentation ¶
Index ¶
- Constants
- type ADXStream
- type ATRPStream
- type ATRStream
- type BOLLStream
- type CCIStream
- type CMAStream
- type CrossStream
- type CrossType
- type EWMAStream
- type KLineStream
- type KLineSubscription
- type KeltnerStream
- type MACDStream
- type MultiplyStream
- type PivotHighStream
- type PivotLowStream
- type PriceStream
- func ClosePrices(source KLineSubscription) *PriceStream
- func HLC3(source KLineSubscription) *PriceStream
- func HighPrices(source KLineSubscription) *PriceStream
- func LowPrices(source KLineSubscription) *PriceStream
- func OpenPrices(source KLineSubscription) *PriceStream
- func Price(source KLineSubscription, mapper types.KLineValueMapper) *PriceStream
- func Volumes(source KLineSubscription) *PriceStream
- type RMAStream
- type RSIStream
- type SMAStream
- type SMMAStream
- type StdDevStream
- type StochStream
- type SubtractStream
- type TRStream
Constants ¶
View Source
const DPeriod int = 3
View Source
const MaxNumOfKLines = 4_000
View Source
const MaxNumOfRMA = 1000
View Source
const MaxNumOfRMATruncateSize = 500
View Source
const MaxNumOfSMA = 5_000
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ADXStream ¶ added in v1.59.0
type ADXStream struct { *RMAStream Plus, Minus *types.Float64Series // contains filtered or unexported fields }
func ADX ¶ added in v1.59.0
func ADX(source KLineSubscription, window int) *ADXStream
type ATRPStream ¶
type ATRPStream struct {
*types.Float64Series
}
func ATRP2 ¶
func ATRP2(source KLineSubscription, window int) *ATRPStream
type ATRStream ¶
type ATRStream struct { // embedded struct *RMAStream }
func ATR2 ¶
func ATR2(source KLineSubscription, window int) *ATRStream
type BOLLStream ¶
type BOLLStream struct { // the band series *types.Float64Series UpBand, DownBand *types.Float64Series SMA *SMAStream StdDev *StdDevStream // contains filtered or unexported fields }
func BOLL ¶
func BOLL(source types.Float64Source, window int, k float64) *BOLLStream
BOOL2 is bollinger indicator the data flow:
priceSource ->
-> calculate SMA -> calculate stdDev -> calculate bandWidth -> get latest SMA -> upBand, downBand
func (*BOLLStream) Calculate ¶
func (s *BOLLStream) Calculate(v float64) float64
type CCIStream ¶
type CCIStream struct { *types.Float64Series TypicalPrice *types.Float64Series // contains filtered or unexported fields }
type CMAStream ¶
type CMAStream struct {
*types.Float64Series
}
func CMA2 ¶
func CMA2(source types.Float64Source) *CMAStream
type CrossStream ¶
type CrossStream struct { *types.Float64Series // contains filtered or unexported fields }
CrossStream subscribes 2 upstreams, and calculate the cross signal
func Cross ¶
func Cross(a, b types.Float64Source) *CrossStream
Cross creates the CrossStream object:
cross := Cross(fastEWMA, slowEWMA)
type EWMAStream ¶
type EWMAStream struct { *types.Float64Series // contains filtered or unexported fields }
func EWMA2 ¶
func EWMA2(source types.Float64Source, window int) *EWMAStream
func (*EWMAStream) Calculate ¶
func (s *EWMAStream) Calculate(v float64) float64
type KLineStream ¶
type KLineStream struct {
// contains filtered or unexported fields
}
func (*KLineStream) AddSubscriber ¶
func (s *KLineStream) AddSubscriber(f func(k types.KLine))
AddSubscriber adds the subscriber function and push historical data to the subscriber
func (*KLineStream) BackFill ¶
func (s *KLineStream) BackFill(kLines []types.KLine)
func (*KLineStream) EmitUpdate ¶
func (s *KLineStream) EmitUpdate(k types.KLine)
func (*KLineStream) Length ¶
func (s *KLineStream) Length() int
func (*KLineStream) OnUpdate ¶
func (s *KLineStream) OnUpdate(cb func(k types.KLine))
type KLineSubscription ¶
type KeltnerStream ¶ added in v1.57.0
type KeltnerStream struct { types.SeriesBase EWMA *EWMAStream StdDev *StdDevStream ATR *ATRStream Mid *types.Float64Series FirstUpperBand, FirstLowerBand *types.Float64Series SecondUpperBand, SecondLowerBand *types.Float64Series ThirdUpperBand, ThirdLowerBand *types.Float64Series // contains filtered or unexported fields }
func Keltner ¶ added in v1.57.0
func Keltner(source KLineSubscription, window, atrLength int) *KeltnerStream
type MACDStream ¶
type MACDStream struct { *SubtractStream FastEWMA, SlowEWMA, Signal *EWMAStream Histogram *SubtractStream // contains filtered or unexported fields }
func MACD2 ¶
func MACD2(source types.Float64Source, shortWindow, longWindow, signalWindow int) *MACDStream
type MultiplyStream ¶
type MultiplyStream struct { *types.Float64Series // contains filtered or unexported fields }
func Multiply ¶
func Multiply(a, b types.Float64Source) *MultiplyStream
type PivotHighStream ¶
type PivotHighStream struct { *types.Float64Series // contains filtered or unexported fields }
func PivotHigh ¶ added in v1.53.0
func PivotHigh(source types.Float64Source, window int, args ...int) *PivotHighStream
type PivotLowStream ¶
type PivotLowStream struct { *types.Float64Series // contains filtered or unexported fields }
func PivotLow ¶
func PivotLow(source types.Float64Source, window int, args ...int) *PivotLowStream
type PriceStream ¶
type PriceStream struct { *types.Float64Series // contains filtered or unexported fields }
func ClosePrices ¶
func ClosePrices(source KLineSubscription) *PriceStream
func HLC3 ¶
func HLC3(source KLineSubscription) *PriceStream
func HighPrices ¶
func HighPrices(source KLineSubscription) *PriceStream
func LowPrices ¶
func LowPrices(source KLineSubscription) *PriceStream
func OpenPrices ¶
func OpenPrices(source KLineSubscription) *PriceStream
func Price ¶
func Price(source KLineSubscription, mapper types.KLineValueMapper) *PriceStream
func Volumes ¶
func Volumes(source KLineSubscription) *PriceStream
func (*PriceStream) AddSubscriber ¶
func (s *PriceStream) AddSubscriber(f func(v float64))
AddSubscriber adds the subscriber function and push historical data to the subscriber
func (*PriceStream) PushAndEmit ¶
func (s *PriceStream) PushAndEmit(v float64)
type RMAStream ¶
type RMAStream struct { // embedded structs *types.Float64Series // config fields Adjust bool // contains filtered or unexported fields }
type RSIStream ¶
type RSIStream struct { // embedded structs *types.Float64Series // contains filtered or unexported fields }
type SMAStream ¶
type SMAStream struct { *types.Float64Series // contains filtered or unexported fields }
type SMMAStream ¶ added in v1.58.0
type SMMAStream struct { *types.Float64Series // contains filtered or unexported fields }
func SMMA2 ¶ added in v1.58.0
func SMMA2(source types.Float64Source, window int) *SMMAStream
func (*SMMAStream) Calculate ¶ added in v1.58.0
func (s *SMMAStream) Calculate(v float64) float64
type StdDevStream ¶
type StdDevStream struct { *types.Float64Series // contains filtered or unexported fields }
func StdDev ¶
func StdDev(source types.Float64Source, window int) *StdDevStream
func (*StdDevStream) Calculate ¶
func (s *StdDevStream) Calculate(x float64) float64
type StochStream ¶
type StochStream struct { types.SeriesBase K, D floats.Slice // contains filtered or unexported fields }
func Stoch ¶
func Stoch(source KLineSubscription, window, dPeriod int) *StochStream
Stochastic Oscillator
func (*StochStream) EmitUpdate ¶
func (S *StochStream) EmitUpdate(k float64, d float64)
func (*StochStream) OnUpdate ¶
func (S *StochStream) OnUpdate(cb func(k float64, d float64))
type SubtractStream ¶
type SubtractStream struct { *types.Float64Series // contains filtered or unexported fields }
SubtractStream subscribes 2 upstream data, and then subtract these 2 values
func Subtract ¶
func Subtract(a, b types.Float64Source) *SubtractStream
Subtract creates the SubtractStream object subtract := Subtract(longEWMA, shortEWMA)
type TRStream ¶
type TRStream struct { // embedded struct *types.Float64Series // contains filtered or unexported fields }
This TRStream calculates the ATR first
func TR2 ¶
func TR2(source KLineSubscription) *TRStream
Click to show internal directories.
Click to hide internal directories.