aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/mark_backtest_underpar.py4
-rw-r--r--python/notebooks/Valuation Backtest.ipynb15
2 files changed, 15 insertions, 4 deletions
diff --git a/python/mark_backtest_underpar.py b/python/mark_backtest_underpar.py
index 56e1a2b7..307a1f9a 100644
--- a/python/mark_backtest_underpar.py
+++ b/python/mark_backtest_underpar.py
@@ -22,7 +22,7 @@ def get_mark_df(asset_class = 'Subprime'):
df = df_trades.merge(df_external_marks).dropna()
return df.set_index(['date','identifier'])
-def calc_mark_diff(df, sources= ['PRICESERVE', 'PRICINGDIRECT','BVAL','MARKIT','BROKER', 'REUTERS', 'S&P', 'PB', 'IDC']):
+def calc_mark_diff(df, sources= ['PRICESERVE', 'PRICINGDIRECT','BVAL','MARKIT','BROKER', 'REUTERS', 'S&P', 'IDC']):
#All Sources (including manager...?!) - average, manager mark only, median, closest
g = df.groupby(level = ['date','identifier'])
@@ -147,7 +147,7 @@ def pretty_plot(df_long):
sb.set_style("whitegrid")
sb.set_context("notebook")
- order = ['LMCG','BROKER','BVAL','IDC','MARKIT','PB','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)
diff --git a/python/notebooks/Valuation Backtest.ipynb b/python/notebooks/Valuation Backtest.ipynb
index bd8cab29..698a25f1 100644
--- a/python/notebooks/Valuation Backtest.ipynb
+++ b/python/notebooks/Valuation Backtest.ipynb
@@ -31,6 +31,15 @@
"metadata": {},
"outputs": [],
"source": [
+ "df_long = df_long[df_long.source != 'PB']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
"#%matplotlib nbagg\n",
"%matplotlib inline\n",
"mark.pretty_plot(df_long)\n",
@@ -140,13 +149,14 @@
"outputs": [],
"source": [
"#%matplotlib nbagg\n",
- "to_plot = ['mark_closest_all', 'mark_mean_all']\n",
+ "#Filtered takes out PB\n",
+ "to_plot = ['mark_closest_all', 'mark_filtered_mean']\n",
"to_plot1 = ['mark_manager']\n",
"plot_df0 = results[1][to_plot]\n",
"plot_df1 = results[1][to_plot1]\n",
"\n",
"plot_df0 = plot_df0.rename(columns = {'mark_closest_all': 'Third-pary mark closest to LMCG valuation', \\\n",
- " 'mark_mean_all': 'Average of all third-party marks'})\n",
+ " 'mark_filtered_mean': 'Average of all third-party marks'})\n",
"plot_df1 = plot_df1.rename(columns = {'mark_manager': 'Marks per fund valuation policy'})\n",
"\n",
"ax = plot_df0.plot(figsize = [10, 3.5])\n",
@@ -155,6 +165,7 @@
"ax.set_xlabel('')\n",
"ax.set_ylabel('NAV', weight = 'bold')\n",
"ax.set_title('Fund Return Using Different Valuation Methods', weight = 'bold')\n",
+ "ax.xaxis.grid(False)\n",
"lgd = ax.legend(loc='upper center', bbox_to_anchor=(0.5, -.1), shadow=True, ncol=3)\n",
"ax.figure.savefig(\"/home/serenitas/edwin/PythonGraphs/Valuation_1.png\", bbox_extra_artists=(lgd,), bbox_inches='tight')"
]