Skip to content

Commit

Permalink
fix(Portfolio): CalculateTotal -> CalculateGross while checking profits.
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelsa committed May 16, 2026
1 parent 39ca987 commit f94ea8f
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,7 @@ public BigDecimal getOwnedAmount(String symbol) {
}

public BigDecimal getProfitFromStock(String symbol) {
return getShares(symbol).stream().map(s -> {
BigDecimal total = new SaleCalculator(s).calculateTotal();
BigDecimal buyPrice = s.getQuantity().multiply(s.getPurchasePrice());

return total.subtract(buyPrice);
}).reduce(BigDecimal.ZERO, BigDecimal::add);
return getShares(symbol).stream().map(s -> s.getProfit()).reduce(BigDecimal.ZERO, BigDecimal::add);
}

public BigDecimal getChangeFromStock(String symbol) {
Expand Down

0 comments on commit f94ea8f

Please sign in to comment.