diff options
Diffstat (limited to 'sql/dawn.sql')
| -rw-r--r-- | sql/dawn.sql | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index a9ae718e..253e516c 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -576,7 +576,7 @@ CREATE TABLE bbh_pnl( CREATE TYPE bony_asset_type AS ENUM( -'CASH & CASH EQUIVALENTS', 'FIXED INCOME SECURITIES', 'FUTURES CONTRACTS'); +'CASH & CASH EQUIVALENTS', 'FIXED INCOME SECURITIES', 'FUTURES CONTRACTS', 'NON CUSIP RELATED INCOME'); CREATE TABLE bowdst_val( row integer not null, @@ -620,6 +620,44 @@ CREATE TABLE bowdst_accounts( account_name text NOT NULL ); +CREATE TABLE bowdst_pnl( + row integer not null, + begin_date date not null, + end_date date not null, + derivative_type text, + security_id text, + security_description_1 text, + security_description_2 text, + local_currency currency, + coupon_rate float, + asset_type_name text, + asset_type_category bony_asset_type, + unrealized_currency float, + unrealized_investment float, + total_unrealized float, + ending_shares_par float, + opening_receivables float, + closing_receivables float, + income float, + journal_entry_income float, + accretion_amortization float, + journal_entry_accretion_amortization float, + realized_gain_loss float, + journal_entry_realized_gl float, + realized_loss_impaired_securities float, + net_investment_income float, + cusip text, + ticker text, + isin text, + link_ref text, + realized_investment float, + realized_currency float, + realized_settled float, + realized_traded float, + PRIMARY KEY (begin_date, end_date, row) +); + + CREATE OR REPLACE function list_marks(p_date date) RETURNS TABLE(p_date date, identifier varchar(12), price float) AS $$ BEGIN @@ -1186,6 +1224,7 @@ WHERE a.notional IS DISTINCT FROM terminated_amount AND a.expiration_date > p_date AND trade_date <= p_date AND swap_type = 'CD_INDEX_OPTION' AND periodenddate <= p_date +AND a.fund = p_fund ORDER BY dealid, date DESC, periodenddate DESC; END $$ LANGUAGE plpgsql; |
