diff options
Diffstat (limited to 'sql/dawn.sql')
| -rw-r--r-- | sql/dawn.sql | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index 7b779e5c..c89402b5 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -4853,4 +4853,29 @@ FULL OUTER JOIN ( ) c USING (periodenddate, fund, port); -CREATE VIEW eur_fx_excess AS SELECT fund, periodenddate, sum(COALESCE (forward_valuations,0) + COALESCE (otc_valuations,0) + COALESCE (cash_valuations,0)) AS eur_excess FROM eur_fx_valuations GROUP BY fund, periodenddate ORDER BY periodenddate DESC;
\ No newline at end of file +CREATE VIEW eur_fx_excess AS SELECT fund, periodenddate, sum(COALESCE (forward_valuations,0) + COALESCE (otc_valuations,0) + COALESCE (cash_valuations,0)) AS eur_excess FROM eur_fx_valuations GROUP BY fund, periodenddate ORDER BY periodenddate DESC; + +CREATE TABLE citco_account_mapping (fund fund, citco_code text, account TEXT references accounts2(cash_account), PRIMARY KEY (fund, citco_code)); + +CREATE OR REPLACE VIEW citco_cash_valuations +AS +SELECT + cr.period_end_date AS periodenddate, + cr.fund, + cr.trade_ccy AS invccy, + cr.trade_ccy AS invid, + sum(cr."quantity(end)") AS endlocalmv, + 'CASH' AS port, + 'CSH_CASH' AS strat, + cr."prime_broker/clearing_broker" AS custacctname +FROM citco_reports cr +GROUP BY + cr.period_end_date, + cr.fund, + cr.symbol, + cr.trade_ccy, + cr."prime_broker/clearing_broker" +HAVING + cr.symbol IN ('EUR Cash Balance', 'USD Cash Balance'); + + |
