mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
fix(pnl): do not calculate the "self" trade
This commit is contained in:
parent
30f085fa91
commit
b38b65ce83
|
@ -37,7 +37,7 @@ func (c *AverageCostCalculator) Calculate(symbol string, trades []types.Trade, c
|
|||
|
||||
for _, trade := range trades {
|
||||
if trade.Symbol == symbol {
|
||||
if trade.Side == types.SideTypeBuy {
|
||||
if trade.IsBuyer && trade.Side != types.SideTypeSelf {
|
||||
bidVolume += trade.Quantity
|
||||
bidAmount += trade.Price * trade.Quantity
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ func (c *AverageCostCalculator) Calculate(symbol string, trades []types.Trade, c
|
|||
continue
|
||||
}
|
||||
|
||||
if t.Side == types.SideTypeBuy {
|
||||
if t.IsBuyer || t.Side == types.SideTypeSelf {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user