added SWR

This commit is contained in:
2022-06-09 17:08:40 +02:00
parent f97e03204f
commit ee46c0d9b0
6 changed files with 57 additions and 10 deletions

View File

@@ -52,9 +52,9 @@
<td class="text-right">${layout.to_percent(member.pf_plusvalue_pc, 1)}</td> <td class="text-right">${layout.to_percent(member.pf_plusvalue_pc, 1)}</td>
</tr> </tr>
<tr> <tr>
<td>Rendemant brut</td> <td>Safe Withdrawal Rate</td>
<td class="text-right">${layout.to_euro(member.pf_rendement)}</td> <td class="text-right text-success"><b>${layout.to_euro(swr_amount)}</b></td>
<td class="text-right">${layout.to_percent(member.pf_rdt_pc, 1)}</td> <td class="text-right text-success"><b>${layout.to_percent(swr_rate, 1)}</b></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -107,7 +107,6 @@
<th class="text-right">Valeur</th> <th class="text-right">Valeur</th>
<th class="text-right">+/- Valeur</th> <th class="text-right">+/- Valeur</th>
<th class="text-right">% de +/-</th> <th class="text-right">% de +/-</th>
<th class="text-right">Rdt brut</th>
<th class="text-right">% TER</th> <th class="text-right">% TER</th>
<th class="text-right">% PF</th> <th class="text-right">% PF</th>
</tr> </tr>
@@ -125,7 +124,6 @@
<td tal:condition="ligne.plus_value <0" class="text-right" style="color: red;">${layout.to_euro(ligne.plus_value)}</td> <td tal:condition="ligne.plus_value <0" class="text-right" style="color: red;">${layout.to_euro(ligne.plus_value)}</td>
<td tal:condition="ligne.pc_plusvalue>=0" class="text-right" style="color: green;">${ligne.pc_plusvalue}</td> <td tal:condition="ligne.pc_plusvalue>=0" class="text-right" style="color: green;">${ligne.pc_plusvalue}</td>
<td tal:condition="ligne.pc_plusvalue <0" class="text-right" style="color: red;">${ligne.pc_plusvalue}</td> <td tal:condition="ligne.pc_plusvalue <0" class="text-right" style="color: red;">${ligne.pc_plusvalue}</td>
<td class="text-right">${layout.to_euro(ligne.rendement)}</td>
<td class="text-right">${layout.zero2space(ligne.ter)}</td> <td class="text-right">${layout.zero2space(ligne.ter)}</td>
<td class="text-right">${ligne.pc_allocation}</td> <td class="text-right">${ligne.pc_allocation}</td>
</tr> </tr>
@@ -136,7 +134,6 @@
<td tal:condition="total_pv>=0" class="text-right" style="color: green;"><b>${layout.to_euro(total_pv)}</b></td> <td tal:condition="total_pv>=0" class="text-right" style="color: green;"><b>${layout.to_euro(total_pv)}</b></td>
<td tal:condition="total_pv <0" class="text-right" style="color: red;"><b>${layout.to_euro(total_pv)}</b></td> <td tal:condition="total_pv <0" class="text-right" style="color: red;"><b>${layout.to_euro(total_pv)}</b></td>
<td class="text-right"><b>${layout.to_percent(total_pc_value, 1)}</b></td> <td class="text-right"><b>${layout.to_percent(total_pc_value, 1)}</b></td>
<td class="text-right"><b>${layout.to_euro(total_rdt)}</b></td>
<td></td> <td></td>
<td class="text-right"><b>100.0</b></td> <td class="text-right"><b>100.0</b></td>
</tr> </tr>

View File

@@ -21,7 +21,6 @@ import hashlib
import imaplib import imaplib
from sqlalchemy.exc import DBAPIError from sqlalchemy.exc import DBAPIError
from ..security import groupfinder
import json import json

View File

@@ -50,6 +50,7 @@ def portfolio(request):
# totaliser les pourcentages # totaliser les pourcentages
total += item.pc_cible total += item.pc_cible
swr_rate = 3.5
if total != 100: if total != 100:
message = 'Attention, le total de votre répartition cible est incorrect : %s.' % total message = 'Attention, le total de votre répartition cible est incorrect : %s.' % total
@@ -111,7 +112,9 @@ def portfolio(request):
'total_valeur': total_valeur, 'total_valeur': total_valeur,
'total_pv': total_pv, 'total_pv': total_pv,
'total_pc_value': total_pc_value, 'total_pc_value': total_pc_value,
'total_rdt': total_rdt 'total_rdt': total_rdt,
'swr_rate' : swr_rate,
'swr_amount': float(member.pf_valeur) * swr_rate / 100,
} }
@view_config(route_name='actif_edit', renderer='../templates/portfolio/actif_edit.pt', permission='view') @view_config(route_name='actif_edit', renderer='../templates/portfolio/actif_edit.pt', permission='view')

View File

@@ -21,7 +21,6 @@ pyramid.includes =
sqlalchemy.url = mysql://root:phuoc!@localhost/bd_mesavoirs?charset=utf8 sqlalchemy.url = mysql://root:phuoc!@localhost/bd_mesavoirs?charset=utf8
caotek_mesavoirs.admin_email = cao.thien-phuoc@orange.fr caotek_mesavoirs.admin_email = cao.thien-phuoc@orange.fr
# Mailer configuration # Mailer configuration
mail.host = smtp.orange.fr mail.host = smtp.orange.fr
mail.port = 25 mail.port = 25

50
email_avnes_purge.py Normal file
View File

@@ -0,0 +1,50 @@
# -*- coding: utf8 -*-
#
# Compter les emails BEFORE DATE
#
from pprint import pprint
import datetime
import imaplib
# connecter au serveur IMAP
conn = imaplib.IMAP4_SSL('mail.gandi.net')
conn.login('bureau@avnes.org', 'ConCho#56')
# lister les dossiers
typ, data = conn.list()
print('Liste des dossiers :')
pprint(data)
# delete mails before 14 years
before_date = (datetime.date.today() - datetime.timedelta(365.25 * 13)).strftime("%d-%b-%Y")
print("Delete emails before " + before_date)
# select ALL
conn.select('INBOX')
rv, data = conn.search(None, '(BEFORE {0})'.format(before_date))
nb_mails = str(len(data[0]))
print(nb_mails + " emails founded")
resp = input ("Enter 'c' to continue, or 'a' to abort : ")
if resp=="c":
print("Moving " + nb_mails + " emails to Trash")
messages = data[0].split(b' ')
for mail in messages:
# move to trash
conn.store(mail, '+X-GM-LABELS', '\\Trash')
#This block empties trash, remove if you want to keep, Gmail auto purges trash after 30 days.
print("Emptying Trash & Expunge...")
conn.select('[Gmail]/Corbeille')
conn.store("1:*", '+FLAGS', '\\Deleted')
# delete all the selected messages
conn.expunge()
print("Script completed")
else:
print("Script aborted")
# deconnexion du serveur
conn.close()
conn.logout()

View File

@@ -21,7 +21,6 @@ sqlalchemy.url = mysql://phuoc:phuoc!@localhost/bd_mesavoirs?charset=utf8
sqlalchemy.pool_recycle = 3600 sqlalchemy.pool_recycle = 3600
caotek_mesavoirs.admin_email = phuoc@caotek.fr caotek_mesavoirs.admin_email = phuoc@caotek.fr
# Mailer configuration # Mailer configuration
mail.host = localhost mail.host = localhost
mail.port = 25 mail.port = 25