aboutsummaryrefslogtreecommitdiffstats
path: root/python/intex_scenarios.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/intex_scenarios.py')
-rw-r--r--python/intex_scenarios.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/intex_scenarios.py b/python/intex_scenarios.py
index fbc36610..31c5d445 100644
--- a/python/intex_scenarios.py
+++ b/python/intex_scenarios.py
@@ -25,6 +25,17 @@ pattern9 = re.compile("(?P<a>SEVERITY\[\w+,\d+\]=)mkt\(70\)")
global_reinvfloatpercentage = 84
global_reinvfixedpercentage = 16
+def dealname_from_cusip(conn, cusips, distinct=False):
+ with conn.cursor() as c:
+ if distinct:
+ sqlstr = "select distinct *"
+ else:
+ sqlstr = "select * "
+ sqlstr += "from dealname_from_cusip({0})".format(",",join(["%s"]*len(cusip)))
+ c.execute(sqlstr, params = cusip)
+ dealnames = [d[0] for d in c.fetchall()]
+ return dealnames
+
def get_reinv_assets(conn, dealname, workdate):
sqlstr = 'select * from et_historicaldealinfo(%s, %s) where ReinvFlag IS TRUE'
reinvassets = query_db(conn, sqlstr, params = (dealname, workdate), one = False)