aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/index_data.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/python/index_data.py b/python/index_data.py
index a8478789..e6b7bf99 100644
--- a/python/index_data.py
+++ b/python/index_data.py
@@ -6,9 +6,18 @@ import pandas as pd
serenitasdb = dbengine('serenitasdb')
def insert_quotes():
- # backpopulate some version i+1 quotes one day before they start trading so that
- # we get continuous time series when we compute returns
- eturns
+ """
+ backpopulate some version i+1 quotes one day before they start trading so that
+ we get continuous time series when we compute returns.
+
+ We can also do it in sql as follows:
+
+ INSERT INTO index_quotes(date, index, series, version, tenor, closeprice)
+ SELECT date, index, series, version+1, tenor, (factor1*closeprice-100*0.355)/factor2
+ FROM index_quotes
+ WHERE index='HY' and series=23 and date='2017-02-02'
+
+ """
dates = pd.DatetimeIndex(['2014-05-21', '2015-02-19', '2015-03-05','2015-06-23'])
df = pd.read_sql_query("SELECT DISTINCT ON (date) * FROM index_quotes " \
"WHERE index='HY' AND tenor='5yr' " \