fix(pnl): checking the side of trade, not taker or maker

This commit is contained in:
Jui-Nan Lin 2021-02-05 14:52:38 +08:00
parent 0803d6bae0
commit c9f3b6fc1a

View File

@ -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
}