diff options
Diffstat (limited to 'python/collateral_calc.py')
| -rw-r--r-- | python/collateral_calc.py | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/python/collateral_calc.py b/python/collateral_calc.py index 770ea02e..f587061b 100644 --- a/python/collateral_calc.py +++ b/python/collateral_calc.py @@ -5,7 +5,6 @@ import pandas as pd from db import dbengine from exchange import get_msgs, get_account from exchangelib import Mailbox, Message, HTMLBody -from ftplib import FTP from pathlib import Path from time import sleep from pandas.tseries.offsets import BDay @@ -20,38 +19,6 @@ def get_sftp_client(): return SFTPClient.from_transport(transport) -def download_files(d=None, - report_types=["OTC_CASH_ACTIVITY", "OTC_POSITIONS", - "OTC_MARGIN"], - retry_count=0): - if retry_count > 20: - return - DATA_DIR = DAILY_DIR / "SG_reports" - with FTP('ftp.newedgegroup.com') as ftp: - ftp.login('SerenitasGamma@USA', "SSqrrLL99") - ftp.cwd('OTC') - if d is None: - for f in ftp.nlst(): - if f.endswith("csv"): - for report_type in report_types: - if f.endswith(f"{report_type}.csv"): - with open(DATA_DIR / f, "wb") as fh: - ftp.retrbinary('RETR ' + f, fh.write) - else: - file_list = ftp.nlst() - for report_type in report_types: - f = f"{d:%Y%m%d}_{report_type}.csv" - if f not in file_list: - logging.info("File not here yet, trying again in 500s...") - logging.info(f"Try count: {retry_count}") - sleep(500) - ftp.close() - download_files(d, report_types, retry_count + 1) - else: - with open(DATA_DIR / f, "wb") as fh: - ftp.retrbinary('RETR ' + f, fh.write) - - def download_sftp_files(d=None, report_types=["OTC_CASH_ACTIVITY", "OTC_POSITIONS", "OTC_MARGIN"], |
