aboutsummaryrefslogtreecommitdiffstats
path: root/python/analytics/tranche_basket.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/analytics/tranche_basket.py')
-rw-r--r--python/analytics/tranche_basket.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index 26dfd437..b8db1183 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -291,6 +291,20 @@ class DualCorrTranche():
names=['spread_shock', 'corr_shock']))
def mark(self, **args):
+ if self.index_type == "BS":
+ return
+ sql_query = ("SELECT close_spread from index_quotes_pre "
+ "WHERE date=%s and index=%s and series=%s and "
+ "tenor=%s and source=%s")
+ conn = serenitas_engine.raw_connection()
+ with conn.cursor() as c:
+ c.execute(sql_query, (self.value_date, self.index_type, self.series,
+ self.tenor, args.get("source", "MKIT")))
+ params = (self.value_date, self.index_type, self.series,
+ self.tenor, args.get("source", "MKIT"))
+ spread, = c.fetchone()
+ self._index.tweak([spread])
+
if 'skew' in args:
el, skew_fun = args['skew']
K_index_eq = np.clip(el/-self.index_pv().protection_leg * self.K, None, .999)
@@ -301,7 +315,6 @@ class DualCorrTranche():
"WHERE a.index=%s AND a.series=%s AND a.tenor=%s "
"AND quotedate::date=%s "
"AND (a.detach = %s OR a.attach = %s) ORDER BY a.attach")
- conn = serenitas_engine.raw_connection()
with conn.cursor() as c:
c.execute(sql_string, (self.index_type, self.series,
self.tenor, self.value_date,
@@ -318,7 +331,7 @@ class DualCorrTranche():
self._tranche_id = tranche_id
except UnboundLocalError:
pass
- conn.close()
+ conn.close()
def jump_to_default(self, skew):
curves = self._index.curves