{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import datetime\n", "import pandas.tseries.offsets as off\n", "import globeop_reports as go\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#PNL Allocation\n", "#report_date = datetime.date(2017,10,31)\n", "report_date = datetime.date.today()\n", "report_date = report_date - off.MonthEnd(1)\n", "report_date" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pnl_alloc = go.alloc('pnl')\n", "alloc = pnl_alloc.xs(report_date)\n", "go.pnl_alloc_plot(alloc)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Capital Allocation\n", "cap_alloc = go.alloc('capital')\n", "alloc1 = cap_alloc.xs(report_date)\n", "go.cap_alloc_plot(alloc1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Average Portfolio Sales Turnover - as of last monthend from today\n", "go.avg_turnover()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Number of bond positions by strategy by month - and copy to clipboard\n", "go.num_bond_by_strat()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Number of bond trades by direction by month - and copy to clipboard\n", "go.num_bond_trades()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df = cap_alloc.endbooknav.groupby('periodenddate').apply(lambda x: x/x.sum())\n", "df = df.unstack().groupby(pd.TimeGrouper('M')).apply(lambda df: df.loc[df.index[-1]])\n", "df = go.shift_cash(datetime.date(2017,11,30), -2096454, df, 'Curve')\n", "temp = df.iloc[-1].sort_values(ascending=False)\n", "df = df.reindex_axis(temp.index, axis=1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ax = go.cap_alloc_plot(df[:-1])\n", "lgd = ax.legend(loc='lower center', bbox_to_anchor=(0.5, -0.3), ncol=4)\n", "ax.figure.savefig(\"/home/serenitas/edwin/PythonGraphs/cap_alloc_1.png\", bbox_extra_artists=(lgd,), bbox_inches='tight')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 2 }