aboutsummaryrefslogtreecommitdiffstats
path: root/python/mtm_status.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/mtm_status.py')
-rw-r--r--python/mtm_status.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/python/mtm_status.py b/python/mtm_status.py
index 35899940..37a4f506 100644
--- a/python/mtm_status.py
+++ b/python/mtm_status.py
@@ -14,7 +14,7 @@ def latest(f):
return f.removesuffix(".csv.zip").rsplit("_", 1)[-1]
-def run(conn, date):
+def get_latest_file(date):
try:
sftp = SftpClient.from_creds("mtm")
except (
@@ -35,6 +35,12 @@ def run(conn, date):
with sftp.client.open(f"outbound/{target_file}") as sftp_handle:
with ZipFile(sftp_handle).open(target_file.removesuffix(".zip")) as zip_handle:
df = pd.read_csv(zip_handle, skiprows=2, na_filter=False)
+
+ return df
+
+
+def run(conn, date):
+ df = get_latest_file(date)
df = df[
(df["SwapType"].isin(["NEW", "ASGM", "TERM"]))
& (df["ThirdPartyStatus.1"].isin(["Confirmed"]))