diff options
Diffstat (limited to 'python/ops/trade_dataclasses.py')
| -rw-r--r-- | python/ops/trade_dataclasses.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/python/ops/trade_dataclasses.py b/python/ops/trade_dataclasses.py index 28b4dfc2..339d53bd 100644 --- a/python/ops/trade_dataclasses.py +++ b/python/ops/trade_dataclasses.py @@ -888,6 +888,7 @@ class SwaptionDeal( metadata={"insert": False, "mtm": "Swap ID", "citco": "ClientOrderID"}, ) factor: float = field(default=1.0, init=False, metadata={"insert": False}) + swap_type: str = field(default="CD_INDEX_OPTION") def __post_init__(self): # will need to filter a bit better, for now, just CDX index swaptions @@ -942,11 +943,15 @@ class SwaptionDeal( @property def product(self): return SwaptionProduct( - underlying_security_id=self.redcode, - instrument_type="BNDO", + underlying_security_id=self.redcode + if self.swap_type == "CD_INDEX_OPTION" + else _to_index[self.security_id], + instrument_type="BNDO" if self.swap_type == "CD_INDEX_OPTION" else "SWPO", callput=self.option_type == "RECEIVER", strike=self.strike, expiration=self.expiration_date, + birth_date=None if self.swap_type == "CD_INDEX_OPTION" else self.trade_date, + death_date=None if self.swap_type == "CD_INDEX_OPTION" else self.maturity, ) @@ -1275,6 +1280,14 @@ class FxSwapDeal( near_trade.citco_stage(action) obj["ClientOrderID"] = obj["ClientOrderID"] + "_F" obj["FXRate"] = 1 + warnings.warn("Repeated code, fix soon") + obj["SettlementDate"] = ( + obj["SettlementDate"].strftime("%Y%m%d") + if obj.get("SettlementDate") + else None + ) + obj["FillQty"] = obj.get("OrderQty") + obj["FillPrice"] = obj.get("AvgPrice") return obj |
