StockTwits API: integration for backtesting
Author: mikesblack
Creation Date: 12/29/2012 1:12 PM
profile picture

mikesblack

#1
http://www.quantshare.com/sa-496-sentiment-analysis-how-to-measure-the-sentiment-score-of-your-stock-tweets

Hi- As a related topic I had recently brought up on social media, have you looked into StockTweets api for integration into Wealthlab for users? Not sure if it is practical, time consuming or expensive. I do understand the historic data( short history) is available from select vender, e.g. "Gnip Partners" http://gnip.com/pr_announcing_marketstream_and_stocktwits/, but am not aware of expense or availability of such data.

If you know about or believe it is something that could be integrated, I would be quite interested.

Have a great New Year!

Mike
profile picture

Cone

#2
Looks interesting. I'll bet Eugene is already halfway done with it :)
profile picture

Eugene

#3
You're giving me too much credit Robert. ;) Mike requests to implement two different APIs: StockTwits JSON API (as the data source) and Alchemy XML API (for its sentiment analysis).

* StockTwits returns only 30 latest twits and their signal-to-noise ratio might not be top notch.
* Alchemy is a black box. A good example of its accuracy from Stackoverflow: Sentiment analysis api/tool, for Java.

Anyway, why not give it a try. I'll put it in my queue.
profile picture

Eugene

#4
As soon as we're able to upload extensions on the website again, support for both StockTwits API and AlchemyAPI will appear in Community Components.
profile picture

Eugene

#5
StockTwits API and AlchemyAPI have been added to Community Components 2013.05:

http://www2.wealth-lab.com/WL5WIKI/StockTwits.ashx
http://www2.wealth-lab.com/WL5WIKI/AlchemyAPI.ashx
profile picture

mikesblack

#6
Thank you!
profile picture

mikesblack

#7
I just obtained an API key from Alchemy, created the two examples listed above and have some questions pertaining to this topic.

1. It seems I am able to see the latest twits which has symbol name , an int and a floating point number, which I believe to be the rank and score. Both programs seem to produce the same output. What are the differences between the two examples? Am I overlooking something?
2. Can I apply the "Stock Twits" data to a system. E.G. if ( score crosses above moving avg of scores buy at market.) ,etc...
3. If it is possible to create a back test on a portfolio of symbols?
4. Is it possible to request a new Active Trader Strategy based on "Stock Twits" for next month?

Examples help me understand the concepts and process better.

Thanks in advance.

Mike
profile picture

Eugene

#8
1. The difference between the two examples is that these APIs belong to two different companies and serve entirely different purposes. One grabs the contents of 30 latest twits and another does a full-text sentiment analysis (on any contents). The code examples are pretty self-descriptive.

2. Please feel free to experiment and share your findings with the community.

3. Would you consider 30 latest twits enough for a robust backtest?

4. Of course you can request, the question is whom?

For your information, Active Trader Magazine has been disbanded since 2014. Between late 2006 and the end of 2012 I published over 70 articles under the name of my boss Volker Knapp (and two pioneer/exclusive ones on Wealth-Lab Moving Average and Google Trends as Gene Geren, my second name). My writing career is over I am not willing to write any more ever.
profile picture

mikesblack

#9
That's funny, but perhaps one day you might start writing more articles. You have tons of insight about the trading the markets and would love to read more from you. Maybe a book? I'll be the first to buy.
1. I understand the differences. Thanks
2. If I can add anything I will be happy to share.
3. So, let me understand this. We only have 30 twits at the time of testing. Does the database contain historic twit data? I tested different 2 day periods this year and last year, but the results are still the same.
4. If it is feasible would you be interested?
profile picture

Eugene

#10
3. I only coded it three years ago for you and never used it since then. If I were in your place I'd visit their website to find out from the horse's mouth.

4. Sorry but no, I am not interested in writing.
profile picture

mikesblack

#11
I'll contact Alchemy to see what I can find out. In fact I have planed a demo from them some time next week.

If I do find out something, I'll post back here.
profile picture

Eugene

#12
Keep in mind that you can not make more than 200 requests per hour with the StockTwits API. Such is the limit for non-authenticated users, and authentication would bump it not enough to waste my time on it. The same with pagination which would allow to request up to 800 twits vs. 30. You can call me skeptic but this sounds quite unpractical to me to waste 2-4 hours to download some twits for a single stock. Just to be clear: since this topic gets extremely small user interest, I will not dedicate time into further developent of this single-user solution.
profile picture

mikesblack

#13
Thanks for the info Eugene. I think It's not worth it too.
profile picture

Eugene

#14
No one has noticed but AlchemyAPI had been acquired by IBM back in 2015, and the legacy service was deprecated in Spring 2017. As the transaction to IBM Natural Language Understanding (AlchemyAPI successor) seems challenging and the user base is not enough to justify further development and support, we are decommissioning the AlchemyAPI connector and removing it from C.Components.
profile picture

Eugene

#15
Warning: a captcha at Cloudflare may prevent from accessing the StockTwits API (depends on country). It appears as if the C.Components no longer works. If you're affected, use a VPN.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).