# [R-SIG-Finance] Portfolio Min Variance Optimisation with Turnover Constraints

Graham Ewen graham.ewen at bluecrestcapital.com
Fri Apr 10 18:54:46 CEST 2015

```Hi,

I am new to using R for optimisation and I am trying to set up a simple portfolio minimum variance optimisation with turnover constraints, but am having some difficulty setting up the problem correctly. I would really appreciate any help. I am trying two approaches one using the Rsolnp library and the other using the the parma library, but am having trouble with both.

Using Rsolnp I am having trouble getting the optimisation to converge, but this may be that the problem is poorly conditioned but please advise if the formulation seems correct.

ineq.fun.turnover <- function (x, sigma, wInit)
{
return(sum(abs(x - wInit)))
}

obj.fun <- function(x, sigma, wInit)
{
return(as.numeric(x%*%sigma%*%x))
}

eq.fun <- function(x,sigma,wInit)
{
return(sum(x))
}

tst <- solnp(initWeights, fun=obj.fun, eqfun=eq.fun, eqB = 1.0, ineqfun = ineq.fun.turnover,
ineqLB = 0.0, ineqUB = 0.2, LB = rep(0,numberOfSecurities), UB = rep(0.1,numberOfSecurities),
sigma = covarMatx, wInit = initWeights)

Where initWeights is a vector of length numberOfSecurities, and the covarMatx is a covariance Matrix (generated from a factor model) of dimensions numberOfSecurities by numberOfSecurities.

Using parma, I cannot seem to get parmaspec to recognise the turnover constraint inequality functions (using the custom ones in the library), so I am guessing I am using incompatible parameters.... ?

servars = list()
uservars\$turnover <- 0.2
uservars\$wold <- initWeights

spec2 <- parmaspec(S = covarMatx,  LB = lowerBounds, UB = upperBounds,
risk = "EV", riskType = "minrisk",
ineqfun = list(ineqfun.turnover.min), ineqgrad = list(ineqjac.turnover.min), uservars = uservars)

It simply tries to solve the QP min risk problem ignoring the turnover inequality.

Thank you,

Graham.

Graham Ewen
BlueCrest Capital Management (UK) LLP
40 Grosvenor Place, London, SW1X 7AW, United Kingdom
T  +44 20 3180 3530
graham.ewen at bluecrestcapital.com<mailto:graham.ewen at bluecrestcapital.com>
[Description: Description: Description: Description: Description: Description: Description: aaaBlueCrest Capital Management (UK) LLP Logo]

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. Any market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of BlueCrest Capital Management (UK) LLP, its subsidiaries or affiliates.

BlueCrest Capital Management (UK) LLP is authorised and regulated by the Financial Conduct Authority. BlueCrest Capital Management (UK) LLP is registered in England and Wales with registered number OC349662. Registered Office: 40 Grosvenor Place, London SW1X 7AW, United Kingdom.

Please see the important information at www.bluecrestcapital.com/disclaimer.

Tel: +44 (0)20 3180 3000 Fax: +44 (0)20 3180 3001 www.bluecrestcapital.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20150410/30a104db/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 6616 bytes
Desc: image001.png
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20150410/30a104db/attachment.png>
```