diff options
Diffstat (limited to 'sql')
| -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 4c51ac70..85926e3f 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -1150,7 +1150,8 @@ $$ LANGUAGE plpgsql; CREATE OR REPLACE function risk_positions(p_date date, p_assetclass asset_class, - p_fund fund DEFAULT 'SERCGMAST'::fund) RETURNS TABLE + p_fund fund DEFAULT 'SERCGMAST'::fund, + include_unsettled boolean DEFAULT True) RETURNS TABLE (description varchar(32), identifier varchar(12), notional float, price float, strategy strategy, factor float, local_market_value float, usd_market_value float, curr_cpn float, int_acc float, last_pay_date date, principal_payment float, @@ -1164,7 +1165,7 @@ BEGIN a.notional * coalesce(b.factor,1) * fxrate * yearfrac(case WHEN start_accrued_date>=p_date+1 THEN b.prev_cpn_date ELSE start_accrued_date END, p_date+1, daycount) * b.coupon/100., b.last_pay_date, a.principal_payment, a.accrued_payment, a.last_settle_date, a.figi - FROM list_positions(p_date, p_assetclass, true, p_fund) a + FROM list_positions(p_date, p_assetclass, include_unsettled, p_fund) a LEFT JOIN factors_history(p_date) b ON a.figi = b.identifier LEFT JOIN list_marks(p_date) c ON a.figi = c.identifier LEFT JOIN fx_rate(p_date) USING (currency) |
