-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
32 lines (29 loc) · 1.05 KB
/
main.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
from src.report import make_print_report, print_report
import argparse
import sys
import time
# parse the argument parser
parser = argparse.ArgumentParser(description='cli')
# add the argument
parser.add_argument('-r', '--retrieve', action='store_true', help='Increase output verbosity')
# collect the variable args
parser.add_argument('vargs', nargs=argparse.REMAINDER, help='Variable-length arguments')
# Parse the command-line arguments
args = parser.parse_args()
if __name__ == "__main__":
# we want to retrieve from prior snapshots or build a new report
if args.retrieve:
print('Retrieve mode is enabled.')
print(args.vargs)
tickers = args.vargs
start = time.time()
print_report(tickers)
end = time.time()
print('program took:',(end - start) * 1000, 'milliseconds')
else:
print('Scraping new reports')
tickers = args.vargs
start = time.time()
make_print_report(tickers)
end = time.time()
print('program took:',(end - start) * 1000, 'milliseconds')