améliore le calcul des dividendes des actions

This commit is contained in:
2019-12-23 10:37:15 +01:00
parent e80543a956
commit 8fa45a59fe
4 changed files with 19 additions and 14 deletions

View File

@@ -333,7 +333,7 @@ CREATE TABLE `members` (
LOCK TABLES `members` WRITE;
/*!40000 ALTER TABLE `members` DISABLE KEYS */;
INSERT INTO `members` VALUES ('ctphuoc@gmail.com','CAO ','Thien Phuoc',167622.74,2031.82,1.2,4034.82,2.4,0.0,'a12ecaa430207687ad18a72564609d4f313184bd',NULL,NULL,'ADMIN',NULL,'2017-07-23 08:08:31','2017-10-01 19:02:35','2017-10-01 20:40:02'),('phuoc@caotek.fr','MEMBER','Lambda-One',0.00,NULL,NULL,NULL,NULL,0.0,'a12ecaa430207687ad18a72564609d4f313184bd',NULL,NULL,'MEMBRE',NULL,'2017-07-23 08:35:47','2017-07-23 06:38:28','2017-07-23 08:38:28'),('toa.armorial@gmail.com','CAO ','Thien-An',0.00,NULL,NULL,NULL,NULL,0.0,'a12ecaa430207687ad18a72564609d4f313184bd',NULL,NULL,'ADMIN',NULL,'2017-07-22 17:18:51','2017-07-26 08:31:49','2017-07-26 10:31:49');
INSERT INTO `members` VALUES ('ctphuoc@gmail.com','CAO ','Thien Phuoc',167622.74,2031.82,1.2,4034.82,2.4,0.0,'a12ecaa430207687ad18a72564609d4f313184bd',NULL,NULL,'ADMIN',NULL,'2017-07-23 08:08:31','2017-10-01 19:02:35','2017-10-01 20:40:02'),('cao.thien-phuoc@orange.fr','MEMBER','Lambda-One',0.00,NULL,NULL,NULL,NULL,0.0,'a12ecaa430207687ad18a72564609d4f313184bd',NULL,NULL,'MEMBRE',NULL,'2017-07-23 08:35:47','2017-07-23 06:38:28','2017-07-23 08:38:28'),('toa.armorial@gmail.com','CAO ','Thien-An',0.00,NULL,NULL,NULL,NULL,0.0,'a12ecaa430207687ad18a72564609d4f313184bd',NULL,NULL,'ADMIN',NULL,'2017-07-22 17:18:51','2017-07-26 08:31:49','2017-07-26 10:31:49');
/*!40000 ALTER TABLE `members` ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;

View File

@@ -140,5 +140,21 @@ def delete_histo(request, no_id):
query = "DELETE FROM histo WHERE no_id = :no_id ;"
execute_query(request, query, {'no_id': no_id})
def get_dividends(ticker):
d = 0
# le ticker a des dividendes ?
if len(ticker.dividends) > 0:
# oui, cumuler les dividendes sur un an
h = ticker.history(period="1y")
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

View File

@@ -263,14 +263,3 @@ monaa.caotek.fr
mailer.send_immediately(message)
def get_dividends(ticker):
d = 0
# le ticker a des dividendes ?
if len(ticker.dividends) > 0:
# oui, cumuler les dividendes sur un an
h = ticker.history(period="1y")
nb = len(ticker.dividends)
for i in range(nb):
d += ticker.dividends[nb - 1 - i]
return d

View File

@@ -20,10 +20,10 @@ pyramid.includes =
sqlalchemy.url = mysql://phuoc:phuoc!@localhost/bd_mesavoirs?charset=utf8
caotek_mesavoirs.admin_email = phuoc@caotek.fr
caotek_mesavoirs.admin_email = cao.thien-phuoc@orange.fr
# Mailer configuration
mail.host = smtp.free.fr
mail.host = smtp.orange.fr
mail.port = 25
[server:main]