-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdashboard.py
executable file
·56 lines (48 loc) · 1.2 KB
/
dashboard.py
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
#!/usr/bin/env python3
"""
Dashboard
Copyright (c) 2020-2023 Nicolas Beguier
Licensed under the MIT License
Written by Nicolas BEGUIER (nicolas_beguier@hotmail.com)
"""
# Standard library imports
import sys
# Third party library imports
from tabulate import tabulate
# Own library
from lib import reporting
try:
import settings
except ImportError:
print('You need to specify a settings.py file.')
print('$ cp settings.py.sample settings.py')
sys.exit(1)
# Debug
# from pdb import set_trace as st
VERSION = '3.0.0'
def main():
"""
Main function
"""
listing = []
for isin in settings.ISIN_DASHBOARD:
market = 'XPAR'
if ',' in isin:
market = isin.split(',')[1]
isin = isin.split(',', maxsplit=1)[0]
isin_data = reporting.get_cours(isin, market, disable_cache=True)
if not isin_data:
listing.append([])
continue
listing.append([
isin_data['DISPLAY_NAME']['v'],
isin_data['LVAL_NORM']['v'],
isin_data['NC2_PR_NORM']['v'],
])
print(tabulate(listing, [
'Nom',
'Cours',
'Variation',
]))
if __name__ == '__main__':
main()