The Quadratic Programming Solver -- Experimental |
Consider a portfolio selection problem with a slight modification. You are now required to take into account the current position and transaction costs associated with buying and selling assets. The objective is to find the minimum variance portfolio. In order to understand the scenario better, consider the following data.
You are given three assets. The current holding of the three assets is denoted by the vector = [200, 300, 500], the amount of asset bought and sold is denoted by and , respectively, and the net investment in each asset is denoted by and is defined by the following relation:
The problem can be solved by the following SAS code:
/* example 3: portfolio selection with transactions */ proc optmodel; /* let x1, x2, x3 be the amount invested in each asset */ var x{1..3} >= 0; /* let b1, b2, b3 be the amount of asset bought */ var b{1..3} >= 0; /* let s1, s2, s3 be the amount of asset sold */ var s{1..3} >= 0; /* current holdings */ num c{1..3}=[ 200 300 500]; /* covariance matrix */ num coeff{1..3, 1..3} = [0.027489 -.008740 -.000150 -.008740 0.109449 -.000120 -.000150 -.000120 0.000766]; /* returns */ num r{1..3}=[1.109048 1.169048 1.074286]; /* minimize the variance of the portfolio's total return */ minimize f = sum{i in 1..3, j in 1..3}coeff[i,j]*x[i]*x[j]; /* subject to the following constraints */ con BUDGET: sum{i in 1..3}(x[i]+.01*b[i]+.01*s[i]) <= 1000; con RETURN: sum{i in 1..3}r[i]*x[i] >= 1120; con BALANC{i in 1..3}: x[i]-b[i]+s[i]=c[i]; solve with qp; /* print the optimal solution */ print x; quit;
The output is displayed in Output 12.3.1.
Output 12.3.1: Portfolio Selection with Transactions
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.