aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/risk/swaptions.py7
-rw-r--r--sql/dawn.sql9
2 files changed, 10 insertions, 6 deletions
diff --git a/python/risk/swaptions.py b/python/risk/swaptions.py
index e35ab21b..0b3752c3 100644
--- a/python/risk/swaptions.py
+++ b/python/risk/swaptions.py
@@ -44,8 +44,8 @@ def get_swaption_portfolio(date, conn, fund="SERCGMAST", portfolio=None, **kwarg
def insert_swaption_portfolio(portf, conn, overwrite=True):
- columns = ["market_value", "delta", "gamma", "vega", "theta"]
- place_holders = sql.SQL(", ").join([sql.Placeholder()] * 7)
+ columns = ["market_value", "delta", "gamma", "vega", "theta", "hy_equiv"]
+ place_holders = sql.SQL(", ").join([sql.Placeholder()] * 8)
if overwrite:
update_str = sql.SQL("DO UPDATE SET {}").format(
sql.SQL(", ").join(
@@ -58,7 +58,7 @@ def insert_swaption_portfolio(portf, conn, overwrite=True):
else:
update_str = sql.SQL("DO NOTHING")
sql_str = sql.SQL(
- "INSERT INTO swaption_marks VALUES({}) " "ON CONFLICT (dealid, date) {} "
+ "INSERT INTO swaption_marks VALUES({}) ON CONFLICT (dealid, date) {} "
).format(place_holders, update_str)
with conn.cursor() as c:
for id, trade in portf.items():
@@ -70,6 +70,7 @@ def insert_swaption_portfolio(portf, conn, overwrite=True):
trade.gamma,
trade.vega,
trade.theta,
+ trade.hy_equiv,
)
try:
c.execute(sql_str, to_insert)
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 06b8572d..e8724f34 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -1582,7 +1582,8 @@ CREATE OR REPLACE FUNCTION list_swaption_positions_and_risks(IN p_date date, p_f
globeop_nav double precision,
initial_margin double precision, latest_model_date date,
delta double precision, gamma double precision, vega double precision,
- theta double precision, index index_type, series smallint, tenor tenor,
+ theta double precision, hy_equiv double precision,index index_type,
+ series smallint, tenor tenor,
duration double precision, portfolio portfolio, indexfactor float) AS $$
BEGIN
RETURN QUERY
@@ -1592,7 +1593,7 @@ SELECT DISTINCT ON (a.dealid) a.dealid, a.security_id, c.maturity,
a.option_type, a.strike, a.expiration_date, b.market_value,
coalesce(endbooknav, base_market_value),
f.ia, b.date, b.delta, b.gamma, b.vega,
- b.theta, c.index, c.series, c.tenor, d.duration, a.portfolio, c.indexfactor
+ b.theta, b.hy_equiv, c.index, c.series, c.tenor, d.duration, a.portfolio, c.indexfactor
FROM swaptions a
LEFT JOIN (SELECT * FROM swaption_marks where date <= p_date) b USING (dealid)
LEFT JOIN index_desc c ON a.security_id=redindexcode AND a.maturity=c.maturity
@@ -2059,7 +2060,9 @@ CREATE TABLE swaption_marks(
market_value float,
delta float,
gamma float,
- vega float)
+ vega float,
+ theta float,
+ hy_equiv float)
CREATE TABLE subprime_risk(
date date,