diff options
Diffstat (limited to 'sql/dawn.sql')
| -rw-r--r-- | sql/dawn.sql | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql index bc5ac7c6..509eceee 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -527,7 +527,7 @@ CREATE TABLE bbh_val( custody_head_account_number float, security_id text, security_description text, - asset_currency text, + asset_currency currency, original_face float, base_price float, local_unit_cost float, @@ -552,7 +552,7 @@ CREATE TABLE bbh_pnl( security_id text, custody_head_account_number int, issue_name text, - local_currency text, + local_currency currency, base_market_value float, base_change_income float, base_change_fx_realized_gain_loss float, @@ -566,6 +566,52 @@ CREATE TABLE bbh_pnl( source text, PRIMARY KEY (accounting_date, row)); + +CREATE TYPE bony_asset_type AS ENUM( +'CASH & CASH EQUIVALENTS', 'FIXED INCOME SECURITIES', 'FUTURES CONTRACTS'); + +CREATE TABLE bowdst_val( + row integer not null, + as_of_date date not null, + source_account_number integer REFERENCES bowdst_accounts(account_number), + mellon_security_id text, + asset_type bony_asset_type, + security_description_1 text, + security_description_2 text, + maturity_date date, + coupon_rate float, + current_notional float, + local_price float, + local_currency_code currency, + base_price float, + local_cost float, + base_cost float, + local_market_value float, + base_market_value float, + local_unrealized_pnl float, + base_unrealized_pnl float, + local_notional_cost float, + base_notional_cost float, + local_notional_value float, + base_notional_value float, + gen_ledger_acct integer, + report_run_date date, + link_ref text, + counterparty_name text, + exchange_rate float, + original_strike_price float, + current_strike_price float, + cusip text, + ticker text, + isin text, + PRIMARY KEY (as_of_date, row) +); + +CREATE TABLE bowdst_accounts( + account_number integer NOT NULL PRIMARY KEY, + account_name text NOT NULL +); + CREATE OR REPLACE function list_marks(p_date date) RETURNS TABLE(p_date date, identifier varchar(12), price float) AS $$ BEGIN |
