diff options
| -rw-r--r-- | sql/dawn.sql | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index 7250844f..7b779e5c 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -3124,6 +3124,19 @@ CREATE OR REPLACE VIEW fxswap_settlements AS SELECT ft.dealid::text, unnest(ARRAY[ft.near_buy_amount, - ft.near_sell_amount, ft.far_buy_amount, - ft.far_sell_amount])::numeric(11,2) AS amount FROM fx_swaps ft LEFT JOIN accounts2 a USING (cash_account); + + +CREATE OR REPLACE VIEW equityoption_settlements AS SELECT eo.id::text AS id, + eo.settle_date, + eo.fund::fund, + eo.cp_code::text, + 'EQUITYOPTION' AS asset_class, + 'OTC'::text AS account, + 'USD'::currency AS currency, + - eo.fee::numeric(11,2) AS payment_amount + FROM equityoption_trades eo; + + CREATE OR REPLACE VIEW payment_settlements AS SELECT t.settle_date, t.fund, @@ -3146,7 +3159,9 @@ AS SELECT t.settle_date, UNION SELECT * FROM fxswap_settlements UNION - SELECT * FROM trs_settlements ) t + SELECT * FROM trs_settlements + UNION + SELECT * FROM equityoption_settlements) t LEFT JOIN counterparties c on t.cp_code=c.code GROUP BY t.settle_date, t.fund, c.name, t.cp_code, t.asset_class, t.currency, t.account ORDER BY t.settle_date DESC, t.fund, c.name, t.asset_class, t.currency; |
