mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
20 lines
367 B
Go
20 lines
367 B
Go
package indicator
|
|
|
|
type MultiplyStream struct {
|
|
Float64Series
|
|
multiplier float64
|
|
}
|
|
|
|
func Multiply(source Float64Source, multiplier float64) *MultiplyStream {
|
|
s := &MultiplyStream{
|
|
Float64Series: NewFloat64Series(),
|
|
multiplier: multiplier,
|
|
}
|
|
s.Bind(source, s)
|
|
return s
|
|
}
|
|
|
|
func (s *MultiplyStream) Calculate(v float64) float64 {
|
|
return v * s.multiplier
|
|
}
|