diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/cash_reports.py | 4 | ||||
| -rw-r--r-- | python/citco_ops/cash.py | 20 |
2 files changed, 4 insertions, 20 deletions
diff --git a/python/cash_reports.py b/python/cash_reports.py index e0d997ae..19affd6f 100644 --- a/python/cash_reports.py +++ b/python/cash_reports.py @@ -1,4 +1,4 @@ -from citco_ops.cash import NTCashReport, UmbCashReport +from citco_ops.cash import NTCashReport, UMBCashReport import datetime from serenitas.analytics.dates import prev_business_day import logging @@ -16,7 +16,7 @@ if __name__ == "__main__": help="work date", ) args = parser.parse_args() - for report_cls in (NTCashReport, UmbCashReport): + for report_cls in (NTCashReport, UMBCashReport): report = report_cls(args.date) try: report.to_db() diff --git a/python/citco_ops/cash.py b/python/citco_ops/cash.py index 29f73fee..092dbb7d 100644 --- a/python/citco_ops/cash.py +++ b/python/citco_ops/cash.py @@ -8,7 +8,7 @@ import pandas as pd from serenitas.utils.db import dbconn, dawn_engine from typing import ClassVar from .misc import get_dir, dt_from_fname -from .custodians import NT +from .custodians import NT, UMB @dataclass @@ -104,23 +104,7 @@ class NTCashReport(CashReport, NT, fund="ISOSEL", account_number="ISOS01"): ) -class UmbCashReport(CashReport, fund="SERCGMAST", account_number="159260.1"): - @classmethod - def download_reports(cls, date=datetime.date.today()): - em = ExchangeMessage() - for msg in em.get_msgs(count=20, path=["NYops", "Powerstation"]): - for attach in msg.attachments: - timestamp = attach.last_modified_time - if ( - attach.name.startswith("cash_reporting") - and timestamp.date() == date - ): - dest = get_dir(timestamp.date(), archived=False) - dest.mkdir(exist_ok=True, parents=True) - p = dest / f"umb_{timestamp:%Y%m%d%H%M}.xlsx" - if not p.exists(): - p.write_bytes(attach.content) - +class UMBCashReport(CashReport, UMB, fund="SERCGMAST", account_number="159260.1"): def to_db(self): p = super().to_db("umb_") df = pd.read_excel(p, skiprows=3) |
