This repository was archived by the owner on Oct 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.py
129 lines (118 loc) · 3.44 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objs as go
import pandas as pd
import plotly.offline as pyo
df = pd.read_json('Yahoo_Financials.json')
company_list = []
evaluation_marker_list = []
values_list = []
USERNAME_PASSWORD = ['Yahoofinance', '007']
def populate_company_list():
for company in df:
company_list.append(company)
def populate_value_list():
for company in df:
values_list.append(df[company]['Valuation Measures']['Trailing P/E'])
def populate_marker_list():
for company in df:
for marker in df[company]['Valuation Measures']:
evaluation_marker_list.append(marker)
print(evaluation_marker_list)
app = dash.Dash()
auth = dash_auth.BasicAuth(app,USERNAME_PASSWORD_PAIRS)
app.layout = html.Div([
html.Div(
dcc.Graph(
id='T-PE',
figure={
'data': [
{'x': company_list, 'y': [df[company]['Valuation Measures']['Trailing P/E'] for company in df],
'type': 'bar'}
],
'layout': {
'title': 'Trailing P/E'
}
}
),
),
html.Div(
dcc.Graph(
id='F-PE',
figure={
'data': [
{'x': company_list, 'y': [df[company]['Valuation Measures']['Forward P/E'] for company in df],
'type': 'bar'}
],
'layout': {
'title': 'Forward P/E'
}
}
)
),
html.Div(
dcc.Graph(
id='Op-Margin',
figure={
'data': [
{'x': company_list,
'y': [df[company]['Management Effectiveness']['Operating Margin'] for company in df],
'type': 'bar'}
],
'layout': {
'title': 'Operating Margin'
}
}
),
),
html.Div(
dcc.Graph(
id='return-equity',
figure={
'data': [
{'x': company_list,
'y': [df[company]['Income Statement']['Return on Equity'] for company in df], 'type': 'bar'}
],
'layout': {
'title': 'Return on Equity'
}
}
),
),
html.Div(
dcc.Graph(
id='EBITDA',
figure={
'data': [
{'x': company_list,
'y': [df[company]['Income Statement']['EBITDA'] for company in df], 'type': 'bar'}
],
'layout': {
'title': 'EBITDA'
}
}
),
),
html.Div(
dcc.Graph(
id='operating_cash_flow',
figure={
'data': [
{'x': company_list,
'y': [df[company]['Cash Flow Statement']['Operating Cash Flow'] for company in df], 'type': 'bar'}
],
'layout': {
'title': 'Operating Cash Flow'
}
}
)
),
],
style={'width': '60%', 'height': '50%', 'display': 'inline-block'})
if __name__ == '__main__':
populate_company_list()
populate_marker_list()
populate_value_list()
app.run_server()