-
Notifications
You must be signed in to change notification settings - Fork 35
/
try_enricher.py
executable file
·58 lines (46 loc) · 1.25 KB
/
try_enricher.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
#!/usr/bin/env python3
"""
Download Stock OLHC data from Yahoo Finance and generate stats
Usage:
$ ./try_enricher.py --help
$ ./try_enricher.py --symbol TSLA
"""
from argparse import ArgumentParser
import matplotlib.pyplot as plt
import pandas as pd
from common import RawTextWithDefaultsFormatter
from common.analyst import fetch_data_on_demand
from common.logger import setup_logging
plt.ioff()
pd.set_option("display.max_columns", None)
pd.set_option("display.width", None)
def parse_args():
parser = ArgumentParser(
description=__doc__, formatter_class=RawTextWithDefaultsFormatter
)
parser.add_argument(
"-v",
"--verbose",
action="count",
default=0,
dest="verbose",
help="Increase verbosity of logging output",
)
parser.add_argument(
"-s",
"--symbol",
type=str,
default="TSLA",
help="Stock symbol (default: TSLA)",
)
return parser.parse_args()
def main(args):
ticker = args.symbol
data, ticker_df = fetch_data_on_demand(ticker)
key_values = list([(k, data[k]) for k in data.keys()])
for kv in key_values:
print(kv)
if __name__ == "__main__":
args = parse_args()
setup_logging(args.verbose)
main(args)