diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/mark_backtest_backfill.py | 3 | ||||
| -rw-r--r-- | python/mark_backtest_underpar.py | 10 | ||||
| -rw-r--r-- | python/notebooks/Valuation Backtest.ipynb | 25 |
3 files changed, 33 insertions, 5 deletions
diff --git a/python/mark_backtest_backfill.py b/python/mark_backtest_backfill.py index 8ea4f6d9..6a2913c9 100644 --- a/python/mark_backtest_backfill.py +++ b/python/mark_backtest_backfill.py @@ -97,6 +97,9 @@ def get_globs(): return chain.from_iterable(globs) settings = { + 'ReviewedPack.jmircovi.SERENITAS.SERCGMAST.20180901.20180930.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), + 'ReviewedPack.pcharubh.SERENITAS.SERCGMAST.20180801.20180831.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), + 'ReviewedPack.pcharubh.SERENITAS.SERCGMAST.20180701.20180731.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), 'ReviewedPack.pcharubh.SERENITAS.SERCGMAST.20180601.20180630.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), 'ReviewedPack.jipark.SERENITAS.SERCGMAST.20180501.20180531.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), 'ReviewedPack.pcharubh.SERENITAS.SERCGMAST.20180401.20180430.Draft.xlsx': ("JA:JX", "Securities Valuation Details", "Y"), diff --git a/python/mark_backtest_underpar.py b/python/mark_backtest_underpar.py index 307a1f9a..0465049e 100644 --- a/python/mark_backtest_underpar.py +++ b/python/mark_backtest_underpar.py @@ -147,11 +147,15 @@ def pretty_plot(df_long): sb.set_style("whitegrid") sb.set_context("notebook") - order = ['LMCG','BROKER','BVAL','IDC','MARKIT','PRICESERVE','PRICINGDIRECT','REUTERS','S&P'] + order = ['LMCG','BROKER','BVAL','IDC','MARKIT','PRICESERVE', + 'PRICINGDIRECT','REUTERS','S&P'] sb.set_palette(sb.hls_palette(10, l=.4, s=.8)) - grid = sb.FacetGrid(df_long, hue='source', hue_kws={'s':[50] + [20]*9, 'marker': ["o"]+["s"]*9, 'alpha': [1]+[.4]*9}, legend_out=True, aspect = 2.1, size = 4, hue_order = order) + grid = sb.FacetGrid(df_long, hue='source', hue_kws={'s':[50] + [20]*9, + 'marker': ["o"]+["s"]*9, 'alpha': [1]+[.4]*9}, legend_out=True, + aspect=2.1, height= 4, hue_order=order) grid.set(ylim=(0, 105), xlim=(0, 105)) ax = grid.map(plt.scatter, 'mark', 'price').add_legend() ax.set_axis_labels('Mark', 'sale price') - ax.fig.savefig("/home/serenitas/edwin/backtest.png") + plt.plot([100, 0], [100, 0], color="black", lw=2, linestyle='solid') + ax.fig.savefig("/home/serenitas/edwin/PythonGraphs/backtest.png") diff --git a/python/notebooks/Valuation Backtest.ipynb b/python/notebooks/Valuation Backtest.ipynb index 77f709b8..ca6ae02d 100644 --- a/python/notebooks/Valuation Backtest.ipynb +++ b/python/notebooks/Valuation Backtest.ipynb @@ -44,7 +44,7 @@ "outputs": [], "source": [ "#%matplotlib nbagg\n", - "%matplotlib inline\n", + "#%matplotlib inline\n", "mark.pretty_plot(df_long)\n", "#file saved in serenitas shared drive/edwin/" ] @@ -188,6 +188,7 @@ "metadata": {}, "outputs": [], "source": [ + "#Annual Return using different methodology\n", "round(mark.annual_performance(results[1])*100,2)" ] }, @@ -197,6 +198,16 @@ "metadata": {}, "outputs": [], "source": [ + "#Return using different methodology - Same calulation as above but monthly \n", + "(results[1]/results[1].shift(1) - 1)[-24:][['mark_manager', 'mark_closest_all', 'mark_filtered_mean']]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "#A positive impact % means the alternative methodology results in a higher NAV than the fund's valuation policy.\n", "round(pd.DataFrame(mark.alt_nav_impact())*100,2)" ] @@ -229,6 +240,16 @@ "metadata": {}, "outputs": [], "source": [ + "summary.iloc[-2]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#Trade winners/performance\n", "df = ops.trade_performance()\n", "df = df.set_index('trade_date')\n", "df.days_held = df.days_held.dt.days\n", @@ -260,7 +281,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.7.0" } }, "nbformat": 4, |
