aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/report_ops/admin.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/python/report_ops/admin.py b/python/report_ops/admin.py
index e1cf56d6..1d5079ac 100644
--- a/python/report_ops/admin.py
+++ b/python/report_ops/admin.py
@@ -22,15 +22,13 @@ class CitcoReport:
fund: Fund = None
_conn: dbconn = dbconn("dawndb")
date_cols: ClassVar = []
- file_prefix: ClassVar
- dtkey_fun: ClassVar
+ dtkey: ClassVar
_registry = {}
- def __init_subclass__(cls, table, file_prefix, date_cols, dtkey):
+ def __init_subclass__(cls, table, date_cols, dtkey):
cls.table = table
- cls.file_prefix = file_prefix
cls.date_cols = date_cols
- cls.dtkey_fun = partial(dt_from_citco, file_tag=file_prefix, dt_format=dtkey)
+ cls.dtkey = dtkey
cls._registry[table] = cls
def __class_getitem__(cls, table):
@@ -38,7 +36,6 @@ class CitcoReport:
def __post_init__(self):
self._sftp = SftpClient.from_creds("citco", folder="outgoing")
- self.file_prefix = self.file_prefix.format(fund=self.fund)
if not self.report_file_name:
raise ValueError(f"No reports for {self.table} on {self.date}")
self.knowledge_date = datetime.datetime.combine(
@@ -46,6 +43,10 @@ class CitcoReport:
)
@property
+ def dtkey_fun(self):
+ return partial(dt_from_citco, file_tag=self.file_prefix, dt_format=self.dtkey)
+
+ @property
def sftp_report_date(self):
return self.date
@@ -92,7 +93,6 @@ class CitcoReport:
class AccruedReport(
CitcoReport,
table="isosel_accrued",
- file_prefix="100502500_INNOCAP_{fund}_",
date_cols=[
"Init Date",
"Init Settle Date",
@@ -109,12 +109,19 @@ class AccruedReport(
def sftp_report_date(self):
return next_business_day(self.date)
+ @property
+ def file_prefix(self):
+ return f"100502500_INNOCAP_{self.fund}_"
+
class AllReport(
CitcoReport,
table="citco_reports",
- file_prefix="SPOS4X_INNOCAP_{fund}_D_IM.",
date_cols=["Maturity Date"],
dtkey="%Y%m%d.%H%M%S",
):
- pass
+ @property
+ def file_prefix(self):
+ return (
+ f"SPOS4X_INNOCAP_{self.fund}_D_{'IM' if self.fund =='ISOSEL' else 'IMCG'}."
+ )