diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/report_ops/misc.py | 1 | ||||
| -rw-r--r-- | python/report_ops/wires.py | 21 |
2 files changed, 15 insertions, 7 deletions
diff --git a/python/report_ops/misc.py b/python/report_ops/misc.py index b49d62f9..0cd5657c 100644 --- a/python/report_ops/misc.py +++ b/python/report_ops/misc.py @@ -1,5 +1,6 @@ import pathlib import datetime +from typing import Literal from serenitas.utils.env import DAILY_DIR from serenitas.utils.exchange import ExchangeMessage diff --git a/python/report_ops/wires.py b/python/report_ops/wires.py index c5cce66f..23599adf 100644 --- a/python/report_ops/wires.py +++ b/python/report_ops/wires.py @@ -12,8 +12,6 @@ from serenitas.utils.env import DAILY_DIR from .misc import get_dir, dt_from_fname, CUSTODIAN -_nt_to_currency = {"EURO - EUR": "EUR", "U.S. DOLLARS - USD": "USD"} - @dataclass class WireReport(Deal, table_name="custodian_wires", deal_type="custodian_wires"): @@ -74,7 +72,6 @@ class BNYWireReport(WireReport, custodian="BNY", dtkey="%Y%m%d%H%M%S"): def from_report_line(cls, line: dict): return cls( date=line["Report Run Date"], - fund=line["fund"], entry_date=line["Cash Entry Date"], value_date=line["Cash Value Date"], pay_date=line["Settle / Pay Date"], @@ -84,6 +81,8 @@ class BNYWireReport(WireReport, custodian="BNY", dtkey="%Y%m%d%H%M%S"): if line["Transaction Type Code"] == "CW" else line["Transaction Description 2"], unique_ref=line["Reference Number"], + fund=line["fund"], + custodian=cls.custodian, ) @classmethod @@ -99,14 +98,15 @@ class NTWireReport(WireReport, custodian="NT", dtkey="%Y%m%d%H%M"): def from_report_line(cls, line: dict): return cls( date=line["Through date"], - fund=line["fund"], entry_date=line["D-GL-POST"], value_date=line["D-TRAN-EFF"], pay_date=line["D-TRAN-EFF"], - currency=_nt_to_currency[line["N-GL-AC30"]], + currency=cls.nt_to_enum[line["N-GL-AC30"]], amount=line["Net amount - local"], wire_details=line["narrative"], unique_ref=line["C-EXTL-SYS-TRN-DSC-3"], + fund=line["fund"], + custodian=cls.custodian, ) @classmethod @@ -118,13 +118,17 @@ class NTWireReport(WireReport, custodian="NT", dtkey="%Y%m%d%H%M"): if "sponsor" in line["narrative"].lower(): yield line + @classmethod + def nt_to_enum(cls, ccy): + _mapping = {"EURO - EUR": "EUR", "U.S. DOLLARS - USD": "USD"} + return _mapping[ccy] + class UMBWireReport(WireReport, custodian="UMB", dtkey="%Y%m%d%H%M"): @classmethod def from_report_line(cls, line: dict): return cls( date=line["Transaction Date"], - fund=line["fund"], entry_date=line["Transaction Date"], value_date=line["Transaction Date"], pay_date=line["Transaction Date"], @@ -132,6 +136,8 @@ class UMBWireReport(WireReport, custodian="UMB", dtkey="%Y%m%d%H%M"): amount=line["Net Amount"], wire_details=line["Transaction Description"], unique_ref=f'{line["Transaction Date"]}-{line["index"]}', + fund=line["fund"], + custodian=cls.custodian, ) @classmethod @@ -164,7 +170,6 @@ class SCOTIAWireReport(WireReport, custodian="SCOTIA", dtkey=None): def from_report_line(cls, line: dict): return cls( date=line["Value Date"], - fund=line["fund"], entry_date=line["Posting Date"], value_date=line["Value Date"], pay_date=line["Value Date"], @@ -172,6 +177,8 @@ class SCOTIAWireReport(WireReport, custodian="SCOTIA", dtkey=None): amount=line["Cr Amount"] if line["Dr/Cr"] == "Cr" else -line["Dr Amount"], wire_details=line["Reference Data"], unique_ref=line["Bank Ref."], + fund=line["fund"], + custodian=cls.custodian, ) @classmethod |
