diff options
Diffstat (limited to 'python/notebooks/Allocation Reports.ipynb')
| -rw-r--r-- | python/notebooks/Allocation Reports.ipynb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/python/notebooks/Allocation Reports.ipynb b/python/notebooks/Allocation Reports.ipynb index b8399305..1a30f348 100644 --- a/python/notebooks/Allocation Reports.ipynb +++ b/python/notebooks/Allocation Reports.ipynb @@ -220,8 +220,9 @@ "metadata": {}, "outputs": [], "source": [ - "#RMBS Positions and Risks\n", - "rmbs_pos = go.get_rmbs_pos_df()" + "#Positions and Risks\n", + "rmbs_pos = go.get_rmbs_pos_df()\n", + "clo_pos = go.get_clo_pos_df()" ] }, { @@ -236,7 +237,7 @@ "bond_dur, bond_yield = {}, {}\n", "for d, g in rmbs_pos.groupby(pd.Grouper(freq='M')):\n", " bond_dur[d] = sum(g.curr_ntl * g.moddur)/sum(g.curr_ntl)\n", - " bond_yield[d] = sum(g.endbooknav * g.moddur * g.b_yield) /sum(g.endbooknav * g.moddur)\n", + " bond_yield[d] = sum(g.endbookmv * g.moddur * g.b_yield) /sum(g.endbookmv * g.moddur)\n", "a = pd.Series(bond_dur)\n", "b = pd.Series(bond_yield)\n", "a.name = 'Duration'\n", @@ -266,9 +267,10 @@ "source": [ "#RMBS Risk - need RMBS Positions and Risks\n", "sql_string = \"select date, duration, series from on_the_run where index = 'HY'\"\n", - "duration = pd.read_sql_query(sql_string, Sengine, parse_dates=['date'])\n", + "duration = pd.read_sql_query(sql_string, Sengine, parse_dates=['date'], index_col=['date'])\n", "df = pd.merge_asof(rmbs_pos.sort_index(), duration, left_index=True, right_index=True)\n", - "df.groupby('timestamp').apply(lambda df: sum(df.delta_yield/df.duration * 100))" + "rmbs_hy_equiv = df.groupby('timestamp').apply(lambda df: sum(df.delta_yield/df.duration * 100))\n", + "#hy_equiv.plot()" ] }, { @@ -325,7 +327,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.6" } }, "nbformat": 4, |
