Back to Community
Long/Short trading strategy w/ ML forecasted stock returns

Current status: Algo has been taken down while we fix an issue with the code!

Hey folks,

We recently released Logitbot's 100/500 ML stock return predictions datafeed into Pipeline and wanted to show you how to use it in an algorithm. This is a version of Logitbot's algorithm that's been ported over to be Q2 and utilizes the pipeline.

This algorithm hosts a few improvements over the original:

  • Limiting the number of stocks held to 200 to control leverage (which is settable)
  • Closing the positions that are held for longer than 5 days whereas the original strategy simply held securities
  • Picking the highest and lowest predicted returns (rather than just ones that pass the threshold)
  • Buying long term bonds when enough stocks don’t fit the criteria
  • Using Logitbot's data through Pipeline with data since 2010 rather than their sample file

For those curious about the data, they've also published a notebook detailing a bit more of their methodology.

Happy coding!

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.

9 responses

thanks. Cant run the algo. I get following error:

Error Runtime exception: UsageNotAllowed: You do not have access to the following dataset(s): logitbot.precog_top_500_free (enable access at https://www.quantopian.com/data/logitbot/precog_top_500 )

when going to the link there is no button to enable access for free dates specified available for free

Joe the Logitbot data is not available for free - it is premium data and you would need to pay for a subscription.

Thanks for the response, however, this is not what is written in the link https://www.quantopian.com/data/logitbot/precog_top_500

it says "Free data availability 01 Jan 2010 - 28 Sep 2016", it just they dont give a way to activate it, seems like bug.

Hey folks, sorry about that - mind giving it a shot now?

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.

You're right Joe, I missed that.

@Seong - I just tested it up until 27th Sep and it worked - thanks.

thanks, now it works. I just re-run the algo as is and the results are very bad and differen from the above. something is wrong with the data . Seong, can you please check ?

Clone Algorithm
6
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 57fe5d487148a512bba1438c
There was a runtime error.

To figure out what secret ML Long-Short part of the algo is making itself, just replace TLT by SHV and compared to 3 month TBill ETF SHY.
Conclusion: Not accounting borrowing costs ML Long-Short part making less then SHY and more volatile.
Do not recommend anybody to use this ($135/month) junk.

Clone Algorithm
6
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 57fe5cf9a2de62105631cc3c
There was a runtime error.

Vladimir,

Thanks for taking the time to look into it, the logic of the strategy definitely seems to be volatile!

I think our goal with this example strategy, was just that, an example. We fully believe that folks like yourselves are much more capable of building fully fledged algorithms and hope to do so!

Thanks again for your feedback, and if you had thoughts on how to improve the logic of this strategy, we'd love to hear it!!

Seong

@joe - Your performance might be impacted because of the smaller capital size and different backtest time frame

Thanks for all the feedback! Again, this is more of a showcase of how to implement and use the data with pipeline in the IDE. By no means is this a robust trading strategy - just an example of how to incorporate Logitbot's signals.