-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
20 lines (18 loc) · 863 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
import argparse
import forecast as fc
# Parse arguments
parser = argparse.ArgumentParser(description='Forecast command line')
parser.add_argument('years', help='Number of years to project', type=int)
parser.add_argument('--auto-open', help='Whether to open the HTML', action='store_true')
parser.add_argument('--include-net', help='Whether to include net worth', action='store_true')
args = parser.parse_args()
# Build forecasts
directory = os.path.join('.', 'configs')
for filename in os.listdir(directory):
extension = os.path.splitext(filename)[1][1:]
if extension not in ['yml', 'yaml'] or filename == 'sample.yaml': continue
filepath = os.path.join(directory, filename)
forecast = fc.Forecast(filepath, args.years, args.include_net).project()
fc.PlotBuilder(forecast).build(args.auto_open)
fc.CsvBuilder(forecast).build()