diff options
| -rw-r--r-- | python/externalmarksbackfill.py | 3 | ||||
| -rw-r--r-- | python/globeop_reports.py | 8 | ||||
| -rw-r--r-- | python/notebooks/Valuation Backtest.ipynb | 42 |
3 files changed, 46 insertions, 7 deletions
diff --git a/python/externalmarksbackfill.py b/python/externalmarksbackfill.py index ae4339ca..12ca5022 100644 --- a/python/externalmarksbackfill.py +++ b/python/externalmarksbackfill.py @@ -97,7 +97,8 @@ def get_globs(): return chain.from_iterable(globs) settings = { - 'ReviewedPack.bseeman.SERENITAS.SERCGMAST.20170601.20170630.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "N"), + 'ReviewedPack.bseeman.SERENITAS.SERCGMAST.20170701.20170731.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), + 'ReviewedPack.bseeman.SERENITAS.SERCGMAST.20170601.20170630.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), 'ReviewedPack.bseeman.SERENITAS.SERCGMAST.20170501.20170531.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), 'ReviewedPack.bseeman.SERENITAS.SERCGMAST.20170401.20170430.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), 'ReviewedPack.bseeman.SERENITAS.SERCGMAST.20170301.20170331.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), diff --git a/python/globeop_reports.py b/python/globeop_reports.py index a140672e..1d798677 100644 --- a/python/globeop_reports.py +++ b/python/globeop_reports.py @@ -16,9 +16,10 @@ def get_monthly_pnl(): return monthend_pnl.groupby(['date', 'identifier'])[['mtd' + col for col in pnl_cols]].sum() def curr_port_PNL(date = datetime.date.today(), asset_class='Subprime'): + date = (date - pd.tseries.offsets.MonthEnd(1)).date() sql_string = "SELECT * FROM risk_positions(%s, %s) WHERE notional > 0" df_positions = pd.read_sql_query(sql_string, dbengine('dawndb'),params = [date, asset_class]) - df_pnl = get_monthly_pnl() + df_pnl = get_monthly_pnl()[:date] df_all = df_positions.merge(df_pnl.groupby('identifier').sum().reset_index(), on=['identifier']) return df_all @@ -65,8 +66,3 @@ def get_net_navs(): df = pd.read_csv('/home/serenitas/edwin/Python/subscription_fee_data.csv', parse_dates=['date'], index_col =['date']) df.index = df.index.to_period('M').to_timestamp('M') return df.join(nav) - -if __name__=='__main__': - nav = get_net_navs() - df_pnl = trade_performance() - df_curr_port = curr_port_PNL() diff --git a/python/notebooks/Valuation Backtest.ipynb b/python/notebooks/Valuation Backtest.ipynb index 88211db3..6326ec98 100644 --- a/python/notebooks/Valuation Backtest.ipynb +++ b/python/notebooks/Valuation Backtest.ipynb @@ -154,6 +154,16 @@ "metadata": {}, "outputs": [], "source": [ + "#Fund cumulative returns from the last 12 months\n", + "results[1]['mark_manager'][-12:]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "mark.annual_performance(results[1])" ] }, @@ -163,6 +173,7 @@ "metadata": {}, "outputs": [], "source": [ + "#A positive impact % means the alternative methodology results in a higher NAV than the fund's valuation policy.\n", "pd.DataFrame(mark.alt_nav_impact())" ] }, @@ -171,6 +182,37 @@ "execution_count": null, "metadata": {}, "outputs": [], + "source": [ + "pnl_breakdown = ops.curr_port_PNL()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Unrealized MTM Gains/Loss\n", + "breakdown_summary = pd.DataFrame(index = {'unreal mark-to-market'}, columns={'Gains','Loss','Net'})\n", + "breakdown_summary['Gains'] = pnl_breakdown[pnl_breakdown['mtdbookunrealmtm']>=0].sum()['mtdbookunrealmtm']\n", + "breakdown_summary['Loss'] = pnl_breakdown[pnl_breakdown['mtdbookunrealmtm']<0].sum()['mtdbookunrealmtm']\n", + "breakdown_summary['Net'] = pnl_breakdown.sum()['mtdbookunrealmtm']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "breakdown_summary / nav[-1]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [] } ], |
