diff options
Diffstat (limited to 'sql/dawn.sql')
| -rw-r--r-- | sql/dawn.sql | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index 85926e3f..69041b5b 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -4161,22 +4161,4 @@ SELECT id, upfront, settle_date, swap_type -FROM irs JOIN counterparties ON cp_code = code) ORDER BY trade_date DESC, folder; - -CREATE OR REPLACE FUNCTION baml_fcm_fx(p_date date, p_fund fund) RETURNS TABLE (account TEXT, curr currency, "TotBal" float, "HomeCurrency" currency, "fxRate" float, "convTotBal" float, "BuySell" TEXT, "ValueDate" date) LANGUAGE plpgsql -AS $function$ -BEGIN - RETURN query SELECT case when a.account='V0NSCLMSPT' then '6MZ20049' else a.account end, a.curr, a.totbal , a.homecurrency, a.fxrate, a.convtotbal, 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' -AND trade_date = p_date AND fund=p_fund -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 fund=p_fund -AND trade_date = p_date) a LEFT JOIN accounts2 ON a.account=cash_account WHERE account_type='Fcm' and cp_code='BAMSNY'; - -END; - -$function$ -;
\ No newline at end of file +FROM irs JOIN counterparties ON cp_code = code) ORDER BY trade_date DESC, folder;
\ No newline at end of file |
