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 70e9b668..4564c152 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -4154,7 +4154,7 @@ FROM irs JOIN counterparties ON cp_code = code) ORDER BY trade_date DESC, folder CREATE OR REPLACE FUNCTION baml_fcm_fx(p_date date) RETURNS TABLE (account TEXT, curr currency, "TotBal" NUMERIC, "HomeCurrency" currency, "fxRate" NUMERIC, "convTotBal" NUMERIC, "BuySell" TEXT, "ValueDate" date) LANGUAGE plpgsql AS $function$ BEGIN - RETURN query SELECT case when a.account='V0NSCLMSPT' then '6MZ20049' else a.account, a.curr, round(a.totbal::NUMERIC, 2) , a.homecurrency, round(a.fxrate::NUMERIC, 5), round(a.convtotbal::NUMERIC, 2), a.buysell, a.valuedate + RETURN query SELECT case when a.account='V0NSCLMSPT' then '6MZ20049' else a.account end, a.curr, round(a.totbal::NUMERIC, 2) , a.homecurrency, round(a.fxrate::NUMERIC, 5), round(a.convtotbal::NUMERIC, 2), a.buysell, a.valuedate FROM(SELECT cash_account AS account, buy_currency AS curr,-buy_amount AS totbal, sell_currency AS homecurrency, spot_rate AS fxrate, sell_amount AS convtotbal, 'Buy' AS buysell, settle_date AS valuedate FROM spots WHERE sell_currency = 'USD' @@ -4162,7 +4162,7 @@ AND trade_date = p_date UNION SELECT cash_account AS account, sell_currency AS curr, sell_amount AS totbal, buy_currency AS homecurrency, spot_rate AS fxrate, sell_amount AS convtotbal, 'Sell' AS buysell, settle_date AS valuedate FROM spots WHERE buy_currency = 'USD' -AND trade_date = p_date) a; +AND trade_date = p_date) a WHERE a.account in ('V0NSCLMSPT', '6MZ20K79'); END; |
