From 8d8d9a7c596e3e2ad03ff7524cbd7e08eb33a6c5 Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 14 Jul 2022 01:18:55 +0800 Subject: [PATCH] indicator/rsi: make update callback field private --- pkg/indicator/rsi.go | 2 +- pkg/indicator/rsi_callbacks.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/indicator/rsi.go b/pkg/indicator/rsi.go index 30d8662a59..286b7b16ef 100644 --- a/pkg/indicator/rsi.go +++ b/pkg/indicator/rsi.go @@ -22,7 +22,7 @@ type RSI struct { PreviousAvgGain float64 EndTime time.Time - UpdateCallbacks []func(value float64) + updateCallbacks []func(value float64) } func (inc *RSI) Update(price float64) { diff --git a/pkg/indicator/rsi_callbacks.go b/pkg/indicator/rsi_callbacks.go index 2c1a11f661..ea795930e7 100644 --- a/pkg/indicator/rsi_callbacks.go +++ b/pkg/indicator/rsi_callbacks.go @@ -5,11 +5,11 @@ package indicator import () 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) { - for _, cb := range inc.UpdateCallbacks { + for _, cb := range inc.updateCallbacks { cb(value) } }