aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/trade_dataclasses.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/python/trade_dataclasses.py b/python/trade_dataclasses.py
index 2aaa4ba0..734b4060 100644
--- a/python/trade_dataclasses.py
+++ b/python/trade_dataclasses.py
@@ -22,6 +22,7 @@ from lru import LRU
from psycopg.errors import UniqueViolation
import logging
from serenitas.utils.remote import FtpClient, SftpClient
+from pyisda.date import previous_twentieth
logger = logging.getLogger(__name__)
@@ -945,7 +946,7 @@ class TRSDeal(
funding_index: str
buysell: bool
underlying_security: str
- price: float
+ price: float = field(metadata={"mtm": "Initial Fixing Amount"})
accrued: float = field(metadata={"mtm": "Initial Payment"})
funding_freq: str
funding_daycount: str
@@ -973,6 +974,7 @@ class TRSDeal(
def to_markit(self):
_trs_red = {"IBOXHY": "4J623JAA8"}
+ _mtm_index = {"SOFRRATE": "USD-SOFR-COMPOUND"}
obj = self.serialize("mtm")
obj["Trade ID"] = obj["Swap ID"]
obj["Initial Payment Currency"] = obj["Currency Code"]
@@ -987,6 +989,15 @@ class TRSDeal(
obj["Protection"] = "Buy" if obj["buysell"] else "Sell"
obj["Master Document Date"] = datetime.date(2020, 12, 18)
obj["Supplement Date"] = datetime.date(2015, 2, 18)
+ obj["Product Type"] = self.product_type
+ obj["Independent Amount Payer"] = obj["Account Abbreviation"]
+ obj["2nd Leg Index"] = _mtm_index[obj["funding_index"]]
+ obj["2nd Leg Spread"] = 0
+ obj["2nd Leg Initial Floating Rate"] = obj["Initial Payment"] / (
+ (obj["Effective Date"] - previous_twentieth(obj["Effective Date"])).days
+ * obj["1st Leg Notional"]
+ / 360
+ )
return obj
def to_admin(self):