From c9f3b6fc1ab2f7d2cb5229c5ca22353d945ba842 Mon Sep 17 00:00:00 2001 From: Jui-Nan Lin Date: Fri, 5 Feb 2021 14:52:38 +0800 Subject: [PATCH] fix(pnl): checking the side of trade, not taker or maker --- pkg/accounting/pnl/avg_cost.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/accounting/pnl/avg_cost.go b/pkg/accounting/pnl/avg_cost.go index f05f49533..7848170c5 100644 --- a/pkg/accounting/pnl/avg_cost.go +++ b/pkg/accounting/pnl/avg_cost.go @@ -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 }