Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
optimize MaximizeAlpha open source implementation

Hi Quantopian,

Can you please point me to the open source implementation of Quantopian.optimize's objective and constraint algorithms like MaximizeAlpha, Target weights and what is the optimize method used ie scipy.optimize.minimize? I'm building algorithms that use these algorithms, but want to understand the underlying code and assumptions to see if I can make my algos better.

Thanks!

3 responses

Hi John,

The code for the Optimize API's objectives and constraints is not available in open source libraries. However, there are some thorough explanatory materials in the forums worth going through to understanding the theory behind the optimizer. The second post in this thread by Scott Sanderson contains an updated notebook that walks through the logic behind objective and constraints and a few examples.

You can compare your algorithms' use of the MaximizeAlpha objective to the example algorithm in Lesson 7 of the Getting Started Tutorial. Likewise, this example algorithm from the API Reference page exemplifies the TargetWeights objective.

I hope these help with the development of your algorithms.

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.

Hi Robert -

I've seen this basic statement repeated for many months now:

The code for the Optimize API's objectives and constraints is not available in open source libraries.

There was a decision not to provide the code, and presumably you have no plan to reveal it (although I agree that you have provided some background on the underlying computations).

I view this (and the risk model and QTU code) as a departure from Quantopian's tradition of open-sourcing code, wherever possible. I understand that in some cases, the code may not integrate with the open-source zipline. However, it would still be beneficial and in the spirit of your enterprise (at least as I understand it), to publish the code, and maintain it in a public repository.

Could you shed a bit more light on the situation here? In my opinion, it has always been mutually beneficial to Quantopian and its user base to have access to source code. So, not publishing it would seem to be counterproductive.

I agree with Grant! The optimization methods are still a black box inspite of the literature that has been released around it. It will be very helpful for users to have more transparency around these methods so that they can understand and maybe tweak it as necessary to achieve the desired effect.