diff options
| -rw-r--r-- | python/process_queue.py | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/python/process_queue.py b/python/process_queue.py index cdddc82c..a0b1ebce 100644 --- a/python/process_queue.py +++ b/python/process_queue.py @@ -478,6 +478,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("-n", "--no-upload", action="store_true", help="do not upload to Globeop") + parser.add_argument("fund", nargs="?", default="SERCGMAST") args = parser.parse_args() q = get_redis_queue() try: @@ -486,29 +487,28 @@ if __name__ == "__main__": sys.exit("Please set path of daily directory in 'DAILY_DIR'") dawndb = dbconn('dawndb') - for fund in ["BRINKER", "SERGMAST"]: - for trade_type in ['bond', 'cds', 'swaption', 'future', 'wire', 'spot', 'capfloor']: - list_trades = get_trades(q, trade_type, fund) - if list_trades: - if trade_type in ['bond', 'cd']: - process_fun = globals()[f"{trade_type}_trade_process"] - with init_bbg_session(BBG_IP) as session: - for trade in list_trades: - process_fun(dawndb, session, trade) - if trade_type == "bond" and fund == "SERCGMAST": - for trade in list_trades: - if trade["upload"]: - send_email(trade) - if fund == "SERCGMAST" or trade_type == "cds": - try: - buf = generate_csv( - filter(lambda t: t["upload"], list_trades), - trade_type, fund) - file_path = write_buffer(buf, DAILY_DIR, - trade_type, fund) - if not args.no_upload: - upload_file(file_path) - except IOError: - pass - q.delete(queue_name) + for trade_type in ['bond', 'cds', 'swaption', 'future', 'wire', 'spot', 'capfloor']: + list_trades = get_trades(q, trade_type, args.fund) + if list_trades: + if trade_type in ['bond', 'cd']: + process_fun = globals()[f"{trade_type}_trade_process"] + with init_bbg_session(BBG_IP) as session: + for trade in list_trades: + process_fun(dawndb, session, trade) + if trade_type == "bond" and args.fund == "SERCGMAST": + for trade in list_trades: + if trade["upload"]: + send_email(trade) + if args.fund == "SERCGMAST" or trade_type == "cds": + try: + buf = generate_csv( + filter(lambda t: t["upload"], list_trades), + trade_type, args.fund) + file_path = write_buffer(buf, DAILY_DIR, + trade_type, args.fund) + if not args.no_upload: + upload_file(file_path) + except IOError: + pass + q.delete(f"{trade_type}_{args.fund}") dawndb.close() |
