diff options
| -rw-r--r-- | python/position.py | 10 | ||||
| -rw-r--r-- | sql/serenitasdb.sql | 13 |
2 files changed, 20 insertions, 3 deletions
diff --git a/python/position.py b/python/position.py index 2358f235..f2e18587 100644 --- a/python/position.py +++ b/python/position.py @@ -391,13 +391,19 @@ def update_hyg_vol(conn, session, start_date: datetime.date = None): d = retrieve_data( session, ["HYG US Equity"], - fields=["PX_LAST", "CALL_IMP_VOL_30D", "3MO_CALL_IMP_VOL"], + fields=[ + "PX_LAST", + "CALL_IMP_VOL_30D", + "3MO_CALL_IMP_VOL", + "YAS_ISPREAD", + "YAS_MOD_DUR", + ], start_date=start_date, ) df = d["HYG US Equity"] with conn.cursor() as c: c.executemany( - "INSERT INTO hyg_vol_data VALUES (%s, %s, %s, %s)", + "INSERT INTO hyg_vol_data VALUES (%s, %s, %s, %s, %s, %s)", df.itertuples(index=True), ) conn.commit() diff --git a/sql/serenitasdb.sql b/sql/serenitasdb.sql index 192ffddb..77bd6125 100644 --- a/sql/serenitasdb.sql +++ b/sql/serenitasdb.sql @@ -1271,4 +1271,15 @@ CREATE TABLE markit_singlename_quotes ( quotedate timestamptz NULL,
quotesource text,
confidence int
- );
\ No newline at end of file + );
+
+CREATE TABLE hyg_vol_data (
+ "date" date NOT NULL,
+ price float8 NULL,
+ "30d_implied_vol" float8 NULL,
+ "3M_inplied_vol" float8 NULL,
+ yas_ispread float8 NULL,
+ yas_mod_dur float8 NULL,
+ CONSTRAINT hyg_vol_data_pkey PRIMARY KEY (date)
+);
+
|
