aboutsummaryrefslogtreecommitdiffstats
path: root/python/citco_ops
diff options
context:
space:
mode:
Diffstat (limited to 'python/citco_ops')
-rw-r--r--python/citco_ops/cash.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/python/citco_ops/cash.py b/python/citco_ops/cash.py
index 1dc6d49a..77401143 100644
--- a/python/citco_ops/cash.py
+++ b/python/citco_ops/cash.py
@@ -70,6 +70,10 @@ class CashReport:
key=dt_from_fname,
default=None,
)
+ if not p:
+ raise ValueError(
+ f"No reports found for fund: {self.fund} date: {self.date}"
+ )
return p
@classmethod
@@ -104,14 +108,12 @@ class IsoselCashReport(CashReport, fund="ISOSEL", account_number="ISOS01"):
csvFile.write(text)
def to_db(self):
- p = super.to_db("cash_")
- if not p:
- raise ValueError(
- f"No reports found for fund: {self.fund} date: {self.date}"
- )
+ p = super().to_db("cash_")
df = pd.read_csv(p, on_bad_lines="warn")
df = df[df["T-NARR-LONG"] == "CLOSING BALANCE"]
- df = df[["Consolidation", "Currency code", "A-TRAN-AMT", "Account name"]]
+ df = df[["Consolidation", "Currency code", "A-TRAN-AMT"]]
+ df.columns = df.columns.str.replace(" |-|_", "", regex=True).str.lower()
+ df = df.set_index(["consolidation", "currencycode"])
for row in df.itertuples():
self.stage_from_row(row)
self.commit()
@@ -150,10 +152,6 @@ class UmbCashReport(CashReport, fund="SERCGMAST", account_number="159260.1"):
def to_db(self):
p = super().to_db("umb_")
- if not p:
- raise ValueError(
- f"No reports found for fund: {self.fund} date: {self.date}"
- )
df = pd.read_excel(p, skiprows=3)
for row in (
df.groupby(["Portfolio #", "Currency"]).sum()["Current Balance"].items()