diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/exploration/hybb.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/exploration/hybb.py b/python/exploration/hybb.py index 062f91fb..e429e84a 100644 --- a/python/exploration/hybb.py +++ b/python/exploration/hybb.py @@ -9,16 +9,20 @@ import pandas as pd dr = pd.date_range("2015-09-27", "2019-11-25", freq=bus_day) prices = {} s = -1 +index_list = [] for d in dr: + print(d) otr = on_the_run("HY", d) if otr > s: s = otr - basket_index = BasketIndex("HYBB", s, ["5yr"], value_date=d) - basket_index.value_date = d - prices[(s, d)] = 100 * (1 - basket_index.pv()["5yr"]) + index_list.append(BasketIndex("HYBB", s, ["5yr"], value_date=d)) + for index in index_list: + index.value_date = d + prices[(index.series, d)] = 100 * (1 - index.pv()["5yr"]) hybb = pd.DataFrame.from_dict(prices, orient="index") hybb.index = pd.MultiIndex.from_tuples(hybb.index) +breakpoint() hybb.columns = ["HYBB"] hybb = hybb.pct_change().reset_index(level=0, drop=True) df = index_returns( |
