diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/thetas-durations.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/python/thetas-durations.py b/python/thetas-durations.py index 4eebaa50..07e6cb03 100644 --- a/python/thetas-durations.py +++ b/python/thetas-durations.py @@ -60,10 +60,12 @@ for index in ["IG", "HY", "EU", "XO"]: get_legs(index, series, tenors[index]) index_quotes = pd.read_sql_query( - "SELECT id, date, tenor, close_price FROM index_quotes_pre " + "SELECT distinct on (date, tenor) id, date, tenor, version, close_price " + "FROM index_quotes_pre " "LEFT JOIN index_risk USING (id) " "WHERE index=%s AND series=%s " - "AND source='MKIT' AND duration is NULL AND tenor IN %s", + "AND source='MKIT' AND duration is NULL AND tenor IN %s " + "ORDER BY date, tenor, version desc", serenitas_engine, params=(index, series, tenors[index]), parse_dates=['date'], |
