aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/citco_ce_tranche.py12
1 files changed, 1 insertions, 11 deletions
diff --git a/python/citco_ce_tranche.py b/python/citco_ce_tranche.py
index f8bdfff1..be6ca373 100644
--- a/python/citco_ce_tranche.py
+++ b/python/citco_ce_tranche.py
@@ -4,17 +4,7 @@ from serenitas.utils.db import dbconn
from serenitas.ops.trade_dataclasses import CDSDeal
from serenitas.ops.funds import Service
-
-def calculate_attach_detach(redcode, orig_attach, orig_detach, conn):
- with conn.cursor() as c:
- c.execute(
- "SELECT indexfactor, cumulativeloss FROM index_factors WHERE redindexcode=%s",
- (redcode,),
- )
- (factor, cumulativeloss) = c.fetchone()
- detach = factor * min(max((orig_detach - cumulativeloss) / factor, 0), 1)
- attach = factor * min(max((orig_attach - cumulativeloss) / factor, 0.0), 1.0)
- return attach, detach
+from globeop_ce_tranche import calculate_attach_detach
def upload_citco_products(index, affected_series, fund, event_date, conn, event_name):