mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
fix: use math.Abs to calculate change
This commit is contained in:
parent
c30c4e9937
commit
71098c9f8b
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user