Skip to content

Commit

Permalink
xdepthmaker: fix stats fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Mar 6, 2024
1 parent 441ebbd commit b6ddb49
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/strategy/xdepthmaker/profitfixer.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ func (f *ProfitFixer) Fix(ctx context.Context, since, until time.Time, stats *ty

allTrades = types.SortTradesAscending(allTrades)
for _, trade := range allTrades {
stats.AddTrade(trade)
position.AddTrade(trade)
profit, netProfit, madeProfit := position.AddTrade(trade)
if madeProfit {
p := position.NewProfit(trade, profit, netProfit)
stats.AddProfit(p)
}
}

log.Infof("profitFixer done: profitStats and position are updated from %d trades", len(allTrades))
Expand Down

0 comments on commit b6ddb49

Please sign in to comment.