aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/analytics/index_data.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/python/analytics/index_data.py b/python/analytics/index_data.py
index 1b652b92..c59ea23a 100644
--- a/python/analytics/index_data.py
+++ b/python/analytics/index_data.py
@@ -148,13 +148,14 @@ def get_singlenames_quotes(indexname, date):
conn = dbconn('serenitasdb')
with conn.cursor() as c:
c.execute("SELECT * FROM curve_quotes(%s, %s)", vars=(indexname, date))
- return [r for r in c]
+ return list(c)
-def build_curve(r, tenors, currency="USD"):
+def build_curve(r, tenors, currency="USD", recovery_curve=None):
spread_curve = 1e-4 * np.array(r['spread_curve'], dtype='float')
upfront_curve = 1e-2 * np.array(r['upfront_curve'], dtype='float')
- recovery_curve = np.array(r['recovery_curve'], dtype='float')
+ if recovery_curve is None:
+ recovery_curve = np.array(r['recovery_curve'], dtype='float')
yc = get_curve(r['date'], currency)
try:
sc = SpreadCurve(r['date'], yc, None, None, None,
@@ -183,7 +184,10 @@ def _get_singlenames_curves(index_type, series, trade_date, tenors):
sn_quotes = get_singlenames_quotes(f"{index_type.lower()}{series}",
trade_date)
currency = "EUR" if index_type in ["XO", "EU"] else "USD"
- args = (np.array(tenors), currency)
+ # we strip curves with a fixed recovery rate
+ # need to figure out how to do it right
+ recovery = np.full(len(tenors), 0.3) if index_type == "HY" else np.full(len(tenors), 0.4)
+ args = (np.array(tenors), currency, recovery)
return build_curves_dist(sn_quotes, args)