aboutsummaryrefslogtreecommitdiffstats
path: root/python/tasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/tasks.py')
-rw-r--r--python/tasks.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/python/tasks.py b/python/tasks.py
index e842343c..e8db6d26 100644
--- a/python/tasks.py
+++ b/python/tasks.py
@@ -1,8 +1,23 @@
import subprocess
from intex_scenarios import generate_scenarios
+import os
-def build_portfolio(dealname):
- pass
+if os.name =='nt':
+ root = "//WDsentinel/share/CorpCDOs"
+elif os.name == 'posix':
+ root = '/home/share/CorpCDOs'
-def build_scenario(dealname):
- pass
+Rpath = os.path.join(root, "code", "R")
+logpath = os.path.join(root, "logs")
+
+def build_portfolio(workdate, dealname, reinvflag):
+ args = ["Rscript", "--vanilla", os.path.join(Rpath, "build_portfolios.R"), \
+ workdate, dealname + "," + reinvflag]
+ with open(os.path.join(logpath, "build_portfolios.Rout"), "w") as fh:
+ subprocess.call(args, stderr = subprocess.STDOUT, stdout = fh)
+
+def build_scenarios(workdate, dealname, reinvflag):
+ args = ["Rscript", "--vanilla", os.path.join(Rpath, "build_scenarios.R"), \
+ workdate, dealname + "," + reinvflag]
+ with open(os.path.join(logpath, "build_scenarios.Rout"), "w") as fh:
+ subprocess.call(args, stderr = subprocess.STDOUT, stdout = fh)