diff options
| -rw-r--r-- | python/Dawn/views.py | 13 | ||||
| -rw-r--r-- | python/process_queue.py | 12 |
2 files changed, 14 insertions, 11 deletions
diff --git a/python/Dawn/views.py b/python/Dawn/views.py index c6df3ed8..56bf0497 100644 --- a/python/Dawn/views.py +++ b/python/Dawn/views.py @@ -426,10 +426,9 @@ def terminate(dealid, kind): ccy=currency, globeopid=globeop_id, is_assignment=is_assignment, - fund=fund, ) q = get_queue() - q.rpush(f"{kind}_termination", buf) + q.rpush(f"{kind}_{fund}_termination", buf) return redirect(url_for("list_trades", kind=kind)) else: return render_template( @@ -607,10 +606,12 @@ def get_bbg_id(): indextype = indextype[:2] tenor = tenor[:-1] + "yr" series = int(series[1:]) - sql_str = ("SELECT redindexcode, maturity, coupon " - "FROM index_desc " - "WHERE index=%s and series=%s and tenor=%s " - " and lastdate >=%s ORDER BY version") + sql_str = ( + "SELECT redindexcode, maturity, coupon " + "FROM index_desc " + "WHERE index=%s and series=%s and tenor=%s " + " and lastdate >=%s ORDER BY version" + ) db = get_db() with db.cursor() as c: c.execute(sql_str, (indextype, series, tenor, trade_date)) diff --git a/python/process_queue.py b/python/process_queue.py index d18c15db..325acb77 100644 --- a/python/process_queue.py +++ b/python/process_queue.py @@ -374,18 +374,20 @@ def terminate_list( conn: psycopg2.extensions.connection, base_dir: pathlib.Path = DAILY_DIR, ): - trade_type = key.split("_")[0] + trade_type, fund, _ = key.split("_") for term in p.lrange(key, 0, -1): termination = loads(term) try: - buf, trade_type = build_termination(base_dir, conn, **termination) + buf, trade_type = build_termination( + base_dir, conn, fund=fund, **termination + ) except TypeError as e: logging.error(e) return else: - dest = get_filepath(base_dir, trade_type, termination["fund"]) + dest = get_filepath(base_dir, trade_type, fund) if upload: - upload_buf(buf, dest.name, termination["fund"]) + upload_buf(buf, dest.name, fund) dest.parent.mkdir(exist_ok=True) dest.write_bytes(buf) p.delete(key) @@ -1071,7 +1073,7 @@ if __name__ == "__main__": ) r.transaction(p_list, key) for trade_type in ("cds", "swaption", "capfloor"): - key = f"{trade_type}_termination" + key = f"{trade_type}_{args.fund}_termination" t_list = partial( terminate_list, key=key, upload=not args.no_upload, conn=dawndb ) |
