aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/trade_dataclasses.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/python/trade_dataclasses.py b/python/trade_dataclasses.py
index b54b9914..9a875478 100644
--- a/python/trade_dataclasses.py
+++ b/python/trade_dataclasses.py
@@ -1133,6 +1133,13 @@ class IRSDeal(
return obj
+from enum import IntEnum
+
+
+class TrancheType(IntEnum):
+ DayCount = 3
+
+
@dataclass
class TrancheProduct(
Deal,
@@ -1149,6 +1156,12 @@ class TrancheProduct(
death_date: datetime.date = field(
init=False, metadata={"insert": False, "citco": "Death_date"}
)
+ coupon: float = field(
+ init=False, metadata={"insert": False, "citco": "Coupon Rate"}
+ )
+ security_desc: str = field(
+ init=False, metadata={"insert": False, "citco": "Sec_Desc"}
+ )
instrument_type: str = field(default="CDS", metadata={"citco": "Instrument Type"})
underlying_id_source: str = field(
default="RED", metadata={"citco": "Underlying ID Source"}
@@ -1167,15 +1180,25 @@ class TrancheProduct(
return results.id, results.dealid, results.committed
def __post_init__(self):
- sql_str = "SELECT issue_date, maturity FROM index_version LEFT JOIN index_Maturity USING (series, INDEX) WHERE tenor='5yr' AND redindexcode=%s;"
+ sql_str = "SELECT issue_date, maturity, coupon, index, series FROM index_version LEFT JOIN index_Maturity USING (series, INDEX) WHERE tenor='5yr' AND redindexcode=%s;"
with self._conn.cursor() as c:
c.execute(sql_str, (self.underlying_security_id.removesuffix("_5"),))
- (self.birth_date, self.death_date) = c.fetchone()
+ (
+ self.birth_date,
+ self.death_date,
+ self.coupon,
+ index,
+ series,
+ ) = c.fetchone()
if results := self.get_dealid(
self.underlying_security_id, self.attach, self.detach, self._conn
):
(self.id, self.dealid, self.committed) = results
+ self.security_desc = (
+ f"{desc_str(index, series, '5')} {self.attach}-{self.detach}"
+ )
+
def to_citco(self):
if not self.id:
self.stage()
@@ -1186,3 +1209,4 @@ class TrancheProduct(
obj = self.serialize("citco")
obj["Command"] = "N"
+ obj["Coupon Rate"] = obj["Coupon Rate"] / 100