-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyfparser.py
More file actions
58 lines (52 loc) · 1.94 KB
/
yfparser.py
File metadata and controls
58 lines (52 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from yfscraper.yfisinscrapermanager import YFISINScraperManager
from yfscraper.yfdisposableisinscrapermanager import YFDisposableISINScraperManager
from yfscraper.yfanalyzer import YFAnalyzer
import csv
ISIN_FILENAME='ISIN20260116.csv'
DONE_FILENAME='done.csv'
reject_counter=1
ISIN=[]
with open(ISIN_FILENAME,'r') as csvfile:
reader=csv.reader(csvfile,delimiter=";")
for row in reader:
ISIN.append(row[0])
with open('analysis.csv','a',newline='') as csvfile:
filewriter=csv.writer(csvfile,delimiter=";")
filewriter.writerow(['ISIN',
'Ticker',
'Secteur',
'Activité',
'Website',
'Nom',
'Cours',
'VANTPA',
'Cours/VANTPA',
'Cours/VANNPA',
'Cours/VANEPA',
'Solvabilité',
'Rendement dividende %',
'FCFPA actualisés'])
for t in ISIN:
#manager=YFDisposableISINScraperManager(t)
manager=YFISINScraperManager(t,reject_counter)
if reject_counter==0:
reject_counter=1
if manager.yf_ticker!='':
try:
line=YFAnalyzer(manager).get_analyze_line()
line.insert(0,manager.yf_ticker)
line.insert(0,t)
with open('analysis.csv','a',newline='') as csvfile:
filewriter=csv.writer(csvfile,delimiter=";")
filewriter.writerow(line)
with open(DONE_FILENAME,'a',newline='') as done_csvfile:
done_csvfile.write(t+"\n")
print(line)
except:
ISIN.append(t)
reject_counter=0
else :
ISIN.append(manager.rejected_isin)
#remet à 0 le compteur tous les x
reject_counter=(reject_counter+1)%10
#YFDisposableISINScraperManager.kill_driver(manager)