fixed error Decimal.DivisionByZero

This commit is contained in:
2022-12-17 06:27:46 +01:00
parent da4a5cdda8
commit 897acb9521
2 changed files with 5 additions and 6 deletions

View File

@@ -149,11 +149,7 @@ def get_dividends(ticker):
nb = len(ticker.dividends) nb = len(ticker.dividends)
for i in range(nb): for i in range(nb):
d += ticker.dividends[nb - 1 - i] 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 return d

View File

@@ -90,6 +90,9 @@ def portfolio(request):
for item in actifs: for item in actifs:
total_valeur += item.valeur total_valeur += item.valeur
total_pv += item.plus_value total_pv += item.plus_value
if total_valeur == 0:
total_pc_value
else:
total_pc_value = total_pv / total_valeur * 100 total_pc_value = total_pv / total_valeur * 100
total_rdt += item.rendement total_rdt += item.rendement