aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/process_queue.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/python/process_queue.py b/python/process_queue.py
index b282a41a..f30410d0 100644
--- a/python/process_queue.py
+++ b/python/process_queue.py
@@ -122,26 +122,24 @@ def terminate_list(
base_dir: pathlib.Path = DAILY_DIR,
):
trade_type, fund, _ = key.split("_")
- term_dict = {"T": [], "A": []}
+ terms = []
for term in p.lrange(key, 0, -1):
termination = loads(term)
trade = DealKind["termination"].from_dict(**termination)
trade.mtm_stage()
try:
- term_dict["A" if termination["is_assignment"] else "T"].append(
- trade.to_globeop()
- )
+ terms.append(trade.to_globeop())
except TypeError as e:
logging.error(e)
return
DealKind["termination"].mtm_upload()
- for k, v in term_dict.items():
- if v and upload:
- dest = get_filepath(base_dir, (trade_type, k), fund)
+ for obj in terms:
+ if upload:
+ dest = get_filepath(base_dir, (trade_type, "A"), fund)
buf = StringIO()
- csvwriter = csv.DictWriter(buf, get_termination_headers(trade_type, k))
+ csvwriter = csv.DictWriter(buf, get_termination_headers(trade_type, "A"))
csvwriter.writeheader()
- csvwriter.writerows(v)
+ csvwriter.writerows(obj)
buf = buf.getvalue().encode()
upload_buf(buf, dest.name, fund, trade_type)
dest.parent.mkdir(exist_ok=True)