balances can accept delta pushes for FAST
This commit is contained in:
@@ -9,6 +9,20 @@ type Balances map[string]Balance
|
||||
|
||||
type Balance map[Currency]float64
|
||||
|
||||
func (balances Balances) Push(d Delta) {
|
||||
if _, ok := balances[d.Name]; !ok {
|
||||
balances[d.Name] = make(Balance)
|
||||
}
|
||||
balances[d.Name].Push(d)
|
||||
}
|
||||
|
||||
func (balance Balance) Push(d Delta) {
|
||||
if _, ok := balance[d.Currency]; !ok {
|
||||
balance[d.Currency] = 0
|
||||
}
|
||||
balance[d.Currency] += d.Value
|
||||
}
|
||||
|
||||
func (balances Balances) Debug() string {
|
||||
result := []string{}
|
||||
for k, v := range balances {
|
||||
|
||||
Reference in New Issue
Block a user