aboutsummaryrefslogtreecommitdiffstats
path: root/python/report_ops
diff options
context:
space:
mode:
Diffstat (limited to 'python/report_ops')
-rw-r--r--python/report_ops/cash.py91
1 files changed, 0 insertions, 91 deletions
diff --git a/python/report_ops/cash.py b/python/report_ops/cash.py
index 3b9dc7a1..2550b316 100644
--- a/python/report_ops/cash.py
+++ b/python/report_ops/cash.py
@@ -1,6 +1,3 @@
-from dataclasses import field, dataclass
-from serenitas.ops.trade_dataclasses import Deal, Fund
-from serenitas.ops.headers import DealType
from serenitas.analytics.dates import prev_business_day
import datetime
import pandas as pd
@@ -10,94 +7,6 @@ from .misc import get_dir, dt_from_fname
from .custodians import NT, UMB, BNY
from functools import partial
-_bowdst_iam_cp = {
- "BAML_ISDA": "BOANNY",
- "CS": "CSITLN",
- "GS": "GOLINY",
- "BNP": "BNPBNY",
- "MS": "MSCILN",
- "JPM": "JPCBNY",
- "GS_FCM": "GOLDNY",
-}
-
-_serenitas_iam_cp = {
- "BAML_ISDA": "BAMSNY",
- "CS": "CSFBBO",
- "GS": "GOLDNY",
- "BNP": "BNPBNY",
- "MS": "MSCSNY",
- "JPM": "JPCBNY",
- "GS_FCM": "GOLDNY",
-}
-
-
-def get_counterparty(fund, iam_broker):
- match fund:
- case "SERCGMAST":
- return _serenitas_iam_cp[iam_broker]
- case "BOWDST":
- return _bowdst_iam_cp[iam_broker]
-
-
-def get_custodian_account(fund, iam_broker):
- match fund, iam_broker:
- case ("SERCGMAST", "WF_FCM"):
- return ("WELLSFCM", "WFNSCLMFCM")
- case ("SERCGMAST", "BAML_FCM"):
- return ("BOMLCM", "V0NSCLMFCM")
- case ("BOWDST", "GS_FCM"):
- return ("GS", "057363418ICE-CDS")
- case ("SERCGMAST", _):
- return ("UMB", "159260.1")
- case ("BOWDST", _):
- return ("BNY", "751254")
-
-
-@dataclass
-class IAMDeal(Deal, deal_type=DealType.IAM, table_name="iams"):
- trade_date: datetime.date = field(metadata={"globeop": "Trade Date"})
- folder: str = field(metadata={"globeop": "Folder"})
- broker: str
- start_money: float = field(metadata={"globeop": "StartMoney"})
- currency: str = field(metadata={"globeop": "Currency"})
- fund: Fund = field(metadata={"globeop": "Fund"})
- maturity: datetime.date = field(
- default=None, metadata={"globeop": "ExpirationDate"}
- )
- uploaded: bool = False
- is_offset: bool = False
- id: int = field(default=None, metadata={"insert": False})
- dealid: str = field(
- default=None,
- metadata={
- "insert": False,
- "globeop": "Deal Id",
- },
- )
- cash_account: str = field(
- default=None,
- metadata={"insert": False, "select": False, "globeop": "Cash Account"},
- )
- custodian: str = field(default=None, metadata={"insert": False, "select": False})
-
- def to_globeop(self, action):
- obj = super().to_globeop(action)
- obj["Deal Type"] = "IamDeal"
- obj["CallNoticeIndicator"] = "24H" if action == "NEW" else None
- obj["TransactionIndicator"] = "DEPOSIT" if obj["StartMoney"] > 0 else "LOAN"
- obj["StartMoney"] = abs(obj["StartMoney"])
- obj["DealFunction"] = "OTC"
- obj["MarginType"] = "Variation"
- obj["Basis"] = "ACT/360"
- obj["SettlementDate"] = self.trade_date
- (custodian, cash_account) = get_custodian_account(self.fund, self.broker)
- obj = obj | {
- "Custodian": custodian,
- "Cash Account": cash_account,
- "Counterparty": get_counterparty(self.fund, self.broker),
- }
- return obj
-
@dataclass
class CashReport: