diff options
Diffstat (limited to 'python/report_ops')
| -rw-r--r-- | python/report_ops/cash.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/python/report_ops/cash.py b/python/report_ops/cash.py index e8f8d0cb..30795850 100644 --- a/python/report_ops/cash.py +++ b/python/report_ops/cash.py @@ -1,5 +1,6 @@ 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 @@ -53,19 +54,24 @@ def get_custodian_account(fund, iam_broker): @dataclass -class IAMDeal(Deal, deal_type=None, table_name="iam_tickets"): +class IAMDeal(Deal, deal_type=DealType.IAM, table_name="iams"): trade_date: datetime.date = field(metadata={"globeop": "SettlementDate"}) folder: str = field(metadata={"globeop": "Folder"}) broker: str - # counterparty: str = field(metadata={"globeop": "Counterparty"}) start_money: float = field(metadata={"globeop": "StartMoney"}) currency: str = field(metadata={"globeop": "Currency"}) fund: Fund maturity: datetime.date = None uploaded: bool = False - booked_offset: bool = False - dealid: str = None - id: int = None + 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"}, @@ -75,21 +81,18 @@ class IAMDeal(Deal, deal_type=None, table_name="iam_tickets"): def to_globeop(self, action): obj = super().to_globeop(action) obj["Deal Type"] = "IamDeal" - obj["ExpirationDate"] = self.trade_date if self.action == "UPDATE" else None - obj["CallNoticeIndicator"] = "24H" if self.action == "NEW" else None + obj["ExpirationDate"] = self.trade_date if action == "UPDATE" else None + obj["CallNoticeIndicator"] = "24H" if action == "NEW" else None obj["TransactionIndicator"] = ("DEPOSIT" if obj["StartMoney"] > 0 else "LOAN",) obj["StartMoney"] = abs(obj["StartMoney"]) - obj["Folder"] = ( - "M_CSH_CASH" if obj["strategy"] == "CSH_CASH" else obj["strategy"] - ) obj["DealFunction"] = "OTC" obj["MarginType"] = "Variation" obj["Basis"] = "ACT/360" - (custodian, cash_account) = get_custodian_account(fund, self.broker) + (custodian, cash_account) = get_custodian_account(self.fund, self.broker) obj = obj | { "Custodian": custodian, "Cash Account": cash_account, - "Counterparty": get_counterparty(fund, self.broker), + "Counterparty": get_counterparty(self.fund, self.broker), } return obj |
