aboutsummaryrefslogtreecommitdiffstats
path: root/sql/dawn.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/dawn.sql')
-rw-r--r--sql/dawn.sql7
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index d6b660ea..151066a9 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -877,7 +877,7 @@ CREATE OR REPLACE function list_positions(p_date date,
p_class asset_class DEFAULT NULL,
include_unsettled boolean DEFAULT True,
p_fund fund DEFAULT 'SERCGMAST'::fund)
-RETURNS TABLE(identifier varchar(12), description varchar(32), notional float, strategy bond_strat,
+RETURNS TABLE(identifier varchar(12), description varchar(32), notional float, strategy strategy,
curr_cpn float, start_accrued_date date, last_settle_date date,
principal_payment float, accrued_payment float, currency currency, daycount day_count,
bbg_type bbg_type, figi varchar(12)) AS $$
@@ -900,7 +900,8 @@ BEGIN
principal_payment, accrued_payment, sum(faceamount*(2*buysell::int-1) )
OVER (PARTITION BY bond_trades.identifier) notional FROM bond_trades WHERE trade_date<=$1
AND fund=$3)
- SELECT DISTINCT ON (identifier) securities.identifier, securities.description, notional, folder,
+ SELECT DISTINCT ON (identifier) securities.identifier, securities.description, notional,
+ substring(folder::text FROM ''(?:M_)?(.*)'')::strategy AS folder,
securities.coupon, start_accrued_date, settle_date, temp.principal_payment,
temp.accrued_payment, securities.currency, securities.day_count, securities.bbg_type, securities.figi
FROM temp LEFT JOIN securities USING (identifier)
@@ -941,7 +942,7 @@ CREATE OR REPLACE function risk_positions(p_date date,
p_assetclass asset_class,
p_fund fund DEFAULT 'SERCGMAST'::fund) RETURNS TABLE
(description varchar(32), identifier varchar(12), notional float, price float,
-strategy bond_strat, factor float, local_market_value float, usd_market_value float,
+strategy strategy, factor float, local_market_value float, usd_market_value float,
curr_cpn float, int_acc float, last_pay_date date, principal_payment float,
accrued_payment float, last_settle_date date, figi varchar(12)) AS $$
BEGIN