aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sql/serenitasdb.sql5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/serenitasdb.sql b/sql/serenitasdb.sql
index 6422df45..850b46d8 100644
--- a/sql/serenitasdb.sql
+++ b/sql/serenitasdb.sql
@@ -639,7 +639,7 @@ CREATE TABLE bbg_index_quotes(
PRIMARY KEY(date, ticker, version));
CREATE OR REPLACE FUNCTION get_tranche_quotes(pg_index_type text, pg_series integer, pg_tenor text,
- pg_date date) RETURNS SETOF tranche_quotes AS
+ pg_date date, source text DEFAULT NULL) RETURNS SETOF tranche_quotes AS
$$
DECLARE r RECORD;
DECLARE best_quote RECORD DEFAULT NULL;
@@ -667,6 +667,9 @@ $$
IF r.quotesource = 'MSre' THEN
CONTINUE;
END IF;
+ If r.quotesource != source and source is not null THEN
+ CONTINUE;
+ END IF;
EXECUTE
'SELECT array_agg(attach ORDER BY attach ASC)||100::smallint = $6||array_agg(detach ORDER BY detach ASC)
FROM tranche_quotes