mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
common/math: Add math.Abs to PercentageDifference calculation (#1617)
* fix bug and add decimal calc * pew pew * Update common/math/math.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits * nits: plus change name convention * gk: nits and splits --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -1049,10 +1049,10 @@ func (m *DataHistoryManager) CheckCandleIssue(job *DataHistoryJob, multiplier in
|
||||
}
|
||||
if apiData != dbData {
|
||||
var diff float64
|
||||
if apiData > dbData {
|
||||
diff = gctmath.CalculatePercentageGainOrLoss(apiData, dbData)
|
||||
if apiData < dbData {
|
||||
diff = gctmath.PercentageChange(apiData, dbData)
|
||||
} else {
|
||||
diff = gctmath.CalculatePercentageGainOrLoss(dbData, apiData)
|
||||
diff = gctmath.PercentageChange(dbData, apiData)
|
||||
}
|
||||
if diff > job.IssueTolerancePercentage {
|
||||
issue = fmt.Sprintf("%s api: %v db: %v diff: %v %%", candleField, apiData, dbData, diff)
|
||||
|
||||
Reference in New Issue
Block a user