aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/position_file_bowdst.py9
-rw-r--r--python/report_ops/sma.py7
2 files changed, 11 insertions, 5 deletions
diff --git a/python/position_file_bowdst.py b/python/position_file_bowdst.py
index 8ee1e154..3fcc1d7d 100644
--- a/python/position_file_bowdst.py
+++ b/python/position_file_bowdst.py
@@ -3,21 +3,23 @@ import argparse
from serenitas.utils.remote import Client
from serenitas.utils.exchange import ExchangeMessage, FileAttachment
from report_ops.misc import _recipients, _cc_recipients
+import datetime
+from serenitas.analytics.dates import prev_business_day
def main(cob, fund, upload):
buf, dest = build_position_file(
- cob, fund, ["bond", "future", "tranche", "irswaption", "cdxswaption"]
+ cob, fund, ["bond", "future", "tranche", "ir_swaption", "cdx_swaption"]
)
if upload:
client = Client.from_creds("hm_globeop")
- cls.client.put(buf, dest.name)
+ client.put(buf, dest.name)
em = ExchangeMessage()
em.send_email(
subject=f"Position_files for Bowdoin Street as of {cob}",
body=f"Please see monthend positions for Bowdoin Street as of {cob}. They have been uploaded to the SFTP as well.",
- recipients=_recipients[fund],
+ to_recipients=_cc_recipients[fund],
cc_recipients=_cc_recipients[fund],
reply_to=_cc_recipients[fund],
attach=[FileAttachment(name=dest.name, content=buf)],
@@ -41,7 +43,6 @@ parser.add_argument(
help="uploads to globeop",
)
args = parser.parse_args()
-conn = dbconn("dawndb")
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
diff --git a/python/report_ops/sma.py b/python/report_ops/sma.py
index 24e01a76..16c58675 100644
--- a/python/report_ops/sma.py
+++ b/python/report_ops/sma.py
@@ -18,7 +18,7 @@ from serenitas.utils.env import DAILY_DIR
def build_position_file(cob, fund, asset_classes: list):
for asset_class in asset_classes:
for position in PositionReport[asset_class].gen_positions(cob, fund):
- PositionReport.staging_queue.append(position.serialize("position"))
+ PositionReport.staging_queue.append(position.to_position())
buf, dest = PositionReport.build_buffer(cob, fund)
PositionReport.staging_queue.clear()
return buf, dest
@@ -192,6 +192,11 @@ class PositionReport(Deal, deal_type=None, table_name=None):
d["cob"] = cob
return d
+ def to_position(self):
+ obj = self.serialize("position")
+ obj["Product Type"] = self.asset_class
+ return obj
+
class BondPosition(PositionReport, asset_class="bond"):
@classmethod