aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/gfs_monitor.py15
-rw-r--r--python/report_ops/custodians.py6
-rw-r--r--python/report_ops/utils.py3
-rw-r--r--sql/dawn.sql13
4 files changed, 19 insertions, 18 deletions
diff --git a/python/gfs_monitor.py b/python/gfs_monitor.py
index a6e95f59..11e0b197 100644
--- a/python/gfs_monitor.py
+++ b/python/gfs_monitor.py
@@ -54,9 +54,12 @@ if __name__ == "__main__":
args = parser.parse_args()
logger = logging.getLogger(__name__)
conn = dbconn("dawndb")
- for fund in (
- "SERCGMAST",
- "BOWDST",
- ):
- check_gfs(args.cob, fund, conn)
- check_cleared_cds(args.cob, fund, conn)
+ sql_str = "SELECT endqty as payment_amount, invccy as currency, periodenddate as settle_date FROM valuation_reports vr WHERE fund=%s AND port ='GFS_HELPER_BUSINESS_UNIT' AND periodenddate =%s AND abs(endqty) > 50000;"
+ em = ExchangeMessage()
+ with conn.cursor() as c:
+ for fund in ("BOWDST", "SERCGMAST"):
+ c.execute(sql_str, (fund, args.cob))
+ for row in c:
+ GFSMonitor.stage(c._asdict())
+ GFSMonitor.email(fund)
+ GFSMonitor._insert_queue.clear()
diff --git a/python/report_ops/custodians.py b/python/report_ops/custodians.py
index a0763995..905ca9c2 100644
--- a/python/report_ops/custodians.py
+++ b/python/report_ops/custodians.py
@@ -31,10 +31,8 @@ def upload_to_custodian(account, trade_date, upload, em):
if any(
[
old_row.identifier != row.identifier,
- abs(float(old_row.principal_payment) - row.principal_payment)
- > 1e-2,
- abs(float(old_row.accrued_payment) - row.accrued_payment)
- > 1e-2,
+ old_row.principal_payment != row.principal_payment,
+ old_row.accrued_payment != row.accrued_payment,
]
):
old_trade = BondDeal.from_dict(
diff --git a/python/report_ops/utils.py b/python/report_ops/utils.py
index 1e610510..83c39fc1 100644
--- a/python/report_ops/utils.py
+++ b/python/report_ops/utils.py
@@ -17,7 +17,6 @@ import re
from zoneinfo import ZoneInfo
from .misc import _recipients, _cc_recipients
from tabulate import tabulate
-from serenitas.utils.db import dbconn
logger = logging.getLogger(__name__)
@@ -329,7 +328,7 @@ class CBMonitor(
</style>
</head>
<body>
- Good morning,<br><br>We see a projected overdraft on the below dates. Please move to cover and confirm:<br><br>{cls.to_tabulate()}
+ Good morning,<br><br>We see a projected overdraft on the below dates. Please move to cover:<br><br>{cls.to_tabulate()}
</body>
</html>"""
),
diff --git a/sql/dawn.sql b/sql/dawn.sql
index c4b138ab..185bb576 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -1072,9 +1072,9 @@ AS SELECT bonds.dealid,
bonds.accrued,
bonds.folder,
bonds.portfolio,
- bonds.principal_payment * bond_allocation.notional / sum(bond_allocation.notional) OVER w AS principal_payment,
- bonds.accrued_payment * bond_allocation.notional / sum(bond_allocation.notional) OVER w AS accrued_payment,
- (bonds.principal_payment + bonds.accrued_payment) * bond_allocation.notional / sum(bond_allocation.notional) OVER w AS net_amount,
+ ((bond_allocation.notional / sum(bond_allocation.notional) OVER w) * bonds.principal_payment)::numeric(11, 2) AS principal_payment,
+ ((bond_allocation.notional / sum(bond_allocation.notional) OVER w) * bonds.accrued_payment)::numeric(11, 2) AS accrued_payment,
+ ((bond_allocation.notional / sum(bond_allocation.notional) OVER w) * (bonds.principal_payment + bonds.accrued_payment))::numeric(11, 2) AS net_amount,
bonds.current_face * bond_allocation.notional / sum(bond_allocation.notional) OVER w AS current_face,
bond_allocation.notional AS faceamount,
accounts.fund,
@@ -1088,6 +1088,7 @@ AS SELECT bonds.dealid,
LEFT JOIN counterparties ON bonds.cp_code = counterparties.code
WINDOW w AS (PARTITION BY bond_allocation.tradeid);
+
CREATE OR REPLACE function list_positions(p_date date,
p_class asset_class DEFAULT NULL,
include_unsettled boolean DEFAULT True,
@@ -4121,8 +4122,8 @@ CREATE TABLE bond_csv_upload(
id int4 NOT NULL GENERATED ALWAYS AS IDENTITY,
tradeid int NOT NULL,
identifier text NOT NULL,
- principal decimal NOT NULL,
- interest decimal NOT NULL,
+ principal numeric(11, 2) NOT NULL,
+ interest numeric(11, 2) NOT NULL,
CONSTRAINT unique_upload_check UNIQUE (tradeid, cusip, principal, interest)
);
@@ -4179,4 +4180,4 @@ SELECT a.security_id::text, a.maturity::date, a.INDEX, a.security_desc::text, pr
endlocalmarketprice ,
split_part(invid, '_', 2) AS security_id,
split_part(invid, '_', 6)::date AS maturity
- FROM valuation_reports WHERE invid LIKE 'CDS\_%%' AND periodenddate =p_date AND fund= p_fund) i)b USING (security_id, maturity); END $$ LANGUAGE plpgsql; \ No newline at end of file
+ FROM valuation_reports WHERE invid LIKE 'CDS\_%%' AND periodenddate =p_date AND fund= p_fund) i)b USING (security_id, maturity); END $$ LANGUAGE plpgsql;