mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +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 {
|
for _, trade := range trades {
|
||||||
if trade.Symbol == symbol {
|
if trade.Symbol == symbol {
|
||||||
if trade.IsBuyer {
|
if trade.Side == types.SideTypeBuy {
|
||||||
bidVolume += trade.Quantity
|
bidVolume += trade.Quantity
|
||||||
bidAmount += trade.Price * trade.Quantity
|
bidAmount += trade.Price * trade.Quantity
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ func (c *AverageCostCalculator) Calculate(symbol string, trades []types.Trade, c
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.IsBuyer {
|
if t.Side == types.SideTypeBuy {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user