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
- Increade OAS and keep spread and duration under a boundry
- Keep OAS same but reduce durations
- A combination of the two with low transaction cost
Just wanted to let other know in case it provide any help to anyone.
EDIT
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 = [];
end
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.