aboutsummaryrefslogtreecommitdiffstats
path: root/python/collateral_calc.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/collateral_calc.py')
-rw-r--r--python/collateral_calc.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/python/collateral_calc.py b/python/collateral_calc.py
index 42684581..a5cba4e3 100644
--- a/python/collateral_calc.py
+++ b/python/collateral_calc.py
@@ -18,15 +18,18 @@ def download_files(d=None):
ftp.cwd('OTC')
if d is None:
for f in ftp.nlst():
- if f.endswith("csv") and (("OTC_CASH_ACTIVITY" in f) or ("OTC_POSITIONS" in f)):
- with open(DATA_DIR / f, "wb") as fh:
- ftp.retrbinary('RETR ' + f, fh.write)
+ if f.endswith("csv"):
+ if ("OTC_CASH_ACTIVITY" in f) or \
+ ("OTC_POSITIONS" in f) or \
+ ("OTC_MARGIN" in f):
+ with open(DATA_DIR / f, "wb") as fh:
+ ftp.retrbinary('RETR ' + f, fh.write)
else:
i = 0
while i <= 20:
i +=1
file_list = ftp.nlst()
- for report_type in ["OTC_CASH_ACTIVITY", "OTC_POSITIONS"]:
+ for report_type in ["OTC_CASH_ACTIVITY", "OTC_POSITIONS", "OTC_MARGIN"]:
f = f"{d:%Y%m%d}_{report_type}.csv"
if f not in file_list:
sleep(500)