add partial share ownership support (float)... and penny rounding errors.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
61074bfd80
commit
3c274c614b
@ -9,8 +9,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type security struct {
|
type security struct {
|
||||||
Symbol string `json:"symbol"`
|
Symbol string `json:"symbol"`
|
||||||
Quantity int `json:"quantity"`
|
Quantity float64 `json:"quantity"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type account struct {
|
type account struct {
|
||||||
@ -63,7 +63,7 @@ func (p *Provider) GetBalances() ([]int, []string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return balances, ynabAccountIDs, fmt.Errorf("failed to get quote for security with symbol '%s': %v", p.data.Accounts[i].Securities[j].Symbol, err)
|
return balances, ynabAccountIDs, fmt.Errorf("failed to get quote for security with symbol '%s': %v", p.data.Accounts[i].Securities[j].Symbol, err)
|
||||||
}
|
}
|
||||||
balance += price * p.data.Accounts[i].Securities[j].Quantity
|
balance += int(float64(price) * p.data.Accounts[i].Securities[j].Quantity)
|
||||||
}
|
}
|
||||||
balances = append(balances, balance)
|
balances = append(balances, balance)
|
||||||
ynabAccountIDs = append(ynabAccountIDs, p.data.Accounts[i].YnabAccountID)
|
ynabAccountIDs = append(ynabAccountIDs, p.data.Accounts[i].YnabAccountID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user