Hi @Lionel,
Thanks very much for posting this paper! I think there are some useful ideas here. I have worked with CVaR optimization (per the Uryasev paper you link to) as well as the L1 risk measure (i.e., MAD) per Konno. I was initially attracted to them because they are linear programming problems. However that was because, at the time, we did not have cvxpy
white-listed on Quantopian. Today with cvxpy
I don't think you need to be averse to quadratic terms. Anyhow, I think these methods have use as risk constraints not as objectives. You need to have some exogenous alpha vector to work in here. For example, I have an implementation of the L1 risk constraint here.
Here is an implementation of optimization with a limit on CVaR (thanks to Scott Sanderson for the insight that avg_worst_returns = cvx.sum_smallest(portfolio_rets, nsamples) / nsamples
captures the CVaR):
def calc_opt_cvar_weights(
alpha_vector,
hist_returns,
max_risk=-0.01,
cvar_ptile=0.95,
max_position=0.05,
lookback_days=520):
num_stocks = len(alpha_vector)
num_days = len(hist_returns)
A = hist_returns.fillna(0.0).as_matrix()[-(lookback_days-1):, :]
x = cvx.Variable(num_stocks)
nsamples = round(num_days * (1-cvar_ptile))
portfolio_rets = A*x
avg_worst_returns = cvx.sum_smallest(portfolio_rets, nsamples) / nsamples
objective = cvx.Maximize(alpha_vector*x)
constraints = [
avg_worst_returns > max_risk,
sum(x) == 0,
sum(cvx.abs(x)) <= 1,
x <= max_position,
x >= -max_position
]
prob = cvx.Problem(objective, constraints)
prob.solve(verbose=False)
print prob.value
sol = np.asarray(x.value).flatten()
return sol
I hope to find some time to work through the Minimax risk constraint.
Disclaimer
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.