aboutsummaryrefslogtreecommitdiffstats
path: root/python/trade_dataclasses.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/trade_dataclasses.py')
-rw-r--r--python/trade_dataclasses.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/python/trade_dataclasses.py b/python/trade_dataclasses.py
index ecdadd86..234243ef 100644
--- a/python/trade_dataclasses.py
+++ b/python/trade_dataclasses.py
@@ -786,6 +786,30 @@ class SwaptionDeal(
def to_citco(self):
obj = self.serialize("citco")
+ obj["FillID"] = obj["ClientOrderID"]
+ obj["SecurityType"] = "BNDOPT"
+ obj["BuySellShortCover"] = "B" if obj["buysell"] == "Buy" else "S"
+ obj["Trader"] = "serenitas_trader"
+ obj["FillQty"] = obj["OrderQty"]
+ obj["FillPrice"] = obj["AvgPrice"]
+ obj["StrategyCode"] = f"{obj['portfolio']}/{obj['folder']}"
+ obj["SettleCurrency"] = obj["SecurityCurrency"]
+ obj["IDSource"] = "USERID"
+ obj["ClearingAgent"] = obj["ExecutionBroker"]
+ redcode = (
+ obj["security_id"]
+ + "_"
+ + obj["SecurityDescription"].split()[4].removesuffix("Y")
+ )
+ instrument = SwpationProduct(
+ underlying_security_id=redcode,
+ instrument="SWPO",
+ callput=obj["option_type"] == "RECEIVER",
+ strike=obj["strike"],
+ death_date=obj["expiration_date"],
+ )
+ instrument.citco_stage()
+ obj["SecurityID"] = instrument.dealid
@dataclass