YNAB needs milliunits not cents
All checks were successful
ynab-portfolio-monitor / build (push) Successful in 50s
All checks were successful
ynab-portfolio-monitor / build (push) Successful in 50s
This commit is contained in:
@@ -52,8 +52,8 @@ func (p *Provider) GetBalances() ([]int, []string, error) {
|
||||
fileData, err := os.ReadFile(cacheFilePath)
|
||||
if err == nil {
|
||||
if err := json.Unmarshal(fileData, &data); err == nil {
|
||||
cents := int(math.Round(data.Current.TotalValueCad * 100))
|
||||
return []int{cents}, []string{p.ynabAccount}, nil
|
||||
milliUnits := int(math.Round(data.Current.TotalValueCad * 1000))
|
||||
return []int{milliUnits}, []string{p.ynabAccount}, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ func (p *Provider) GetBalances() ([]int, []string, error) {
|
||||
os.MkdirAll(filepath.Dir(cacheFilePath), 0755)
|
||||
_ = os.WriteFile(cacheFilePath, bodyBytes, 0644)
|
||||
|
||||
cents := int(math.Round(data.Current.TotalValueCad * 100))
|
||||
milliUnits := int(math.Round(data.Current.TotalValueCad * 1000))
|
||||
|
||||
return []int{cents}, []string{p.ynabAccount}, nil
|
||||
return []int{milliUnits}, []string{p.ynabAccount}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user