-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
48 lines (43 loc) · 1.08 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
from PyInquirer import prompt
from controllers import\
fetch_user_json,\
json_to_xlsx
from settings import reports
json_or_xlsx = [
{
'type': 'list',
'name': 'json_or_xlsx',
'message': "What would you like to run",
'choices': [
"json(Robinhood history)",
"xlsx(Excel file)",
],
}
]
type_of_report = [
{
'type': 'checkbox',
'name': 'report',
'message': "What would you like to generate?",
'choices': [
{ 'name': 'dividends' },
{ 'name': 'events' },
{ 'name': 'options' },
{ 'name': 'orders' },
]
}
]
def run():
generate_json_or_xlsx = prompt(json_or_xlsx)
generate_json_or_xlsx_answer = generate_json_or_xlsx["json_or_xlsx"]
report = prompt(type_of_report)
report_answers = report["report"]
if generate_json_or_xlsx_answer == 'xlsx(Excel file)':
for answer in report_answers:
json_to_xlsx.run(answer)
elif generate_json_or_xlsx_answer == 'json(Robinhood history)':
for answer in report_answers:
fetch_user_json.run(reports[answer])
return True
if __name__ == '__main__':
run()