add partial share ownership support (float)... and penny rounding errors.
This commit is contained in:
		@@ -9,8 +9,8 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type security struct {
 | 
			
		||||
	Symbol   string `json:"symbol"`
 | 
			
		||||
	Quantity int    `json:"quantity"`
 | 
			
		||||
	Symbol   string  `json:"symbol"`
 | 
			
		||||
	Quantity float64 `json:"quantity"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type account struct {
 | 
			
		||||
@@ -63,7 +63,7 @@ func (p *Provider) GetBalances() ([]int, []string, error) {
 | 
			
		||||
			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)
 | 
			
		||||
			}
 | 
			
		||||
			balance += price * p.data.Accounts[i].Securities[j].Quantity
 | 
			
		||||
			balance += int(float64(price) * p.data.Accounts[i].Securities[j].Quantity)
 | 
			
		||||
		}
 | 
			
		||||
		balances = append(balances, balance)
 | 
			
		||||
		ynabAccountIDs = append(ynabAccountIDs, p.data.Accounts[i].YnabAccountID)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user