aboutsummaryrefslogtreecommitdiffstats
path: root/python/report_ops/cash.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/report_ops/cash.py')
-rw-r--r--python/report_ops/cash.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/python/report_ops/cash.py b/python/report_ops/cash.py
index 63b43bbe..ce299896 100644
--- a/python/report_ops/cash.py
+++ b/python/report_ops/cash.py
@@ -52,11 +52,21 @@ class CashReport:
_conn: ClassVar[dbconn] = dbconn("dawndb")
_staging_queue: ClassVar[set] = set()
_insert_sql = "INSERT INTO cash_balances VALUES (%s, %s, %s, %s, %s, %s) ON CONFLICT DO NOTHING"
+ _registry = {}
def __init_subclass__(cls, fund, custodian, dtkey):
cls.fund = fund
cls.custodian = custodian
cls.dtkey = dtkey
+ cls._registry[
+ (
+ fund,
+ custodian,
+ )
+ ] = cls
+
+ def __class_getitem__(cls, key):
+ return cls._registry[key]
def to_db(self, report_name):
self.download_reports(self.date)
@@ -93,7 +103,9 @@ class CashReport:
)
-class NTCashReport(CashReport, NT, fund="ISOSEL", custodian="NT", dtkey="%Y%m%d%H%M"):
+class SeleneNTCashReport(
+ CashReport, NT, fund="ISOSEL", custodian="NT", dtkey="%Y%m%d%H%M"
+):
def to_db(self):
p = super().to_db("cash_")
df = pd.read_csv(p, on_bad_lines="warn")
@@ -107,7 +119,7 @@ class NTCashReport(CashReport, NT, fund="ISOSEL", custodian="NT", dtkey="%Y%m%d%
self._staging_queue.clear()
-class UMBCashReport(
+class SerenitasUMBCashReport(
CashReport, UMB, fund="SERCGMAST", custodian="UMB", dtkey="%Y%m%d%H%M"
):
def to_db(self):
@@ -121,7 +133,7 @@ class UMBCashReport(
self._staging_queue.clear()
-class BNYCashReport(
+class BowdstBNYCashReport(
CashReport, BNY, fund="BOWDST", custodian="BNY", dtkey="%Y%m%d%H%M%S"
):
def to_db(self):