Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Can Google Trends search queries contribute to risk diversification?

Hi guys,

Here is an interesting follow-up on the Google Trends strategy that we discussed recently.

This paper was published last week at Scientific Reports (same journal that ran the Google Trends and Wikipedia strategies). The idea is really similar but they trade a whole portfolio where each stock is weighted inversely to the search volume of that stock.

Here is the link to the paper:
http://www.nature.com/srep/2013/130919/srep02713/full/srep02713.html

I'm not convinced that this is really a great strategy (it might very well not be) but I think it would still be cool to try and reproduce this strategy on Quantopian to see if it the results can be replicated with a more realistic backtesting engine.

Anyone want to help?

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.

11 responses

I would definitely like to try to implement this!

I think there are several steps involved in making this work:

1st phase: Data processing
1. Download the individual search volumes from google trends over the time range specified in the paper as files.
2. Parse the downloaded files to be in csv format that can be read by fetcher. Dennis provided some code for this in another thread.
3. Merge all individual files (one for each stock) into one with one column for each stock.
4. Upload file to where it is publicly accessible.

2nd phase: Algorithm building
1. Use fetcher (see the docs) to pull that data into Quantopian
2. Implement algorithm logic

Feel free to just do individual parts and post the results on here.

Thanks Thomas!

I've just printed out the paper and will read it this evening. I'll start at the data processing phase and you keep you posted with the results.

@Anony: This looks really cool and worth exploring, thanks for sharing. I think this would deserve its own thread, however, unless I'm missing some connection to the google trends paper?

Hi Thomas,

I might be interested in helping, if anything, just to learn more Python and some additional Quantopian functionality. However, you seem pretty pessimistic about the approach, so I'm wondering if it is worth the effort. There are a lot of published ideas out there (e.g. https://www.quantopian.com/posts/trading-strategy-ideas-thread). If we're gonna work on something, it might as well be something we think has promise.

Also, collaborating on code in Quantopian is, frankly, a pain. I think that using github would be the best approach (although it is not integrated with Quantopian). Did you abandon the idea of using https://github.com/quantopian/quantopian-algos as a collaborative space?

Best regards,

Grant

Hi Grant,

Thanks for offering to help out. Maybe my post was a little too pessimistic. I do think that using these sources of data hold lots of promise and this is a great place to start. Whether we'll strike gold with their approach I am not sure but it's a door and who knows.

I agree that there is a lot that can be done to improve collaborations on Quantopian (we had some discussions on how this can be done a little while ago). I think what we did with OLMAR on github back then worked quite well actually (despite the copying back and forth) so maybe that's a good place to start.

Thomas

Thanks Thomas,

For your first phase above, my thought is that in the end (assuming the approach or something like it works), some sort of automated, script-driven data feed will be needed for paper/real trading. In my mind, one of the goals here is to sort out how such a script could be implemented (rather than just running it from a pc, and then manually uploading the data). I know that Quantopian doesn't have this capability, right? Are there other sites that support setting up a script (on a 24/7 server) that would grab data and dump it into a csv file, according to a regular schedule? The script support wouldn't necessarily need to be Python. Something like a Linux remote desktop would be nice.

As a side note, I was wondering if you guys have to be careful not to appear as "investment advisors" to stay clear of regulatory problems?

Grant

Hi Grant,

Yeah, I think implementing published trading strategies that have great performance up to now in a foward-test is very insightful into how much overfitting has taken place. Certainly any strategy that depends on external data will require a server that fetches, converts and stores the data for the paper trading algo. It does sound this would be quite an undertaking even though it might be very worthwhile for these things.

Thomas

Hello Thomas,

What's the thinking at Quantopian regarding the use of fetcher for paper/live trading? Has anyone devised a scheme for automatically updating their csv files?

Grant

Hi Thomas and Grant,

Maybe we could use a service like Heroku (Platform as a Service (PaaS)) since they support Python or others...

https://devcenter.heroku.com/articles/getting-started-with-python

Then find a python app you want to clone on github and there is a way to clone from github into heroku

http://stackoverflow.com/questions/14667722/clone-a-github-app-to-heroku

Next thing you know the scripts can be published and can be accessible over SSL to the fetcher... I think this could work, haven't done it yet.

Miguel

Thanks Miguel,

Sounds cool. Have you used heroku before?

Grant