mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
indicator/rsi: make update callback field private
This commit is contained in:
parent
b2538b6960
commit
8d8d9a7c59
|
@ -22,7 +22,7 @@ type RSI struct {
|
||||||
PreviousAvgGain float64
|
PreviousAvgGain float64
|
||||||
|
|
||||||
EndTime time.Time
|
EndTime time.Time
|
||||||
UpdateCallbacks []func(value float64)
|
updateCallbacks []func(value float64)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (inc *RSI) Update(price float64) {
|
func (inc *RSI) Update(price float64) {
|
||||||
|
|
|
@ -5,11 +5,11 @@ package indicator
|
||||||
import ()
|
import ()
|
||||||
|
|
||||||
func (inc *RSI) OnUpdate(cb func(value float64)) {
|
func (inc *RSI) OnUpdate(cb func(value float64)) {
|
||||||
inc.UpdateCallbacks = append(inc.UpdateCallbacks, cb)
|
inc.updateCallbacks = append(inc.updateCallbacks, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (inc *RSI) EmitUpdate(value float64) {
|
func (inc *RSI) EmitUpdate(value float64) {
|
||||||
for _, cb := range inc.UpdateCallbacks {
|
for _, cb := range inc.updateCallbacks {
|
||||||
cb(value)
|
cb(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user