aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/risk/indices.py4
-rw-r--r--sql/dawn.sql3
2 files changed, 4 insertions, 3 deletions
diff --git a/python/risk/indices.py b/python/risk/indices.py
index 6b285f80..243ea6e6 100644
--- a/python/risk/indices.py
+++ b/python/risk/indices.py
@@ -126,8 +126,8 @@ def insert_curve_risk(
):
sql_str = (
"INSERT INTO curve_risk VALUES(%s, %s, %s, %s, %s) "
- "ON CONFLICT (date, strategy) DO UPDATE SET "
- '"VaR"=excluded."VaR", currency=excluded.currency, fund=excluded.fund'
+ "ON CONFLICT (date, strategy, fund) DO UPDATE SET "
+ '"VaR"=excluded."VaR", currency=excluded.currency'
)
# add a portfolio with all strategies
strategies = (*strategies, strategies)
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 38459245..6a6ace7b 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -2376,7 +2376,8 @@ CREATE TABLE curve_risk(
strategy cds_strat,
"VaR" float,
currency currency,
- PRIMARY KEY (date, strategy))
+ fund fund,
+ PRIMARY KEY (date, strategy, fund))
CREATE OR REPLACE VIEW tranche_pnl AS
WITH temp AS (