aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/markit/__main__.py10
-rw-r--r--python/markit/loans.py13
2 files changed, 22 insertions, 1 deletions
diff --git a/python/markit/__main__.py b/python/markit/__main__.py
index 8d881365..f20ce9ca 100644
--- a/python/markit/__main__.py
+++ b/python/markit/__main__.py
@@ -6,7 +6,13 @@ import os
import time
from .cds import download_cds_data, download_composite_data
-from .loans import download_facility, insert_facility, download_marks, update_facility
+from .loans import (
+ download_facility,
+ insert_facility,
+ download_marks,
+ update_facility,
+ download_recupdates,
+)
from .rates import downloadMarkitIRData
from .import_quotes import insert_cds, insert_index, insert_tranche
from pandas.tseries.offsets import BDay
@@ -70,6 +76,8 @@ if args.loans:
payload.pop("RELATIVEVERSION")
update_facility(workdate, payload)
logger.info("facility updated")
+ download_recupdates(workdate, payload)
+ logger.info("recommanded updates downloaded")
elif args.cds:
payload = {
diff --git a/python/markit/loans.py b/python/markit/loans.py
index 5eae5334..f4fa4a21 100644
--- a/python/markit/loans.py
+++ b/python/markit/loans.py
@@ -20,6 +20,19 @@ def download_facility(workdate, payload):
fh.write(r.content)
+def download_recupdates(workdate, payload):
+ r = requests.post(
+ "https://loans.markit.com/loanx/LoanXRecUpdates.csv", params=payload
+ )
+ facility_rec_update = os.path.join(
+ os.environ["DATA_DIR"],
+ "Facility files",
+ "facility_rec_{0}.csv".format(workdate),
+ )
+ with open(facility_rec_update, "wb") as fh:
+ fh.write(r.content)
+
+
@with_connection("etdb")
def insert_facility(conn, workdate):
facility_filename = os.path.join(