diff options
Diffstat (limited to 'sql/dawn.sql')
| -rw-r--r-- | sql/dawn.sql | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index 4dada8d1..ced47c7e 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -1052,13 +1052,13 @@ $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION list_ir_swaption_positions(IN p_date date, p_fund fund DEFAULT 'SERCGMAST'::fund) RETURNS TABLE(deal_id character varying, strategy swaption_strat, notional double precision, - option_type option_type, strike double precision, expiration_date date, maturity date, + option_type option_type, strike double precision, security_id varchar, expiration_date date, maturity date, initial_margin_percentage double precision) AS $$ BEGIN RETURN QUERY SELECT a.dealid, folder, (CASE WHEN buysell = 't' THEN 1 ELSE -1 END) * (a.notional - coalesce(terminated_amount, 0.)), -a.option_type, a.strike, a.expiration_date, a.maturity, a.initial_margin_percentage +a.option_type, a.strike, a.security_id, a.expiration_date, a.maturity, a.initial_margin_percentage FROM swaptions a LEFT JOIN (SELECT dealid, SUM(termination_amount) AS terminated_amount FROM terminations WHERE termination_date <= p_date GROUP BY dealid) b USING (dealid) |
