-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_all.py
43 lines (32 loc) · 1.15 KB
/
run_all.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
import datetime
import v001
import v002
import v003
import v004
output_directory = '/var/www/html/results'
results_list = []
v001.output_directory = output_directory
results_list.append(v001.check_recession_ma3())
v002.output_directory = output_directory
results_list.append(v002.check_recession_logistic())
v003.output_directory = output_directory
results_list.append(v003.check_recession_logistic_lagged())
v004.output_directory = output_directory
results_list.append(v004.check_recession_logistic_lagged_f12m())
total = 0
true_count = 0
for result in results_list:
if result is not None:
total += 1
if result:
true_count += 1
prediction = (true_count / total) >= 0.5
combined_result = 'Nope!<br>We are not in a recession :)'
if prediction:
combined_result = 'Yes!<br>We appear to be in a recession :('
with open(output_directory + '/combined_result.txt', 'w') as f:
f.write(combined_result)
# Write timestamp of update date and time.
with open(output_directory + '/timestamp2.txt', 'w') as f:
f.write('Last updated: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()))
print('Wrote timestamp to ' + output_directory)