aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/load_refentity.py3
-rw-r--r--python/markit_red.py10
2 files changed, 6 insertions, 7 deletions
diff --git a/python/load_refentity.py b/python/load_refentity.py
index f5c998c8..4b3e2864 100644
--- a/python/load_refentity.py
+++ b/python/load_refentity.py
@@ -112,7 +112,8 @@ if __name__ == "__main__":
from markit_red import download_report
base_dir = Path('/home/serenitas/CorpCDOs/Tranche_data/RED_reports/Deltas')
for report in ['REDEntityDelta', 'REDObligationDelta']:
- f = base_dir / download_report(report)[0]
+ g = download_report(report)
+ f = base_dir / next(g)[0]
if "Entity" in report:
insert_refentity(f.as_posix())
else:
diff --git a/python/markit_red.py b/python/markit_red.py
index 1427ed1b..e9c527d2 100644
--- a/python/markit_red.py
+++ b/python/markit_red.py
@@ -10,12 +10,13 @@ from db import with_connection, dbengine
import pandas as pd
def request_payload(payload):
- r = requests.post('https://www.markit.com/export.jsp', params=payload)
+ r = requests.post('https://products.markit.com/red/export.jsp', params=payload)
res = []
path = os.path.join(os.environ['BASE_DIR'], "Tranche_data", "RED_reports")
if 'Delta' in payload['report']:
path = os.path.join(path, "Deltas")
+ breakpoint()
with zipfile.ZipFile(io.BytesIO(r.content)) as z:
for f in z.namelist():
if f.endswith("xml"):
@@ -24,7 +25,7 @@ def request_payload(payload):
return res
def download_report(report):
- version = 10 if 'Entity' in report else 9
+ version = 11 if 'Entity' in report else 10
payload = {'user': 'GuillaumeHorel',
'password': 'password',
'version': version,
@@ -87,7 +88,4 @@ if __name__ == "__main__":
# update_redindices(f[0])
# report_list = ['REDEntity', 'REDObligation', 'REDObligationPreferred']
# for report in report_list:
- # download_report(report)
- # report_list = ['REDEntityDelta', 'REDObligationDelta']
- # for report in report_list:
- # fname = download_report(report)
+ # next(download_report(report))