-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
106 lines (75 loc) · 3.29 KB
/
app.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
from Status2.Crypto_Analytics.src.santiment_API_data import *
from Status2.Crypto_Analytics.src.Utilities import *
import dash
import dash_html_components as html
import dash_core_components as dcc
import pathlib
Config = Configuration(str(pathlib.Path(__file__).parent.absolute()) + "\config.ini")
Config.log_config(Config.get_config())
santimet_slugs = Config.getlist("COIN", "coins.main")
coin_comparisons = Config.getlist("COIN", "coins.metric_comparisons")
list_metrics = Config.getlist("METRICS", "metrics.main")
list_output_columns = Config.getlist("METRICS", "metrics.column_output")
list_metrics_comparisons = Config.getlist("METRICS", "metrics.comparisons")
list_metrics_header = Config.getlist("METRICS", "metrics.header")
metrics = dict(zip(list_metrics,list_output_columns))
metric_comparison = list_metrics_comparisons
metrics_header = dict(zip(list_metrics, list_metrics_header))
app = dash.Dash()
i = 0
children = []
df_to_update = pd.DataFrame(columns=["date", "metric", "value"])
for metric in metrics.keys():
print(metric)
[figs, df_to_update] = get_data_for_dash_from_santAPI(santimet_slugs, metric,
metrics[metric], 90, 28, df_to_update, coin_comparisons)
new_child = html.Div([
html.Div([
html.Div([
html.Div(metrics_header[metric], style={'color': 'blue', 'font-size':'300%'}),
dcc.Graph(id='g1'+ str(i), figure=figs)
], className="six columns"),
], className="row" + str(i))
])
i = i + 1
children.append(new_child)
for coin in coin_comparisons:
figs_coin_comparisons = []
df_to_update_coin = df_to_update[df_to_update.coin == coin]
i = i + 1
metric_comparison_list = []
for metric in metric_comparison:
print(metric)
try:
fig = get_data_for_DASH_vsSingleMetric_RW(df_to_update_coin, metric, 28)
figs_coin_comparisons.append(fig)
metric_comparison_list.append(metrics_header[metric])
except:
continue
figs = combine_plots_in_subplot(figs_coin_comparisons, 1, len(metric_comparison_list), metric_comparison_list)
new_child = html.Div([
html.Div([
html.Div([
html.Div(coin.capitalize() + " Metric Correlation vs Other Metrics",
style={'color': 'blue', 'font-size' : '300%'}),
dcc.Graph(id='g1' + str(i), figure=figs)
], className="six columns"),
], className="row" + str(i))
])
children.append(new_child)
#df_to_update_coin = df_to_update_coin.pivot(index="date", columns="metric", values="value")
#fig = create_heatmap_pp_score(df_to_update_coin)
#new_child2 = html.Div([
# html.Div([
# html.Div([
# html.Div("PP Score Matrix Status", style={'color': 'blue', 'font-size' : '300%'}),
# dcc.Graph(id='g1pps' + str(i), figure=fig)
# ], className="six columns"),
#
# ], className="rowg1pps")
#
# ])
#children.append(new_child2)
app.layout = html.Div(children=children)
if __name__ == '__main__':
app.run_server(debug=True, use_reloader=False)