diff options
| -rw-r--r-- | sql/dawn.sql | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index c4ac2c4d..aece17be 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -803,7 +803,8 @@ $$ LANGUAGE plpgsql; CREATE OR REPLACE function list_cds_positions_by_strat_fcm(p_date date, - p_fcm text) + p_fcm text, + p_fund fund DEFAULT 'SERCGMAST'::fund) RETURNS TABLE(security_id varchar(12), security_desc varchar(32), maturity date, fixed_rate float, currency currency, folder cds_strat, notional float) AS $$ BEGIN @@ -812,7 +813,7 @@ RETURN QUERY cds.currency, cds.folder, SUM(cds.notional) OVER (PARTITION BY cds.security_id, cds.maturity, cds.folder, cds.fcm) AS notional - FROM list_cds(p_date) cds WHERE (cds.attach is NULL AND cds.folder != 'MBSCDS' AND cds.fcm=p_fcm)) + FROM list_cds(p_date, p_fund) cds WHERE (cds.attach is NULL AND cds.folder != 'MBSCDS' AND cds.fcm=p_fcm)) SELECT DISTINCT ON (tmp.security_id, tmp.maturity, tmp.folder) * FROM tmp WHERE tmp.notional!=0; END; $$ LANGUAGE plpgsql; |
