aboutsummaryrefslogtreecommitdiffstats
path: root/python/collateral/baml_fcm.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/collateral/baml_fcm.py')
-rw-r--r--python/collateral/baml_fcm.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/python/collateral/baml_fcm.py b/python/collateral/baml_fcm.py
index d6a676f8..b6bfddfb 100644
--- a/python/collateral/baml_fcm.py
+++ b/python/collateral/baml_fcm.py
@@ -1,25 +1,13 @@
-from . import DAILY_DIR
+from . import DAILY_DIR, SftpClient
from .common import compare_notionals, STRATEGY_CASH_MAPPING
-from paramiko import Transport, SFTPClient, RSAKey
-import os.path
+from functools import partial
import pandas as pd
from sqlalchemy.exc import IntegrityError
-def get_sftp_client():
- transport = Transport(("ftps.b2b.ml.com", 22))
- pkey = RSAKey.from_private_key_file(os.path.expanduser("~/.ssh/id_rsa_lmcg"))
- transport.connect(username="lmcginvs", pkey=pkey)
- return SFTPClient.from_transport(transport)
+sftp = SftpClient.from_creds("baml_fcm")
-
-def download_files(d=None):
- DATA_DIR = DAILY_DIR / "BAML_reports"
- sftp = get_sftp_client()
- for f in sftp.listdir("outgoing"):
- local_file = DATA_DIR / f
- if not local_file.exists():
- sftp.get(f"outgoing/{f}", localpath=DATA_DIR / f)
+download_files = partial(sftp.download_files, "outgoing", DAILY_DIR / "BAML_reports")
def collateral(d, positions, engine):