diff options
Diffstat (limited to 'python/report_ops/wires.py')
| -rw-r--r-- | python/report_ops/wires.py | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/python/report_ops/wires.py b/python/report_ops/wires.py index b4076784..297d5e58 100644 --- a/python/report_ops/wires.py +++ b/python/report_ops/wires.py @@ -9,7 +9,6 @@ from serenitas.ops.trade_dataclasses import Deal, Ccy from serenitas.analytics.dates import prev_business_day from serenitas.utils.env import DAILY_DIR -from .custodians import NT, BNY, UMB, SCOTIA from .misc import get_dir, dt_from_fname _nt_to_currency = {"EURO - EUR": "EUR", "U.S. DOLLARS - USD": "USD"} @@ -18,9 +17,8 @@ CUSTODIAN = Literal["UMB", "NT", "BNY"] @dataclass -class Wire(Deal, table_name="custodian_wires", deal_type="custodian_wires"): +class WireReport(Deal, table_name="custodian_wires", deal_type="custodian_wires"): date: datetime.date - fund: ClassVar[CUSTODIAN] custodian: ClassVar[str] entry_date: datetime.date value_date: datetime.date @@ -31,19 +29,13 @@ class Wire(Deal, table_name="custodian_wires", deal_type="custodian_wires"): unique_ref: str dtkey: ClassVar = field(metadata={"insert": False, "select": False}) - def __init_subclass__(cls, fund, custodian, dtkey, **kwargs): + def __init_subclass__(cls, custodian, dtkey, **kwargs): cls._sql_insert = ( cls._sql_insert.removesuffix("RETURNING *") + "ON CONFLICT (unique_ref) DO NOTHING RETURNING *" ) - cls.fund = fund cls.custodian = custodian - cls._registry[ - ( - fund, - custodian, - ) - ] = cls + cls._registry[custodian] = cls cls.dtkey = dtkey def __post_init__(self): @@ -67,7 +59,7 @@ class Wire(Deal, table_name="custodian_wires", deal_type="custodian_wires"): return p -class BowdstBNYWire(Wire, BNY, fund="BOWDST", custodian="BNY", dtkey="%Y%m%d%H%M%S"): +class BNYWireReport(WireReport, custodian="BNY", dtkey="%Y%m%d%H%M%S"): @classmethod def from_report_line(cls, line: dict): return cls( @@ -93,7 +85,7 @@ class BowdstBNYWire(Wire, BNY, fund="BOWDST", custodian="BNY", dtkey="%Y%m%d%H%M cls.commit() -class SeleneNTWire(Wire, NT, fund="ISOSEL", custodian="NT", dtkey="%Y%m%d%H%M"): +class NTWireReport(WireReport, custodian="NT", dtkey="%Y%m%d%H%M"): @classmethod def from_report_line(cls, line: dict): return cls( @@ -118,9 +110,7 @@ class SeleneNTWire(Wire, NT, fund="ISOSEL", custodian="NT", dtkey="%Y%m%d%H%M"): cls.commit() -class SerenitasUMBWire( - Wire, UMB, fund="SERCGMAST", custodian="UMB", dtkey="%Y%m%d%H%M" -): +class UMBWireReport(WireReport, custodian="UMB", dtkey="%Y%m%d%H%M"): @classmethod def from_report_line(cls, line: dict): return cls( @@ -159,7 +149,7 @@ class SerenitasUMBWire( cls.commit() -class SeleneSCOTIAWire(Wire, SCOTIA, fund="ISOSEL", custodian="SCOTIA", dtkey=None): +class SCOTIAWireReport(WireReport, custodian="SCOTIA", dtkey=None): @classmethod def from_report_line(cls, line: dict): return cls( |
