{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "![MOSEK ApS](https://www.mosek.com/static/images/branding/webgraphmoseklogocolor.png )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Risk measures\n", "\n", "The value-at-risk (VaR) of a random variable $X$ at risk level $\\alpha$ is defined as\n", "$$\\textrm{VaR}_\\alpha(X) = \\min_\\eta\\left(\\mathbb{P}[X\\geq\\eta]\\leq 1-\\alpha\\right)$$\n", "and the conditional value-at-risk (CVaR) is the conditional expected value\n", "$$\\textrm{CVaR}_\\alpha(X)=\\mathbb{E}(X~|~X\\geq\\textrm{VaR}_\\alpha(X)).$$\n", "In the standard setting where the random variable $X$ represents a loss (on an investment) and we take $\\alpha=0.9$, CVaR can be interpreted as the expected loss assuming we end up in the $10\\%$ worst scenarios. The concept was studied in the paper Optimization of Conditional Value-at-Risk, Rockafellar and Uryasev, Journal of Risk, 2002, where we also find an equivalent formula\n", "$$\\textrm{CVaR}_\\alpha(X)=\\min_\\eta\\left(\\eta+(1-\\alpha)^{-1}\\mathbb{E}([X-\\eta]^+)\\right)$$\n", "where $[x]^+=\\max(x,0)$.\n", "\n", "Some authors consider generalizations\n", "$$\\rho^f_\\alpha(X)=\\min_\\eta\\left(\\eta+(1-\\alpha)^{-1}f^{-1}\\left(\\mathbb{E}(f(X-\\eta))\\right)\\right),$$\n", "where $f$ is any increasing, convex function on $\\mathbb{R}_+$ which is identically zero on $\\mathbb{R}_-$. Examples include:\n", "* $f(x)=[x]^+$, recovering the previous definition of CVaR,\n", "* $f(x)=\\exp([t]^+)-1$, log-exponential convex risk measure (LogExpCR), (Vinel, Krokhmal 2017),\n", "* $f(x)=([x]^+)^q$, higher moment coherent risk measures (HMCR) (Krokhmal 2007).\n", "\n", "# Stochastic portfolio optimization\n", "\n", "In this notebook we implement the models described in Section 5 of (Vinel, Krokhmal 2017) with various risk measures. We consider the problem of investing in $n$ stocks given $m$ historical return vectors $r_1,\\ldots,r_m\\in\\mathbb{R}^n$ taken with probabilities $p_1,\\ldots,p_m$. We consider the following conditions:\n", "* total budget constraint:\n", " $$1^Tx\\leq 1$$\n", "* minimal expected return:\n", " $$x^T\\mathbb{E}(\\mu)\\geq \\bar{r}$$\n", " where $\\mu$ is the uncertain vector of returns, $\\mathbb{E}(\\mu)=\\sum_j p_jr_j$ is its expected value averaged over the historical scenarios, and $\\bar{r}$ is the minimal required expected return level.\n", "* no short-selling:\n", " $$x\\geq 0$$\n", "* the objective represents minimization of CVaR $\\rho^f_\\alpha(-\\mu^Tx)$ of the loss $-\\mu^Tx$, that is\n", " $$\\textrm{minimize}_{\\eta,x}\\left(\\eta+(1-\\alpha)^{-1}f^{-1}(\\sum_{j=1}^mp_jf(-r_j^Tx-\\eta))\\right)$$\n", " \n", "We used a preprocessed file with closing prices from NYSE for 1675 assets over 2050 trading days. Each historical scenario is defined by computing returns of all assets over some period of 10 trading days They are returned in a martix $r$ with $n$ rows and $m$ columns." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(1675, 2040)\n" ] } ], "source": [ "%matplotlib inline\n", "import matplotlib\n", "import matplotlib.pyplot as plt\n", "from mosek.fusion import *\n", "import numpy as np \n", "import sys, os, csv\n", "\n", "allPrices = np.array(list(csv.reader(open(\"allPrices.txt\"), lineterminator='\\n', quoting=csv.QUOTE_NONNUMERIC)))\n", "n,m = allPrices.shape\n", "p1 = allPrices[:,0:m-10]\n", "p2 = allPrices[:,10:m]\n", "r = (p2-p1)/p1\n", "print(r.shape)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# CVaR\n", "\n", "We first implement the linear CVaR model with $f(x)=[x]^+$. We can then write the problem as\n", "\n", "$$\n", "\\begin{array}{ll}\n", "\\mbox{minimize} & \\eta + (1-\\alpha)^{-1} p^Tw\\\\\n", "\\mbox{subject to} & 1^Tx\\leq 1, \\\\\n", " & x^Trp\\geq \\bar{r}, \\\\\n", " & w_j\\geq \\max\\{0, -r_j^Tx-\\eta \\}, \\quad j=1,\\ldots,m,\n", "\\end{array}\n", "$$\n", "\n", "with variables $x\\in\\mathbb{R}^n, w\\in\\mathbb{R}^m, \\eta\\in\\mathbb{R}$. Below is the Fusion implementation." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "def modelCVaR(alpha, rbar, p, r, m, n): \n", " M = Model(\"CVaR\")\n", "\n", " # Variables\n", " X = M.variable('X', n, Domain.greaterThan(0.0))\n", " W = M.variable('W', m, Domain.greaterThan(0.0))\n", " eta = M.variable('eta')\n", "\n", " # The bounds w_j + r_j^Tx + eta \\geq 0\n", " M.constraint(Expr.add([W, Expr.mul(np.transpose(r), X), Var.vrepeat(eta, m)]), Domain.greaterThan(0.0))\n", " # Minimal risk\n", " M.constraint(Expr.dot(X, np.matmul(r,p)), Domain.greaterThan(rbar)) \n", " # Budget\n", " M.constraint(Expr.sum(X), Domain.lessThan(1.0))\n", "\n", " # Set the objective \n", " M.objective(ObjectiveSense.Minimize, Expr.add(eta, Expr.mul(1/(1-alpha), Expr.dot(p, W))))\n", "\n", " return M" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# LogExpCR\n", "\n", "Next we have $f(x)=\\exp([x]^+)-1$. Since $\\sum_j p_j=1$, the model can equivalently be formulated as\n", "\n", "$$\n", "\\begin{array}{ll}\n", "\\mbox{minimize} & \\eta + (1-\\alpha)^{-1} t\\\\\n", "\\mbox{subject to} & 1^Tx\\leq 1, \\\\\n", " & x^Trp\\geq \\bar{r}, \\\\\n", " & w_j\\geq \\max\\{0, -r_j^Tx-\\eta \\}, \\quad j=1,\\ldots,m, \\\\\n", " & t\\geq \\log\\left(\\sum_j p_j\\exp(w_j)\\right).\n", "\\end{array}\n", "$$\n", "\n", "The last bound (log-sum-exp constraint) can be expressed using an auxiliary variable $\\xi\\in\\mathbb{R}^m$:\n", "\n", "$$\n", "\\begin{array}{l}\n", "p^T\\xi \\leq 1, \\\\\n", "\\xi_j\\geq \\exp(w_j-t),\n", "\\end{array}\n", "$$\n", "\n", "where the last inequality is conic-representable as $(\\xi_j,1,w_j-t)\\in K_\\mathrm{exp}$." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "def modelLogExpCR(alpha, rbar, p, r, m, n): \n", " M = Model(\"LogExpCR\")\n", "\n", " # Variables\n", " X = M.variable('X', n, Domain.greaterThan(0.0))\n", " W = M.variable('W', m, Domain.greaterThan(0.0))\n", " eta = M.variable('eta')\n", " xi = M.variable('xi', m) \n", " t = M.variable('t') \n", "\n", " # The log-sum-exp constraint\n", " M.constraint(Expr.dot(p, xi), Domain.lessThan(1.0)) \n", " # Stack allcones together - every row has the form (xi_j, 1, w_j-t)\n", " # The matrix notation means that every row belongs to the cone\n", " M.constraint(Expr.hstack(xi, Expr.constTerm(m, 1.0), Expr.sub(W, Var.vrepeat(t, m))), Domain.inPExpCone())\n", "\n", " # Continue with the linear constraints\n", " M.constraint(Expr.add([W, Expr.mul(np.transpose(r), X), Var.vrepeat(eta, m)]), Domain.greaterThan(0.0))\n", " M.constraint(Expr.dot(X, np.matmul(r,p)), Domain.greaterThan(rbar)) \n", " M.constraint(Expr.sum(X), Domain.lessThan(1.0))\n", "\n", " # Set the objective \n", " M.objective(ObjectiveSense.Minimize, Expr.add(eta, Expr.mul(1/(1-alpha), t)))\n", "\n", " return M" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# HMCR\n", "\n", "The model using $f(x)=([x]^+)^q$ is the same as LogExpCR, except that the last constraint becomes\n", "\n", "$$t\\geq\\left(\\sum_j p_jw_j^q\\right)^{1/q}.$$\n", "\n", "This $q$-norm cone constraint is equivalent to\n", "\n", "$$\n", "\\begin{array}{l}\n", "t = 1^T\\xi,\\\\\n", "t^{1-1/q}\\xi_j^{1/q}\\geq |p_j^{1/q}w_j|\n", "\\end{array}\n", "$$\n", "\n", "where the last row is precisely a conic constraint involving the $3$-dimenional power cone with parameters $(1-1/q,1/q)$." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "def modelHMCR(alpha, rbar, p, r, m, n, q): \n", " M = Model(\"HMCR\")\n", "\n", " # Variables\n", " X = M.variable('X', n, Domain.greaterThan(0.0))\n", " W = M.variable('W', m, Domain.greaterThan(0.0))\n", " eta = M.variable('eta')\n", " xi = M.variable('xi', m) \n", " t = M.variable('t') \n", "\n", " # The power cones representing the q-norm constraint\n", " M.constraint(Expr.sub(t, Expr.sum(xi)), Domain.equalsTo(0.0)) \n", " M.constraint(Expr.hstack(Var.vrepeat(t, m), xi, Expr.mulElm(np.power(p, 1.0/q), W)), Domain.inPPowerCone(1.0-1.0/q))\n", "\n", " # Continue with the linear constraints\n", " M.constraint(Expr.add([W, Expr.mul(np.transpose(r), X), Var.vrepeat(eta, m)]), Domain.greaterThan(0.0))\n", " M.constraint(Expr.dot(X, np.matmul(r,p)), Domain.greaterThan(rbar)) \n", " M.constraint(Expr.sum(X), Domain.lessThan(1.0))\n", "\n", " # Set the objective \n", " M.objective(ObjectiveSense.Minimize, Expr.add(eta, Expr.mul(1/(1-alpha), t)))\n", "\n", " return M" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Example\n", "\n", "We solve a few problems with $n=100$ stocks and $m=2000$ sample historical scenarios." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " CVaR: status=ProblemStatus.PrimalAndDualFeasible time=0.20s\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAFBZJREFUeJzt3X+QXWddx/H3121aFhjYlkbHbBsSxhDoCBJcCogi8isFnTbWMqSjYxlxOox0RNE4zeCIFmcKxlFxpoN0o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7MvOXgXuBa6pijWozQGZ+A3g0IhavkP0qWtebbmxf0xrWeUlEPLn6W19sc6P7us1SfbsP+NVqFs9LgG8vDgP1LDMb8QO8HvgK8BDwjnHXZ4jt/GlaX+u+CHyh+nk9rTHuTwNfrX5fNO66Dqn9rwA+Wd1+FvA54CjwceCCcddvCO19ATBb9fde4MKm9zXwR8CXgS8BHwYuaGJfA7fTOm5xitae/JuX6ltawzu3VPl2P63ZTSt6Xf8jV5IK0pThHUlSDYa+JBXE0Jekghj6klQQQ1+SCmLoS1JBDH1JKoihL0kF+T9asd7lM1a2egAAAABJRU5ErkJggg==\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "LogExpCR: status=ProblemStatus.PrimalAndDualFeasible time=0.69s\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAFCpJREFUeJzt3X9sXWd9x/H3FzctBgRuqTctbkPCFgLVYARMgbGxjR9NYFObsaKmG1qRKlVoVDDYMjVCGlv5o7BMAyZVjAq6ARoUKFUWMTaro932zyhxCKOkJRA6oHZgBFJ302rRJHz3xz2GW/c6Pte+P+zzvF+SlXvOfc45z3Of649PnvPccyMzkSSV4QnDroAkaXAMfUkqiKEvSQUx9CWpIIa+JBXE0Jekghj6klQQQ1+SCmLoS1JBzhl2BRa78MILc/PmzcOuhiStK4cOHfpBZo4vV27Nhf7mzZuZnp4edjUkaV2JiG/XKefwjiQVxNCXpIIY+pJUEENfkgpi6EtSQdbc7B2pBPsPz7Jv6ijH5+bZODbKnh3b2LV9YtjVUgEMfWnA9h+eZe8d9zJ/6gwAs3Pz7L3jXgCDX33n8I40YPumjv4k8B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tSQQx9SSqIoS9JBTH0Jakghr4kFeT/AXXO95k7YHX+AAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " HMCR: status=ProblemStatus.PrimalAndDualFeasible time=0.64s\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAE5xJREFUeJzt3W+MXNd93vHv0xUlr2PElK1tUZKSSSEMY7VuzXQiO3XrtoltymkhEakCy6hRBRAgtIjQtG5ZiPALt0oBx2HRf4CQSojdukFj2VYIlgiQEKqktG8qhUvTFU3JrCnVkUg6FVOZblEvLJL+9cVe2sP1rnaGnOXszPl+gAXnnntm5nf2DJ+dOXNnbqoKSVIb/sS4C5AkXTuGviQ1xNCXpIYY+pLUEENfkhpi6EtSQwx9SWqIoS9JDTH0Jakh1427gKVuuumm2rp167jLkKSJcuTIkT+uqrnV+q270N+6dSvz8/PjLkOSJkqSPxykn8s7ktQQQ1+SGmLoS1JDDH1JashAoZ/kjiQnkpxM8uAy+z+e5PkkzyV5Msk7+vZdTPKV7ufgKIuXJA1n1aN3kswADwMfBE4Bh5McrKrn+7odBXpV9Z0kfxf4NeAj3b6Fqnr3iOuWJtqBo6fZd+gEZ84tsGnjLHt27WD3zs3jLksNGOSZ/u3Ayap6qapeBx4D7urvUFVPV9V3us1ngC2jLVOaHgeOnmbv/mOcPrdAAafPLbB3/zEOHD097tLUgEFCfzPwSt/2qa5tJfcBv9u3/aYk80meSbL7CmqUpsq+QydYOH/xsraF8xfZd+jEmCpSSwb5cFaWaVv2xLpJPgb0gL/S13xLVZ1JcivwVJJjVfXikuvdD9wPcMsttwxUuDSpzpxbG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tiX8F/GPge93224Fz3Ul+YDrn/FbgLPDvumWt30jyI0zxXFfVaeCfAy+zGPbfBo4w/XN9yUpzO7KMm5bQH+gE7NMkyVuA3wb+flX9n3HXs5aS/A3g1ao60t+8TNdpm/PrgJ8Efr2qdgL/jylayllOt4Z9F7AN2AT8CItLG0tN21yvZmSP92kJ/YFOwD4tkmxgMfD/Y1Xt75r/16WXe92/r46rvjXwPuDOJN9gcenuZ1h85r+xWwKA6ZzzU8Cpqnq2236cxT8C0zzXHwD+Z1WdrarzwH7gLzL9c33JSnM7soybltAf5OTtU6Fby/4M8EJV/Yu+Xf0np78X+E/Xura1UlV7q2pLVW1lcW6fqqq/BTwN3N11m6oxA1TVHwGvJLl0huyfZfF801M71ywu67w3yZu7x/qlMU/1XPdZaW4PAn+7O4rnvcC3Ly0DDa2qpuIH+DngfwAvAp8Ydz1rOM6/xOLLuueAr3Q/P8fiGveTwNe7f9827lrXaPx/Ffid7vKtwB8AJ4EvATeMu741GO+7gfluvg8AN077XAP/FPga8FXgN4EbpnGugc+z+L7FeRafyd+30tyyuLzzcJdvx1g8uumK7tdP5EpSQ6ZleUeSNABDX5IaYuhLUkMMfUlqiKEvSQ0x9CWpIYa+JDXE0Jekhvx/f7KT32zcZlYAAAAASUVORK5CYII=\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "n, m = 100,2000\n", "alpha = 0.9\n", "rbar = 0.005\n", "p = [1.0/m]*m # Uniform probability\n", "\n", "MCVaR = modelCVaR(alpha, rbar, p, r[0:n,0:m], m, n)\n", "MLogExpCR = modelLogExpCR(alpha, rbar, p, r[0:n,0:m], m, n)\n", "MHMCR = modelHMCR(alpha, rbar, p, r[0:n,0:m], m, n, q=5.9)\n", "\n", "for M in [MCVaR, MLogExpCR, MHMCR]:\n", " M.setSolverParam(\"numThreads\", 4)\n", " M.solve()\n", " print('{0: >8}: status={1} time={2:.2f}s'.format(M.getName(), M.getProblemStatus(), M.getSolverDoubleInfo(\"optimizerTime\")))\n", " plt.plot(M.getVariable('X').level(), 'o')\n", " plt.show()\n" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "
This work is licensed under a Creative Commons Attribution 4.0 International License. The **MOSEK** logo and name are trademarks of Mosek ApS. The code is provided as-is. Compatibility with future release of **MOSEK** or the Fusion API are not guaranteed. For more information contact our [support](mailto:support@mosek.com). " ] } ], "metadata": { "anaconda-cloud": {}, "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.4" } }, "nbformat": 4, "nbformat_minor": 1 }