fix: use math.Abs to calculate change

This commit is contained in:
c9s 2020-06-09 19:33:44 +08:00
parent c30c4e9937
commit 71098c9f8b

View File

@ -2,6 +2,7 @@ package bbgo
import (
"fmt"
"math"
)
type KLineEvent struct {
@ -80,7 +81,7 @@ func (k KLine) GetMaxChange() float64 {
}
func (k KLine) GetThickness() float64 {
return k.GetChange() / k.GetMaxChange()
return math.Abs(k.GetChange()) / math.Abs(k.GetMaxChange())
}
func (k KLine) GetChange() float64 {