diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/trade_dataclasses.py | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/python/trade_dataclasses.py b/python/trade_dataclasses.py index ead475cb..e80e40d4 100644 --- a/python/trade_dataclasses.py +++ b/python/trade_dataclasses.py @@ -831,22 +831,20 @@ class FxSwapDeal( @dataclass class TRSDeal( - MTMDeal, + # MTMDeal, Deal, deal_type=DealType.TRS, table_name="trs", insert_ignore=("id", "dealid", "orig_cp", "currency", "product_type"), ): - id: int = field(default=None, metadata={"insert": False}) - dealid: str = field(default=None, metadata={"insert": False, "mtm": "Swap ID"}) fund: str = field( metadata={"mtm": "Account Abbreviation"}, ) - portfolio: str - folder: str + portfolio: str = field(metadata={"globeop": "Portfolio"}) + folder: str = field(metadata={"globeop": "Strategy"}) cash_account: str - cp_code: str - trade_date: datetime.date + cp_code: str = field(metadata={"globeop": "Counterparty"}) + trade_date: datetime.date = field(metadata={"globeop": "TradeDate"}) effective_date: datetime.date maturity_date: datetime.date funding_index: str @@ -861,13 +859,17 @@ class TRSDeal( asset_freq: str asset_daycount: str asset_payment_roll_convention: str - initial_margin_percentage: float + initial_margin_percentage: float = field( + metadata={"globeop": "InitialMarginPercent"} + ) notional: float currency: str interest_calc_method: str compound_avg_frequency: str fixing_frequency: str cpty_id: str + id: int = field(default=None, metadata={"insert": False}) + dealid: str = field(default=None, metadata={"insert": False, "mtm": "Swap ID"}) def to_globeop(self): obj = self.serialize("globeop") @@ -878,35 +880,36 @@ class TRSDeal( d = { f"{key1}LegRateType": "Floating", f"{key1}Underlying": "Interest", - f"{key1}FloatRate": line["funding_index"], + f"{key1}FloatRate": obj["funding_index"], f"{key1}FixedRate": 0, - f"{key1}Daycount": line["funding_daycount"], - f"{key1}Frequency": line["funding_freq"], + f"{key1}Daycount": obj["funding_daycount"], + f"{key1}Frequency": obj["funding_freq"], + f"{key1}EffectiveDate": obj["effective_date"], + f"{key1}MaturityDate": obj["maturity_date"], + f"{key1}Notional": obj["notional"], f"{key1}PaymentBDC": obj["funding_payment_roll_convention"], f"{key1}Arrears": obj["funding_arrears"], f"{key1}InterestCalc": obj["interest_calc_method"], f"{key1}Compound": obj["compound_avg_frequency"], + f"{key1}Currency": obj["currency"], f"{key1}Fixing": obj["fixing_frequency"], f"{key2}LegRateType": "Fixed", f"{key2}Underlying": "Bond", - f"{key2}FloatRate": line["underlying_security"], - f"{key2}DayCount": line["asset_daycount"], - f"{key2}Frequency": line["asset_freq"], + f"{key2}FloatRate": obj["underlying_security"], + f"{key2}DayCount": obj["asset_daycount"], + f"{key2}Frequency": obj["asset_freq"], + f"{key2}EffectiveDate": obj["effective_date"], + f"{key2}MaturityDate": obj["maturity_date"], + f"{key2}Notional": obj["notional"], f"{key2}PaymentBDC": obj["asset_payment_roll_convention"], f"{key2}Price": obj["price"], + f"{key2}Currency": obj["currency"], } - obj["swap_type"] = "TOTAL_RETURN_SWAP" - obj["TerminationAmount"] *= self.factor - obj["FeesPaid"] = ( - -obj["termination_fee"] if obj["termination_fee"] < 0 else None - ) - obj["FeesReceived"] = ( - obj["termination_fee"] if obj["termination_fee"] > 0 else None - ) - obj["Action"] = "UPDATE" - obj["Client"] = _client_name[obj["fund"]] - obj["SubAction"] = "Termination" - if self.termination_cp != self.orig_cp: - obj["AssignedCounterparty"] = self.termination_cp - obj["PartialTermination"] = "Y" if self.partial_termination else "N" + obj["SwapType"] = "TOTAL_RETURN_SWAP" + obj["DealType"] = "TotalReturnSwapDeal" + obj["Action"] = "NEW" # Need to figure this out + obj["Client"] = "Serenitas" + obj["State"] = "Valid" + obj["Custodian"] = "BAC" + obj.update(d) return obj |
