mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
fix(pnl): checking the side of trade, not taker or maker
This commit is contained in:
parent
0803d6bae0
commit
c9f3b6fc1a
|
@ -36,7 +36,7 @@ func (c *AverageCostCalculator) Calculate(symbol string, trades []types.Trade, c
|
|||
|
||||
for _, trade := range trades {
|
||||
if trade.Symbol == symbol {
|
||||
if trade.IsBuyer {
|
||||
if trade.Side == types.SideTypeBuy {
|
||||
bidVolume += trade.Quantity
|
||||
bidAmount += trade.Price * trade.Quantity
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ func (c *AverageCostCalculator) Calculate(symbol string, trades []types.Trade, c
|
|||
continue
|
||||
}
|
||||
|
||||
if t.IsBuyer {
|
||||
if t.Side == types.SideTypeBuy {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user