I'm trying to solve for a maximum sharpe ratio portfolio in the fixed income space. To do so, i use CVXPY in python. I use this Paper as reference.
This is my "setup":
## SET UP PROBLEM C = np.asmatrix(new_cov) mu = np.asmatrix(s['E(r) after FXh']/100) mu0 = np.asmatrix(cleared_swaps.iloc[z]['CHF1']/100) ## INITIATE WEIGHT VARIABLE y = cp.Variable(len(framework)) # DEFINE CONSTRAINTS AND MODIFY FOR QUADRATIC PROBLEM A_mod = A - b.T ## CREATE CONSTRAINTS constraints = [(mu-mu0)@y==1, 0 <= y, [email protected] >= 0] ## FORM OBJECTIVE obj = cp.Minimize(cp.quad_form(y,C)) ## FORM AND SOLVE PROBLEM prob = cp.Problem(obj, constraints) try: prob.solve() w = y.value/sum(y.value) w[w<=0] = 0 w = w/sum(w)*1 except: print('Exception. Using Market weights') w = np.repeat(df_mkt_val_pct.iloc[z][live_currencies.index.tolist()].values,2)/2 w = w/sum(w)*1
Where A basically holds the Subportfolio Duration (for example different EUR Durations):
and b holds the DV01 Limits:
Now when I run this script the portfolios I get are "inversely optimized" meaning that I'm constantly underperforming the index. If I then kind of reverse the optimal weight (for example I add the underweight in one currency to the BM weight so that I end up with an overweight) then the returns are as expected.
But this behavior is weird in my opinion. Is there a way how to "flip" the optimization so that I guet the optimized values which I can then use without having to "inverse" them?