aboutsummaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/dawn.sql18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index e454b175..abffd870 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -4191,4 +4191,20 @@ si.currency, si.fund, COALESCE(pfm.folder::text, strategy::text) AS folder
FROM (SELECT *, rank() OVER(PARTITION BY si.broker,si.fund ORDER BY date desc)
FROM strategy_im si WHERE si.fund=p_fund AND si.date<=p_date ORDER BY date DESC) si
LEFT JOIN portfolio_folder_mapping pfm ON pfm.clean_folder=si.strategy::TEXT
-WHERE RANK=1 and abs(amount) >= .01; END $$ LANGUAGE plpgsql; \ No newline at end of file
+WHERE RANK=1 and abs(amount) >= .01; END $$ LANGUAGE plpgsql;
+
+
+CREATE TABLE iams (
+ id int4 NOT NULL GENERATED ALWAYS AS IDENTITY,
+ dealid varchar(28) NULL GENERATED ALWAYS AS ((('IAM_'::text || id::text))) STORED,
+ trade_date date NOT NULL,
+ strategy strategy NOT NULL,
+ broker text NOT NULL,
+ maturity date NULL,
+ amount numeric NOT NULL,
+ currency currency,
+ offset bool NOT NULL,
+ uploaded bool NOT NULL,
+ fund fund NOT NULL,
+ CONSTRAINT iams_pk PRIMARY KEY (trade_date, strategy, broker, currency, offset, fund)
+); \ No newline at end of file