{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Assignment 3: Portfolio Management \n", "\n", "Data on average monthly returns for nine different hedge fund styles (e.g.,...

1 answer below »
Attached an ipynb file


{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Assignment 3: Portfolio Management \n", "\n", "Data on average monthly returns for nine different hedge fund styles (e.g., long-short equity, market-neutral, global macro) are available at `https://github.com/mariuszoican/mgt443/blob/main/Data/A3_HedgeFunds.xlsx?raw=true`.\n", "\n", "The goal of this assignment is to implement a risk management strategy of **drawdown control**.\n", "\n", "1. Assume that at the end of December 1993, each hedge fund index (i.e., corresponding to a particular style) had a price equal to one. Given the monthly returns in the data, compute the price for each hedge fund style index at the end of each month. In this example, the price is equal to the cumulative return on the index.\n", "\n", "2. Compute the high-water mark for each fund style. The high-water mark for a fund at time $t$ is the highest price the fund has achieved before or at time $t$. Formally,\n", "\n", "$$\\text{HWM}_t=\\max_{0\\leq s \\leq t} p_s$$\n", "\n", "3. Compute the drawdown for each fund style. The drawdown at time $t$ is the distance from the current price to the high-water mark (in percentage style). In other words, the drawdown measures how far the hedge fund is at any given moment from its best historical performance:\n", "\n", "$$\\text{DD}_t=\\frac{\\text{HWM}_t-p_t}{\\text{HWM}_t}$$\n", "\n", "4. The goal of the assignment is to implement a drawdown control strategy by scaling down the position when the value-at-risk becomes \"too close\" to the **maximum acceptable drawdown** ($MADD$). We assume that $MADD=30\\%$ and that the value at risk is a 3-sigma event (three times the stock historical volatility, or 3$\\sigma_t$). Specifically, you need to choose each month and for each style an investment scale (return scalar) $x$ such that:\n", "\n", "$$x \\times 3\\sigma_t \\leq \\text{MADD}-\\text{DD}_t \\leftrightarrow x=\\frac{\\text{MADD}-\\text{DD}_t}{3\\sigma_t}.$$\n", "\n", "If $3\\sigma_t \\leq \\text{MADD}-\\text{DD}_t$ then you are not in “drawdown control mode” and you continue with investment of $x=1$ (full investment). Otherwise, you enter “drawdown control mode” and set the investment scale to $x=\\frac{\\text{MADD}-\\text{DD}_t}{3\\sigma_t}$. You never go short: if the current drawdown is higher than the $MADD$, you simply set $x=0$.\n", "\n", "To compute the historical volatility $\\sigma_t$, use the annualized volatility as the realized standard deviation over the past 12 months. For the first year, 1994, use the value from January 1995. For February 1995, use returns from February 1994 to January 1995. For March 1995, use returns from March 1994 to February 1995, and so on.\n", "\n", "5. Compute the total drawdown-adjusted return for each fund and month using the drawdown control scale x from the previous month as\n", "\n", "$$R_t^\\text{DD-adjusted}=x_t×R_t$$\n", "\n", "6. Plot the cumulative total raw return and the cumulative drawdown-adjusted return for two styles: dedicated short bias and long/short equity funds. What do you conclude?" ] }, { "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.8.8" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }
Answered 1 days AfterOct 27, 2021

Answer To: { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Assignment 3: Portfolio...

Risavsignh answered on Oct 28 2021
120 Votes
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"# Assignment 3: Portfolio Management \n",
"\n",
"Data on average monthly returns for nine different hedge fund styles (e.g., long-short equity, market-neutral, global macro) are available at `https://github.com/mariuszoican/mgt443/blob/main/Data/A3_HedgeFunds.xlsx?raw=true`.\n",
"\n",
"The goal of this assignment is to implement a risk management strategy of **drawdown control**.\n",
"\n",
"1. Assume that at the end of December 1993, each hedge fund index (i.e., corresponding to a particular style) had a price equal to one. Given the monthly returns in the data, compute the price for each hedge fund style index at the end of each month. In this example, the price is equal to the cumulative return on the index.\n",
"\n",
"2. Compute the high-water mark for each fund style. The high-water mark for a fund at time $t$ is the highest price the fund has achieved before or at time $t$. Formally,\n",
"\n",
"$$\\text{HWM}_t=\\max_{0\\leq s \\leq t} p_s$$\n",
"\n",
"3. Compute the drawdown for each fund style. The drawdown at time $t$ is the distance from the current price to the high-water mark (in percentage style). In other words, the drawdown measures how far the hedge fund is at any given moment from its best historical performance:\n",
"\n",
"$$\\text{DD}_t=\\frac{\\text{HWM}_t-p_t}{\\text{HWM}_t}$$\n",
"\n",
"4. The goal of the assignment is to implement a drawdown control strategy by scaling down the position when the value-at-risk becomes \"too close\" to the **maximum acceptable drawdown** ($MADD$). We assume that $MADD=30\\%$ and that the value at risk is a 3-sigma event (three times the stock historical volatility, or 3$\\sigma_t$). Specifically, you need to choose each month and for each style an investment scale (return scalar) $x$ such that:\n",
"\n",
"$$x \\times 3\\sigma_t \\leq \\text{MADD}-\\text{DD}_t \\leftrightarrow x=\\frac{\\text{MADD}-\\text{DD}_t}{3\\sigma_t}.$$\n",
"\n",
"If $3\\sigma_t \\leq \\text{MADD}-\\text{DD}_t$ then you are not in “drawdown control mode” and you continue with investment of $x=1$ (full investment). Otherwise, you enter “drawdown control mode” and set the investment scale to $x=\\frac{\\text{MADD}-\\text{DD}_t}{3\\sigma_t}$. You never go short: if the current drawdown is higher than the $MADD$, you simply set $x=0$.\n",
"\n",
"To compute the historical volatility $\\sigma_t$, use the annualized volatility as the realized standard deviation over the past 12 months. For the first year, 1994, use the value from January 1995. For February 1995, use returns from February 1994 to January 1995. For March 1995, use returns from March 1994 to February 1995, and so on.\n",
"\n",
"5. Compute the total drawdown-adjusted return for each fund and month using the drawdown control scale x from the previous month as\n",
"\n",
"$$R_t^\\text{DD-adjusted}=x_t×R_t$$\n",
"\n",
"6. Plot the cumulative total raw return and the cumulative drawdown-adjusted return for two styles: dedicated short bias and long/short equity funds. What do you conclude?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Install required packages"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pandas in /home/risav/.local/lib/python3.8/site-packages (1.3.4)\n",
"Requirement already satisfied: openpyxl in /home/risav/.local/lib/python3.8/site-packages (3.0.9)\n",
"Collecting
matplotlib\n",
" Downloading matplotlib-3.4.3-cp38-cp38-manylinux1_x86_64.whl (10.3 MB)\n",
"\u001b[K |████████████████████████████████| 10.3 MB 4.9 MB/s eta 0:00:01 |████████ | 2.6 MB 4.9 MB/s eta 0:00:02\n",
"\u001b[?25hRequirement already satisfied: numpy>=1.17.3; platform_machine != \"aarch64\" and platform_machine != \"arm64\" and python_version < \"3.10\" in /home/risav/.local/lib/python3.8/site-packages (from pandas) (1.21.3)\n",
"Requirement already satisfied: pytz>=2017.3 in /usr/lib/python3/dist-packages (from pandas) (2019.3)\n",
"Requirement already satisfied: python-dateutil>=2.7.3 in /usr/lib/python3/dist-packages (from pandas) (2.7.3)\n",
"Requirement already satisfied: et-xmlfile in /home/risav/.local/lib/python3.8/site-packages (from openpyxl) (1.1.0)\n",
"Requirement already satisfied: pyparsing>=2.2.1 in /home/risav/.local/lib/python3.8/site-packages (from matplotlib) (3.0.3)\n",
"Requirement already satisfied: pillow>=6.2.0 in /usr/lib/python3/dist-packages (from matplotlib) (7.0.0)\n",
"Collecting kiwisolver>=1.0.1\n",
" Downloading kiwisolver-1.3.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.2 MB)\n",
"\u001b[K |████████████████████████████████| 1.2 MB 9.8 MB/s eta 0:00:01\n",
"\u001b[?25hCollecting cycler>=0.10\n",
" Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)\n",
"Requirement already satisfied: six in /usr/lib/python3/dist-packages (from cycler>=0.10->matplotlib) (1.14.0)\n",
"Installing collected packages: kiwisolver, cycler, matplotlib\n",
"Successfully installed cycler-0.10.0 kiwisolver-1.3.2 matplotlib-3.4.3\n"
]
}
],
"source": [
"# Installs required packages\n",
"!pip3 install pandas openpyxl matplotlib --user"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Imports"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Reading excel file using pandas"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"
DateLn/Sh Eq Hedge Fund USDEq Mkt Ntr Hedge Fund USDDed Sh Bs Hedge Fund USDGlobal Mac Hedge Fund USDMngd Fut Hedge Fund USDEmg Mkts Hedge Fund USDEvnt Drvn Hedge Fund USDCnvrt Arb Hedge Fund USDFx Inc Arb Hedge Fund USD
01994-01-310.011733-0.005467-0.0162670.0014330.0019330.1051330.0365330.0033330.012733
11994-02-28-0.0250110.0021060.019713-0.0568110.011667-0.011705-0.0018500.001188-0.020346
21994-03-31-0.039114-0.0025140.071827-0.0428540.025923-0.046227-0.013051-0.009758-0.016930
31994-04-29-0.0157200.0023970.012710-0.0160330.008437-0.083673-0.006673-0.025332-0.002165
41994-05-310.005550-0.0012290.0223570.0378390.007497-0.007453-0.001604-0.0103290.007780
\n",
"
"
],
"text/plain": [
" Date Ln/Sh Eq Hedge Fund USD Eq Mkt Ntr Hedge Fund USD \\\n",
"0 1994-01-31 0.011733 -0.005467 \n",
"1 1994-02-28 -0.025011 0.002106 \n",
"2 1994-03-31 -0.039114 -0.002514 \n",
"3 1994-04-29 -0.015720 0.002397 \n",
"4 1994-05-31 0.005550 -0.001229 \n",
"\n",
" Ded Sh Bs Hedge Fund USD Global Mac Hedge Fund USD \\\n",
"0 -0.016267 0.001433 \n",
"1 0.019713 -0.056811 \n",
"2 0.071827 -0.042854 \n",
"3 0.012710 -0.016033 \n",
"4 0.022357 0.037839 \n",
"\n",
" Mngd Fut Hedge Fund USD Emg Mkts Hedge Fund USD Evnt Drvn Hedge Fund USD \\\n",
"0 0.001933 0.105133 0.036533 \n",
"1 0.011667 -0.011705 -0.001850 \n",
"2 0.025923 -0.046227 -0.013051 \n",
"3 0.008437 -0.083673 -0.006673 \n",
"4 0.007497 -0.007453 -0.001604 \n",
"\n",
" Cnvrt Arb Hedge Fund USD Fx Inc Arb Hedge Fund USD \n",
"0 0.003333 0.012733 \n",
"1 0.001188 -0.020346 \n",
"2 -0.009758 -0.016930 \n",
"3 -0.025332 -0.002165 \n",
"4 -0.010329 0.007780 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"excel_file = \"A3_HedgeFunds.xlsx\"\n",
"df = pd.read_excel(excel_file, header=0)\n",
"display(df.head(5))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Computing Price for each hedge fund style index at the end of each month"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"
DateLn/Sh Eq Hedge Fund USDEq Mkt Ntr Hedge Fund USDDed Sh Bs Hedge Fund USDGlobal Mac Hedge Fund USDMngd Fut Hedge Fund USDEmg Mkts Hedge Fund USDEvnt Drvn Hedge Fund USDCnvrt Arb Hedge Fund USDFx Inc Arb Hedge Fund USDLn/Sh Eq Hedge Fund Price USDEq Mkt Ntr Hedge Fund Price USDDed Sh Bs Hedge Fund Price USDGlobal Mac Hedge Fund Price USDMngd Fut Hedge Fund Price USDEmg Mkts Hedge Fund Price USDEvnt Drvn Hedge Fund Price USDCnvrt Arb Hedge Fund Price USDFx Inc Arb Hedge Fund Price USD
2172012-02-290.0264180.013335-0.0465670.0078520.0120390.0291770.0158090.0187840.0100175.0481532.4007210.4602737.7931352.8431543.7114334.9538503.7177302.488409
2182012-03-300.004998-0.001553-0.013541-0.004271-0.029648-0.0070120.0078630.0055350.0073775.0733862.3969920.4540417.7598522.7588603.6854094.9928043.7383102.506766
2192012-04-30-0.004680-0.004139-0.025323-0.0025220.0042990.001492-0.002299-0.0023810.0068705.0496422.3870720.4425437.7402862.7707203.6909084.9813243.7294082.523987
2202012-05-31-0.045274-0.0318060.0903370.0019360.023829-0.037889-0.013256-0.0083870.0023774.8210252.3111500.4825217.7552672.8367443.5510654.9152923.6981282.529986
2212012-06-290.0034380.009249-0.027231-0.013726-0.035612-0.001355-0.0018140.0032760.0075634.8376012.3325250.4693827.6488202.7357223.5462534.9063753.7102422.549120
\n",
"
"
],
"text/plain": [
" Date Ln/Sh Eq Hedge Fund USD Eq Mkt Ntr Hedge Fund USD \\\n",
"217 2012-02-29 0.026418 0.013335 \n",
"218 2012-03-30 0.004998 -0.001553 \n",
"219 2012-04-30 -0.004680 -0.004139 \n",
"220 2012-05-31 -0.045274 -0.031806 \n",
"221 2012-06-29 0.003438 0.009249 \n",
"\n",
" Ded Sh Bs Hedge Fund USD Global Mac Hedge Fund USD \\\n",
"217 -0.046567 0.007852 \n",
"218 -0.013541 -0.004271 \n",
"219 -0.025323 -0.002522 \n",
"220 0.090337 0.001936 \n",
"221 -0.027231 -0.013726 \n",
"\n",
" Mngd Fut Hedge Fund USD Emg Mkts Hedge Fund USD \\\n",
"217 0.012039 0.029177 \n",
"218 -0.029648 -0.007012 \n",
"219 0.004299 0.001492 \n",
"220 0.023829 -0.037889 \n",
"221 -0.035612 -0.001355 \n",
"\n",
" Evnt Drvn Hedge Fund USD Cnvrt Arb Hedge Fund USD \\\n",
"217 0.015809 0.018784 \n",
"218 0.007863 0.005535 \n",
"219 -0.002299 -0.002381 \n",
"220 -0.013256 -0.008387 \n",
"221 -0.001814 0.003276 \n",
"\n",
" Fx Inc Arb Hedge Fund USD Ln/Sh Eq Hedge Fund Price USD \\\n",
"217 0.010017 5.048153 \n",
"218 0.007377 5.073386 \n",
"219 0.006870 5.049642 \n",
"220 0.002377 4.821025 \n",
"221 0.007563 4.837601 \n",
"\n",
" Eq Mkt Ntr Hedge Fund Price USD Ded Sh Bs Hedge Fund Price USD \\\n",
"217 2.400721 0.460273 \n",
"218 2.396992 0.454041 \n",
"219 2.387072 0.442543 \n",
"220 2.311150 0.482521 \n",
"221 2.332525 0.469382 \n",
"\n",
" Global Mac Hedge Fund Price USD Mngd Fut Hedge Fund Price USD \\\n",
"217 7.793135 2.843154 \n",
"218 7.759852 2.758860 \n",
"219 7.740286 2.770720 \n",
"220 7.755267 2.836744 \n",
"221 7.648820 2.735722 \n",
"\n",
" Emg Mkts Hedge Fund Price USD Evnt Drvn Hedge Fund Price USD \\\n",
"217 3.711433 4.953850 \n",
"218 3.685409 4.992804 \n",
"219 3.690908 4.981324 \n",
"220 3.551065 4.915292 \n",
"221 3.546253 4.906375 \n",
"\n",
" Cnvrt Arb Hedge Fund Price USD Fx Inc Arb Hedge Fund Price USD \n",
"217 3.717730 2.488409 \n",
"218 3.738310 2.506766 \n",
"219 3.729408 2.523987 \n",
"220 3.698128 2.529986 \n",
"221 3.710242 2.549120 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Computes price from percentage\n",
"def get_price(percent, value):\n",
" return (1 + percent) * value\n",
"\n",
"# Computes cumulative price at the end of each month\n",
"for fund in df.columns:\n",
" if fund != \"Date\" and \"Price\" not in fund:\n",
" fund_price = fund.replace(\"USD\", \"Price USD\")\n",
" fund_prices = []\n",
" value = 1\n",
" percent = 0\n",
" for i in df.index:\n",
" percent = df[fund][i]\n",
" value = get_price(percent=percent, value=value)\n",
" fund_prices.append(value)\n",
" df[fund_price] = fund_prices\n",
" \n",
"display(df.tail(5))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Computing high-water mark for each fund style"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"
DateLn/Sh Eq Hedge Fund USDEq Mkt Ntr Hedge Fund USDDed Sh Bs Hedge Fund USDGlobal Mac Hedge Fund USDMngd Fut Hedge Fund USDEmg Mkts Hedge Fund USDEvnt Drvn Hedge Fund USDCnvrt Arb Hedge Fund USDFx Inc Arb Hedge Fund USD...Fx Inc Arb Hedge Fund Price USDLn/Sh Eq Hedge Fund HWM USDEq Mkt Ntr Hedge Fund HWM USDDed Sh Bs Hedge Fund HWM USDGlobal Mac Hedge Fund HWM USDMngd Fut Hedge Fund HWM USDEmg Mkts Hedge Fund HWM USDEvnt Drvn Hedge Fund HWM USDCnvrt Arb Hedge Fund HWM USDFx Inc Arb Hedge Fund HWM USD
2172012-02-290.0264180.013335-0.0465670.0078520.0120390.0291770.0158090.0187840.010017...2.4884095.3123623.8193471.2376237.7931353.0238563.8754965.4367193.717732.488409
2182012-03-300.004998-0.001553-0.013541-0.004271-0.029648-0.0070120.0078630.0055350.007377...2.5067665.3123623.8193471.2376237.7931353.0238563.8754965.4367193.738312.506766
2192012-04-30-0.004680-0.004139-0.025323-0.0025220.0042990.001492-0.002299-0.0023810.006870...2.5239875.3123623.8193471.2376237.7931353.0238563.8754965.4367193.738312.523987
2202012-05-31-0.045274-0.0318060.0903370.0019360.023829-0.037889-0.013256-0.0083870.002377...2.5299865.3123623.8193471.2376237.7931353.0238563.8754965.4367193.738312.529986
2212012-06-290.0034380.009249-0.027231-0.013726-0.035612-0.001355-0.0018140.0032760.007563...2.5491205.3123623.8193471.2376237.7931353.0238563.8754965.4367193.738312.549120
\n",
"

5 rows × 28 columns

\n",
"
"
],
"text/plain": [
" Date Ln/Sh Eq Hedge Fund USD Eq Mkt Ntr Hedge Fund USD \\\n",
"217 2012-02-29 0.026418 0.013335 \n",
"218 2012-03-30 0.004998 -0.001553 \n",
"219 2012-04-30 -0.004680 -0.004139 \n",
"220 2012-05-31 -0.045274 -0.031806 \n",
"221 2012-06-29 0.003438 0.009249 \n",
"\n",
" Ded Sh Bs Hedge Fund USD Global Mac Hedge Fund USD \\\n",
"217 -0.046567 0.007852 \n",
"218 -0.013541 -0.004271 \n",
"219 -0.025323 -0.002522 \n",
"220 0.090337 0.001936 \n",
"221 -0.027231 -0.013726 \n",
"\n",
" Mngd Fut Hedge Fund USD Emg Mkts Hedge Fund USD \\\n",
"217 0.012039 0.029177 \n",
"218 -0.029648 -0.007012 \n",
"219 0.004299 0.001492 \n",
"220 0.023829 -0.037889 \n",
"221 -0.035612 -0.001355 \n",
"\n",
" Evnt Drvn Hedge Fund USD Cnvrt Arb Hedge Fund USD \\\n",
"217 0.015809 0.018784 \n",
"218 0.007863 0.005535 \n",
"219 -0.002299 -0.002381 \n",
"220 -0.013256 -0.008387 \n",
"221 -0.001814 0.003276 \n",
"\n",
" Fx Inc Arb Hedge Fund USD ... Fx Inc Arb Hedge Fund Price USD \\\n",
"217 0.010017 ... 2.488409 \n",
"218 0.007377 ... 2.506766 \n",
"219 0.006870 ... 2.523987 \n",
"220 0.002377 ... 2.529986 \n",
"221 0.007563 ... 2.549120 \n",
"\n",
" Ln/Sh Eq Hedge Fund HWM USD Eq Mkt Ntr Hedge Fund HWM USD \\\n",
"217 5.312362 3.819347 \n",
"218 5.312362 3.819347 \n",
"219 5.312362 3.819347 \n",
"220 5.312362 3.819347 \n",
"221 5.312362 3.819347 \n",
"\n",
" Ded Sh Bs Hedge Fund HWM USD Global Mac Hedge Fund HWM USD \\\n",
"217 1.237623 7.793135 \n",
"218 1.237623 7.793135 \n",
"219 1.237623 7.793135 \n",
"220 1.237623 7.793135 \n",
"221 1.237623 7.793135 \n",
"\n",
" Mngd Fut Hedge Fund HWM USD Emg Mkts Hedge Fund HWM USD \\\n",
"217 3.023856 3.875496 \n",
"218 3.023856 3.875496 \n",
"219 3.023856 3.875496 \n",
"220 3.023856 3.875496 \n",
"221 3.023856 3.875496 \n",
"\n",
" Evnt Drvn Hedge Fund HWM USD Cnvrt Arb Hedge Fund HWM USD \\\n",
"217 5.436719 3.71773 \n",
"218 5.436719 3.73831 \n",
"219 5.436719 3.73831 \n",
"220 5.436719 3.73831 \n",
"221 5.436719 3.73831 \n",
"\n",
" Fx Inc Arb Hedge Fund HWM USD \n",
"217 2.488409 \n",
"218 2.506766 \n",
"219 2.523987 \n",
"220 2.529986 \n",
"221 2.549120 \n",
"\n",
"[5 rows x 28 columns]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Computes high water mark\n",
"def compute_hwmt(df, t, fund):\n",
" data = df[fund][df[\"Date\"] <= t]\n",
" return np.max(data)\n",
"\n",
"# Computes high water mark at the end of each month\n",
"for fund in df.columns:\n",
" if fund != \"Date\" and \"Price\" not in fund and \"HWM\" not in fund:\n",
" fund_hwm = fund.replace(\"USD\", \"HWM USD\")\n",
" fund_hwms = []\n",
" for i in df.index:\n",
" t = df[\"Date\"][i]\n",
" fund_hwms.append(compute_hwmt(df, t, fund.replace(\"USD\", \"Price USD\")))\n",
" df[fund_hwm] = fund_hwms\n",
"\n",
"display(df.tail(5))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Computing Drawdown for each fund style"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here
DateLn/Sh Eq Hedge Fund USDEq Mkt Ntr Hedge Fund USDDed Sh Bs Hedge Fund USDGlobal Mac Hedge Fund USDMngd Fut Hedge Fund USDEmg Mkts Hedge Fund USDEvnt Drvn Hedge Fund USDCnvrt Arb Hedge Fund USDFx Inc Arb Hedge Fund USD...Fx Inc Arb Hedge Fund HWM USDLn/Sh Eq Hedge Fund DDEq Mkt Ntr Hedge Fund DDDed Sh Bs Hedge Fund DDGlobal Mac Hedge Fund DDMngd Fut Hedge Fund DDEmg Mkts Hedge Fund DDEvnt Drvn Hedge Fund DDCnvrt Arb Hedge Fund DDFx Inc Arb Hedge Fund DD
2172012-02-290.0264180.013335-0.0465670.0078520.0120390.0291770.0158090.0187840.010017...2.4884090.0497350.3714320.6280990.0000000.0597590.0423330.0888160.0000000.0