mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
backtest: emit balance update if we got some quote back
This commit is contained in:
parent
bd8b362274
commit
4d32a578d7
|
@ -207,6 +207,7 @@ func (m *SimplePriceMatching) PlaceOrder(o types.SubmitOrder) (*types.Order, *ty
|
|||
if err := m.Account.UnlockBalance(m.Market.QuoteCurrency, amount); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
m.EmitBalanceUpdate(m.Account.Balances())
|
||||
}
|
||||
|
||||
case types.SideTypeSell:
|
||||
|
@ -215,6 +216,7 @@ func (m *SimplePriceMatching) PlaceOrder(o types.SubmitOrder) (*types.Order, *ty
|
|||
amount := order.AveragePrice.Sub(order.Price).Mul(order.Quantity)
|
||||
if amount.Sign() > 0 {
|
||||
m.Account.AddBalance(m.Market.QuoteCurrency, amount)
|
||||
m.EmitBalanceUpdate(m.Account.Balances())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user