diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/trade_dataclasses.py | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/python/trade_dataclasses.py b/python/trade_dataclasses.py index 37671553..933c6812 100644 --- a/python/trade_dataclasses.py +++ b/python/trade_dataclasses.py @@ -489,8 +489,8 @@ class CitcoProduct(Citco): if results := c.fetchone(): (self.id, self.dealid, self.committed) = results - @classmethod - def to_citco(cls, obj): + def to_citco(self): + obj = self.serialize("citco") obj["Birth_date"] = obj["Birth_date"].strftime("%Y%m%d") obj["Death_date"] = obj["Death_date"].strftime("%Y%m%d") return obj @@ -500,8 +500,8 @@ class CitcoTrade(Citco): _citco_queue: ClassVar[list] = [] _citco_headers = GTL - @classmethod - def to_citco(cls, obj): + def to_citco(self): + obj = self.serialize("citco") obj["FillID"] = obj["ClientOrderID"] obj["Trader"] = "DFLT" obj["StrategyCode"] = f"{obj['portfolio']}/{obj['folder']}" @@ -592,7 +592,7 @@ class CDSDeal( return obj def to_citco(self): - obj = self.serialize("citco") + obj = super().to_citco() obj["SecurityType"] = "CDS" obj["BuySellShortCover"] = "B" if obj["protection"] == "Buy" else "S" obj["Trader"] = "DFLT" @@ -626,7 +626,7 @@ class CDSDeal( obj[ "ClearingAgent" ] = "BOA_FC" # We need to query DB via accounts table here - obj = super().to_citco(obj) + obj = super().to_citco() return obj @classmethod @@ -761,7 +761,7 @@ class BondDeal( return cls def to_citco(self): - obj = self.serialize("citco") + obj = super().to_citco() obj["SecurityType"] = "CMO" obj["ClearingAgent"] = "NT" obj["FXRate"] = 1 @@ -775,7 +775,6 @@ class BondDeal( (obj["SecurityID"],), ) obj["Coupon%"], obj["DayCountFraction/RepoCalendar"] = c.fetchone() - obj = super().to_citco(obj) return obj @@ -851,7 +850,7 @@ class SwaptionDeal( return obj def to_citco(self): - obj = self.serialize("citco") + obj = super().to_citco() obj["ExecutionBroker"] = _citco_cp_isda[obj["ExecutionBroker"]] obj["ClearingAgent"] = obj["ExecutionBroker"] obj["SecurityType"] = "BNDOPT" @@ -873,7 +872,7 @@ class SwaptionDeal( ) instrument.citco_stage() obj["SecurityID"] = instrument.dealid - obj = super().to_citco(obj) + obj = super().to_citco() return obj @@ -1059,7 +1058,7 @@ class SpotDeal( ) def to_citco(self): - obj = self.serialize("citco") + obj = super().to_citco() if obj["buy_currency"] == "USD": key1, key2 = "sell", "buy" else: @@ -1075,7 +1074,7 @@ class SpotDeal( obj["FillFXSettleAmount"] = obj[f"{key2}_amount"] obj["SettleCurrency"] = "USD" obj["FXRate"] = 1 - obj = super().to_citco(obj) + obj = super().to_citco() return obj @@ -1167,7 +1166,7 @@ class FxSwapDeal( ) def to_citco(self): - obj = self.serialize("citco") + obj = super().to_citco() if obj["near_buy_currency"] == "USD": # This is for strict FX Swaps key1, key2 = "buy", "sell" else: @@ -1202,7 +1201,7 @@ class FxSwapDeal( obj["ClientOrderID"] = obj["ClientOrderID"] + "_F" obj["SettleCurrency"] = "USD" obj["FXRate"] = 1 - obj = super().to_citco(obj) + obj = super().to_citco() return obj @@ -1345,7 +1344,7 @@ class TRSDeal( return obj def to_citco(self): - obj = self.serialize("citco") + obj = super().to_citco() obj["ExecutionBroker"] = _citco_cp_isda[obj["ExecutionBroker"]] obj["ClearingAgent"] = obj["ExecutionBroker"] obj["SecurityType"] = "TRS" @@ -1472,7 +1471,7 @@ class IRSDeal( return obj def to_citco(self): - obj = self.serialize("citco") + obj = super().to_citco() obj["ExecutionBroker"] = _citco_cp_cdea[obj["ExecutionBroker"]] obj["SecurityType"] = "IRS" obj["StrategyCode"] = f"{obj['portfolio']}/{obj['folder']}" @@ -1489,7 +1488,7 @@ class IRSDeal( product.citco_stage() obj["SecurityID"] = product.dealid obj["ClearingAgent"] = "BOA_FC" - obj = super().to_citco(obj) + obj = super().to_citco() return obj @@ -1565,13 +1564,12 @@ class TrancheProduct( self.stage() self.commit() self.get_productid() - obj = self.serialize("citco") + obj = super().to_citco() obj["Command"] = "N" obj["Active"] = "Y" obj["CouponRate"] = obj["CouponRate"] / 100 obj["SettleDays"] = 3 obj["AccruStartDate"] = obj["Birth_date"] - obj = super().to_citco(obj) return obj @@ -1642,7 +1640,7 @@ class SwaptionProduct( self.stage() self.commit() self.get_productid() - obj = self.serialize("citco") + obj = super().to_citco() if self.underlying_id_source == "USERID": irs = IRSProduct( birth_date=self.birth_date, @@ -1657,7 +1655,6 @@ class SwaptionProduct( obj["ExpirationDate"] = obj["ExpirationDate"].strftime("%Y%m%d") obj["Put/CallFlag"] = "C" if obj["callput"] else "P" obj["OptionType"] = "Vanilla European" - obj = super().to_citco(obj) return obj @@ -1727,7 +1724,7 @@ class IRSProduct( self.commit() self.get_productid() - obj = self.serialize("citco") + obj = super().to_citco() d = { "S_P_CurrencyCode": self.currency, "S_P_PaymentFreqID": _citco_frequency[self.fixed_payment_freq], @@ -1800,7 +1797,7 @@ class TRSProduct( self.commit() self.get_productid() - obj = self.serialize("citco") + obj = super().to_citco() d = { f"S_P_CurrencyCode": self.currency, f"S_P_PaymentFreqID": _citco_frequency[self.funding_freq], @@ -1827,5 +1824,5 @@ class TRSProduct( obj["GeneralDirection"] = "F" obj["PrincipalExchTypeID"] = 3 obj["UnderlyingIDSource"] = "RED" - obj = super().to_citco(obj) + obj = super().to_citco() return obj |
