aboutsummaryrefslogtreecommitdiffstats
path: root/python/backfill_index.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/backfill_index.py')
-rw-r--r--python/backfill_index.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/python/backfill_index.py b/python/backfill_index.py
index 99f61ae4..0ecc9ba7 100644
--- a/python/backfill_index.py
+++ b/python/backfill_index.py
@@ -4,19 +4,22 @@ import pandas as pd
metadata = MetaData(bind = engine)
index_quotes = Table('index_quotes', metadata, autoload=True)
-series = [9, 11, 13, 15, 17, 19, 21]
-tenor = ['3yr', '5yr', '7yr', '10yr']
+#series = [9, 11, 13, 15, 17, 19, 21]
+series=[9]
+#tenor = ['3yr', '5yr', '7yr', '10yr']
+tenor = ['3yr', '5yr', '7yr']
+index_type ='HY'
for s in series:
for t in tenor:
- index = "ig{0}".format(s)
- stmt = index_quotes.delete().where((index_quotes.c.index=='IG') &
+ index = "{0}{1}".format(index_type.lower(), s)
+ stmt = index_quotes.delete().where((index_quotes.c.index==index_type) &
(index_quotes.c.series==s) &
(index_quotes.c.tenor==t))
engine.execute(stmt)
df = pd.read_excel('/home/share/CorpCDOs/index historical.xlsx', "{0} {1}".format(index, t))
df.rename(columns={k: k.lower() for k in df.columns.tolist()}, inplace=True)
- df['index']='IG'
+ df['index']= index_type
df['series']=s
df['tenor']=t
df.to_sql('index_quotes', engine, if_exists='append', index=False)