diff options
| -rw-r--r-- | python/position_file_bowdst.py | 64 | ||||
| -rw-r--r-- | python/report_ops/sma.py | 5 |
2 files changed, 42 insertions, 27 deletions
diff --git a/python/position_file_bowdst.py b/python/position_file_bowdst.py index 8fd7ac07..95145e08 100644 --- a/python/position_file_bowdst.py +++ b/python/position_file_bowdst.py @@ -27,7 +27,7 @@ def gen_positions_and_fnames(cob, fund): yield buf, dest -def main(cob, fund, upload): +def build_file(cob, fund, upload): client = Client.from_creds("hm_globeop", folder="incoming") attachments = [] for buf, dest in gen_positions_and_fnames(cob, fund): @@ -47,26 +47,42 @@ def main(cob, fund, upload): ) -parser = argparse.ArgumentParser( - description="Generate position files for Bowdoin Street" -) -parser.add_argument( - "date", - nargs="?", - type=datetime.date.fromisoformat, - default=prev_business_day((datetime.date.today().replace(day=1))), -) -parser.add_argument( - "--no-upload", - "-n", - action="store_true", - default=False, - help="uploads to globeop", -) -args = parser.parse_args() -if ( - not prev_business_day(datetime.date.today()) == args.date and not args.no_upload -): # We only want to upload if the previous business day was monthend - pass -else: - main(args.date, "BOWDST", not args.no_upload) +def parse_args(): + parser = argparse.ArgumentParser( + description="Generate position files for Bowdoin Street" + ) + parser.add_argument( + "date", + nargs="?", + type=datetime.date.fromisoformat, + default=prev_business_day((datetime.date.today().replace(day=1))), + ) + parser.add_argument( + "--no-upload", + "-n", + action="store_true", + default=False, + help="uploads to globeop", + ) + parser.add_argument( + "--manual", + "-m", + action="store_true", + default=False, + help="indicates that the script is being run manually", + ) + return parser.parse_args() + + +def main(): + args = parse_args() + if ( + not prev_business_day(datetime.date.today()) == args.date and not args.no_upload + ) and not args.manual: # We only want to upload if the previous business day was monthend + pass + else: + build_file(args.date, "BOWDST", not args.no_upload) + + +if __name__ == "__main__": + main() diff --git a/python/report_ops/sma.py b/python/report_ops/sma.py index 68596549..fcade1e0 100644 --- a/python/report_ops/sma.py +++ b/python/report_ops/sma.py @@ -271,7 +271,7 @@ class BondPosition(PositionReport, asset_class="bond"): ) for key in ("account", "primebroker", "cp_code"): d[key] = _fund_custodian[fund] - d["dealid"] = "Aggregated" + d["dealid"] = "COMPRESSED" d["buysell"] = True d["currency"] = "USD" d["current_face"] = d["notional"] * d["factor"] @@ -365,7 +365,6 @@ class CDXPosition(PositionReport, asset_class="cdx"): "effectivedate": "effective_date", "security_desc": "description", "security_id": "identifier", - "clearing_facility": "clearing_house", }, ) d["fixed_rate"] = d["coupon"] * 100 @@ -375,8 +374,8 @@ class CDXPosition(PositionReport, asset_class="cdx"): d["cp_code"] = _fund_fcm[fund] d["primebroker"] = _fund_fcm[fund] d["currency"] = "EUR" if d["index"] in ("EU", "XO") else "USD" + d["dealid"] = "COMPRESSED" d["clearing_house"] = "ICE" - d["dealid"] = "Aggregated" return cls.from_dict(**d) |
