diff options
| -rw-r--r-- | python/monitor.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/python/monitor.py b/python/monitor.py index a40ad0ee..0bcdf37e 100644 --- a/python/monitor.py +++ b/python/monitor.py @@ -7,21 +7,21 @@ from intex_scenarios import generate_scenarios Rpath = os.path.join(common.root, "code", "R") logpath = os.path.join(common.root, "logs") -cusipsfile = os.path.join(common.root, "scripts", "cusips_to_price.txt") -scenariosfile = os.path.join(common.root, "scripts", "scenarios.txt") +dealsfile = os.path.join(common.root, "scripts", "deals_to_price.txt") + args1 = ["Rscript", "--vanilla", os.path.join(Rpath, "build_portfolios.R")] args2 = ["Rscript", "--vanilla", os.path.join(Rpath, "build_scenarios.R")] + while True: workdate = str(datetime.date.today()) - if os.path.exists(cusipsfile): + if os.path.exists(dealsfile): + with open(os.path.join(dealsfile)) as fh: + dealnames = [line.split("\t")[0] for line in fh] with open(os.path.join(logpath, "build_portfolios.Rout"), "w") as fh: - p = subprocess.Popen(args1, stderr = subprocess.STDOUT, stdout = fh) - if os.path.exists(scenariosfile): - with open(scenariosfile) as fh: - dealnames = [line.split(" ")[0] for line in fh] + subprocess.call(args1, stderr = subprocess.STDOUT, stdout = fh) with open(os.path.join(logpath, "build_scenarios.Rout"), "w") as fh: - p = subprocess.Popen(args2, stderr = subprocess.STDOUT, stdout = fh) - p.wait() - generate_scenarios(workdate, dealnames) + subprocess.call(args2, stderr = subprocess.STDOUT, stdout = fh) + for dealname in dealnames: + generate_scenarios(common.conn, workdate, dealname) time.sleep(3) common.conn.close() |
