1
$\begingroup$

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,
                   A_mod@y.T >= 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):

A

and b holds the DV01 Limits:

b

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.

Backtesting

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?

$\endgroup$
1
$\begingroup$

Do you have correctly formulated the problem for the solver ? If you want to maximise a function (the sharpe ratio) $f$, it is equivalent to minimise $-f$. This kind of confusion (minimising instead of maximising) would basically lead to a similar outcome as yours.

$\endgroup$
  • $\begingroup$ Yes, problem is formulated correctly. I double checked with another approach to solve this and the results were the same. To my understanding the problem arises due to not updating Covar Matrix on adjusted expected returns. For those interested I was able to solve this with Black Litterman Formula which then leads to very nice results. $\endgroup$ – R. Steigmeier Jun 21 at 5:22
  • $\begingroup$ Try without the contraints, Indeed, given them, you definitely not have the maximum sharpe Ratio. And if covariance matrix is not so well defined, portfolio optimisation can tend to overweight some assets it considers as "free lunch". One idea, could be that, given the constraints, it mainly focuses on the risk of the portfolio and tends to reduce it to the minimum and given the upwer trend, that leads to underperformance compared to the index. Having the greatest sharpe ratio does not mean having the greatest return. $\endgroup$ – JeanGuillaume Jun 21 at 7:55
  • $\begingroup$ Very good point! $\endgroup$ – R. Steigmeier Jun 21 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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