aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/trade_dataclasses.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/python/trade_dataclasses.py b/python/trade_dataclasses.py
index 31c644db..60b232e1 100644
--- a/python/trade_dataclasses.py
+++ b/python/trade_dataclasses.py
@@ -650,20 +650,6 @@ class TerminationDeal(
"WHERE terminations.id = %s"
)
- with self._conn.cursor() as c:
- c.execute(sql_str, (self.id,))
- if self.deal_type == "SwaptionDeal":
- self.orig_cp, self.currency, self.fund, self.globeop_id = c.fetchone()
- elif self.deal_type == "CreditDefaultSwapDeal":
- (
- self.orig_cp,
- self.currency,
- self.fund,
- self.globeop_id,
- factor,
- ) = c.fetchone()
- self.termination_amount *= factor
-
def to_markit(self):
obj = self.serialize("mtm")
if obj["Initial Payment"] >= 0:
@@ -682,6 +668,20 @@ class TerminationDeal(
return obj
def to_globeop(self):
+ with self._conn.cursor() as c:
+ c.execute(sql_str, (self.id,))
+ if self.deal_type == "SwaptionDeal":
+ self.orig_cp, self.currency, self.fund, self.globeop_id = c.fetchone()
+ elif self.deal_type == "CreditDefaultSwapDeal":
+ (
+ self.orig_cp,
+ self.currency,
+ self.fund,
+ self.globeop_id,
+ factor,
+ ) = c.fetchone()
+ self.termination_amount *= factor
+
obj = self.serialize("globeop")
obj["FeesPaid"] = (
-obj["termination_fee"] if obj["termination_fee"] < 0 else None