I have a few bonds and OAS and Duration for each. I had a Linear programming type of problem where I had to maximize OAS and keep duration <= constraint. There are few other constraints. I could easily model them using linprog in MATLAB.

Unfortunately the portfolio turnover is too high. I want to put a constraint on this turnover. Something like 10% of total portfolio. Since it is not a linear programming problem anymore I am a bit stuck. Any thoughts will be greatly helpful?


2 Answers 2


At each rebalancing day, you were previously maximizing

$$ \vec{w}^* \vec{r} -\lambda \vec{w}^* \Sigma \vec{w} $$

Now, you need to combine this with a way of expressing your trading constraint mathematically. Let's say your previous weights were $\vec{p}$. Then your 10% constraint translates to specifying that

$$ 0.1 \geq \sum |w_i-p_i| $$

This can be handled by fmincon, or perhaps even by some of Matlab's simpler optimizers.

  • $\begingroup$ the constrain is what I am trying to implement. I will try fmincon and update $\endgroup$
    – ash
    Oct 2, 2014 at 17:06
  • 1
    $\begingroup$ Just a small addon: some optimizes like to handle positive linear constraints best. Then it is one way to introduce additional variables $b_i \ge 0$ and $s_i \ge 0$ for weights bought, weights sold all positive. Then new weights are $w_i = p_i + b_i - s_i$ which can be formulated as constraint. And finally $\sum_{i=1}^n b_i + s_i \le 0.1$. One has to take extra care for new instruments and those who leaver the universe. $\endgroup$
    – Richi Wa
    Oct 3, 2014 at 6:45
  • 1
    $\begingroup$ @Richard It's not just them being positive, it's the piecewise nature of the constraint. Optimizers that require continuous functions will tend to not like it when you use absolute values. Also, this approach can easily be extended to include transaction costs, though you probably need to add in non-linear constraints $b_{i}s_{i}=0$ to ensure that sells are zero if you have buys, and vice-versa. My recollection is that it's not usually needed for turnover, but there might be cases where it is. $\endgroup$
    – John
    Oct 3, 2014 at 16:11

Thanks all for the adivse. I tried fmincon . Unfortunately it was not converging to any solution and I was not getting an idea of which constraint is breaking it and which direction I should modify the constrain to reach a solution. So this is what I finally did.

  • Continue using linprog for optimization.
  • Calculate $w_b$ and $w_s$ and calculate the portfolio churn as $w_c = w_b+w_s$
  • if $w_c > 0.10*w_{total}$
  • Create a vector of rates duration such that $\delta_r \in [\frac{\delta_{rTot}}{10},\delta_{rTot}] $
  • Create a vector of spread duration such that $\delta_s \in [\frac{\delta_{sTot}}{10},\delta_{sTot}] $
  • For each $\delta(i)_r$ I draw spreads from $\delta(1)_s...\delta(10)_s$ and re-run linprog . I save each successful solutions $\delta(i)_s$,$\delta_r(j)$,OAS and $w_c$.

Hence in the end I have all the feasible solutions and corrosponding boundries of durations. Now I can suggest a few optimial portfolios with acceptable durations , OAS and transaction costs. (I have a function which models this for me based on Outstanding Amount , buy/sell Amounts etc) It is brute force but works for me. This wasy I not just know the infeasibles but also all posible feasibles under an investment strategy be it

  1. Increade OAS and keep spread and duration under a boundry
  2. Keep OAS same but reduce durations
  3. A combination of the two with low transaction cost

Just wanted to let other know in case it provide any help to anyone.


I ended up coding up using fmincon . I modelled the obective to increase the OAS and non linear constrain bit as

function [c,ceq]=NonLiniearConstraints(~,x,w_i)
    churn = 0.10;
   res = sum(abs(x-w_i));
   c(1) = res - 2*churn; % Buy + Sell = Total churn 
   ceq = [];

I verified that it produces same results as that of isqlin which tries to minimize churn using least sqaures meathod. So I have marked Brian's answer as the correct one.

  • $\begingroup$ I have to unmark my own answer. I dont think it is a good solution. Reading through few papars on how to implment this propely. Will update if I complete. $\endgroup$
    – ash
    Oct 6, 2014 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.