From 6eaaf4ffd7e3ea2d41e2eda608a350912e08ece0 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Mon, 6 Jan 2025 18:55:21 +0000 Subject: [PATCH] TaxCalculator: Fix calculation of gain/loss Fixes #31. --- src/investir/taxcalculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/investir/taxcalculator.py b/src/investir/taxcalculator.py index ea53b56..8332b3e 100644 --- a/src/investir/taxcalculator.py +++ b/src/investir/taxcalculator.py @@ -266,7 +266,7 @@ def get_holdings_table( weight: Decimal | None = None if holding_value := holding2value.get(isin): - gain_loss = holding.cost - holding_value + gain_loss = holding_value - holding.cost weight = holding_value / portfolio_value * 100 table.add_row(