diff --git a/caotek_mesavoirs/models/portfolio.py b/caotek_mesavoirs/models/portfolio.py index f781425..a2a498b 100644 --- a/caotek_mesavoirs/models/portfolio.py +++ b/caotek_mesavoirs/models/portfolio.py @@ -149,11 +149,7 @@ def get_dividends(ticker): nb = len(ticker.dividends) for i in range(nb): d += ticker.dividends[nb - 1 - i] - # cas particulier - elif ticker.info.get('symbol') == 'VUSA.AS': - d = 0.889311 / 1.1 # convertir en EUR - elif ticker.info.get('symbol') == 'VJPN.AS': - d = 0.56836 / 1.1 + return d diff --git a/caotek_mesavoirs/views/portfolio.py b/caotek_mesavoirs/views/portfolio.py index b4c7e7d..0223c48 100644 --- a/caotek_mesavoirs/views/portfolio.py +++ b/caotek_mesavoirs/views/portfolio.py @@ -90,7 +90,10 @@ def portfolio(request): for item in actifs: total_valeur += item.valeur total_pv += item.plus_value - total_pc_value = total_pv / total_valeur * 100 + if total_valeur == 0: + total_pc_value + else: + total_pc_value = total_pv / total_valeur * 100 total_rdt += item.rendement # lire l'historique