aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/collateral/__main__.py5
-rw-r--r--python/report_ops/sma.py2
-rw-r--r--sql/dawn.sql16
3 files changed, 21 insertions, 2 deletions
diff --git a/python/collateral/__main__.py b/python/collateral/__main__.py
index e270dc58..2f985c62 100644
--- a/python/collateral/__main__.py
+++ b/python/collateral/__main__.py
@@ -134,7 +134,10 @@ for fund in funds:
"SELECT maturity_date, (fixed_rate /100)::NUMERIC(4, 4) as fixed_rate, float_index, currency, roll_day, notional, folder "
"FROM list_ir_positions(%s, %s) ",
dawn_engine,
- params=(fund_mapping[fund], workdate),
+ params=(
+ workdate,
+ fund_mapping[fund],
+ ),
index_col=["maturity_date", "fixed_rate", "roll_day", "float_index"],
parse_dates=["maturity_date"],
)
diff --git a/python/report_ops/sma.py b/python/report_ops/sma.py
index fd70ab04..cc720071 100644
--- a/python/report_ops/sma.py
+++ b/python/report_ops/sma.py
@@ -150,7 +150,7 @@ product_name_mapping = {
"future": "Future",
"tranche": "Credit Index Tranche",
"cdx_swaption": "CD Swaption",
- "irs": "IRS Swaption",
+ "irs": "Interest Rate Swap",
"cdx": "Credit Index",
}
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 9e7570a1..e6d7cf8a 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -1922,6 +1922,22 @@ AND fund=p_fund;
END;
$$ LANGUAGE plpgsql;
+CREATE OR REPLACE FUNCTION list_ir_positions(p_date date, p_fund fund)
+ RETURNS TABLE(maturity_date date, fixed_rate double precision, fund fund, folder strategy, float_index cash_rate, currency currency, clearing_facility clearing_cp, roll_day roll_day, notional double precision)
+ LANGUAGE plpgsql
+AS $function$
+BEGIN
+ RETURN QUERY SELECT i.maturity_date, i.fixed_rate, i.fund, i.folder, i.float_index, i.currency, i.clearing_facility, i.roll_day,
+ sum(CASE WHEN payreceive THEN i.notional ELSE -i.notional end) AS notional
+ FROM irs i
+ WHERE i.fund = $2 AND i.trade_date <= $1
+ GROUP BY i.maturity_date, i.fixed_rate, i.fund, i.folder, i.float_index, i.currency, i.clearing_facility, i.roll_day
+ HAVING sum(CASE WHEN payreceive THEN i.notional ELSE -i.notional end) != 0;
+END;
+$function$
+;
+
+
CREATE OR REPLACE function list_abscds_marks(p_date date, fund fund DEFAULT 'SERCGMAST'::fund)
RETURNS TABLE(security_id varchar(12), cusip varchar(9), security_desc varchar(32), maturity date,
notional float, factor float, fixed_rate float, clean_nav float, accrued float) AS $$