mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KLineEvent struct {
|
type KLineEvent struct {
|
||||||
|
@ -80,7 +81,7 @@ func (k KLine) GetMaxChange() float64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k KLine) GetThickness() 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 {
|
func (k KLine) GetChange() float64 {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user