mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
types: fix gross profit calculation
This commit is contained in:
parent
8bfd1f7f30
commit
0ead18a95b
|
@ -194,12 +194,12 @@ func (s *ProfitStats) AddProfit(profit Profit) {
|
|||
s.TodayPnL = s.TodayPnL.Add(profit.Profit)
|
||||
s.TodayNetProfit = s.TodayNetProfit.Add(profit.NetProfit)
|
||||
|
||||
if profit.Profit.Sign() < 0 {
|
||||
if profit.Profit.Sign() > 0 {
|
||||
s.AccumulatedGrossProfit = s.AccumulatedGrossProfit.Add(profit.Profit)
|
||||
s.TodayGrossProfit = s.TodayGrossProfit.Add(profit.Profit)
|
||||
} else if profit.Profit.Sign() < 0 {
|
||||
s.AccumulatedGrossLoss = s.AccumulatedGrossLoss.Add(profit.Profit)
|
||||
s.TodayGrossLoss = s.TodayGrossLoss.Add(profit.Profit)
|
||||
} else if profit.Profit.Sign() > 0 {
|
||||
s.AccumulatedGrossProfit = s.AccumulatedGrossLoss.Add(profit.Profit)
|
||||
s.TodayGrossProfit = s.TodayGrossProfit.Add(profit.Profit)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user