aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/adj_index_price.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/python/adj_index_price.py b/python/adj_index_price.py
index 2b8c6103..3dfe57d7 100644
--- a/python/adj_index_price.py
+++ b/python/adj_index_price.py
@@ -1,11 +1,11 @@
from sqlalchemy import create_engine, MetaData, Table, bindparam
import pandas as pd
-import pdb
-#index='HY'
+index='HY'
#series=[10, 11, 13, 15, 17, 19, 21, 23]
-index='IG'
-series= [9, 11, 13, 15, 17, 19, 21, 23]
+series = [9]
+# index='IG'
+# series= [9, 11, 13, 15, 17, 19, 21, 23]
engine = create_engine('postgresql://serenitas_user:Serenitas1@debian/serenitasdb')
metadata = MetaData(bind=engine)
index_quotes= Table('index_quotes', metadata, autoload=True)
@@ -13,9 +13,10 @@ index_quotes= Table('index_quotes', metadata, autoload=True)
for s in series:
factors = pd.read_sql_query("select lastdate, indexfactor, cumulativeloss from index_version " \
"where index=%s and series=%s", engine, params = (index, s),
- parse_dates = ['lastdate'])
+ parse_dates = ['lastdate'], index_col='lastdate')
+ factors.sort_index(inplace=True)
factors['recovery'] = 1+factors.cumulativeloss.diff(-1)
- for t in ['3yr', '5yr', '7yr', '10yr']:
+ for t in ['3yr', '5yr', '7yr']:
df = pd.read_sql_query("select date as b_date, version, closeprice, modelprice from index_quotes " \
"where index=%s and series=%s and tenor=%s",
engine, params = (index, s, t), parse_dates =['b_date'])