Leveraged ETF Variance optimisation strategy


Here is a template strategy ETF rotation strategy, it attemps to optimize the variance of a combination of ETF using a contrained Optimizer (Accord Cobyla method).

I'm sharing for feedback, It is not complete I've left out ETF universe selection and money management but it still produces interesting results (beware of QC data issues for TMF 8/25/2016 if you backtest a long period).

I'm looking for comments/feedback on the C# code as I've not done any C# since .NET2.0 and it is not as straight forward to deal with matrices and vector as it is in scipy/python.

There are 2 files in addition to the Main.cs: 

- ComputationExtensions where I've added some matrices/vector operations like double[].StdDev(), reusable for other strategies...
- Optimizer where I parked all my Accord library call to avoid extension clashes, and where I have the variance optimisation which uses the Cobyla optimisation which decides which "optimal" weights to apply to the selected ETFs

As for improving the base strategy, you can broaden the universe selection and change it dynamicall based on ETFs correlations, add some VIX/trend controls to limit DD, You can also play with the rebalancing frequency...

It should/could also work for non leveraged ETF or combination of stocks and ETFs ...

Update Backtest

Hello, thanks for sharing.

Because I am uneducated about this method, can you give a quick summary on its objective? Is it essentially going for high Sharpe ratio? Or is the aim specifically to be able to endure the variance in leveraged ETFs?

I ran it outside the preset window and results looked less encouraging, but I'm probably missing something.


yes, that's pretty much sharpe optimisation, it attemps to minimize the viariance of the combination of ETf with a sharpe threshold for the whole things, so it basically tries to improve the sharpe of the best performing ETF. Obviously this is based on past data, so it assumes that the correlation and momentum will continue... 

As for the results, this is jsut an illustration of how to optimise your portfolio

=> if you include the 8/20/2015 with TMF you'll get a 75DD due to a data issue @ QC

=> it won't perform well all the time because the algo needs safeguard/risk mgmt and you also want to ensure that the basket of ETF optimised isn't too highly correlated, 

This might be a second step in the algo: You could imagine a list of ETF and then computing for all or some of the ETFs combination the weights and taking the optimal score, which I have not tested. At the moment, I'm more focused on risk mgmt to make it tradable.


Update Backtest


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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed