Back

Python/Twitter REST Api

Hey guys, I've been looking through the forums and documentation trying to find a way to get tweets into the QC environment. I found this article but it looks like it's geared more towards local LEAN implementations (and C#):

https://www.quantconnect.com/blog/twitter-data-scraper-with-c/

Are there any examples of gathering Twitter data like this to access specific users, tweets, timeframes, etc.? Is this even something that the online QC environment can do?

Update Backtest







0

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.


Hey Brad, this would fall under importing your own custom data. It's not very efficient to make a lot of rest calls during backtests as this can slow down the backtest dramatically. You can package it up and store it in a dropbox for your backtest to consume. In live trading, you could hit the API to pull down the tweets you need. None of this is Alpha Stream approved yet but we hope to add more data sources soon. 

1

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.


Ok awesome!  I've seen one example where there was a logic switch for the custom data that could either use the REST or RemoteFile modifier if it was live or not.  So for this case backtest would use the RemoteFile for a csv and for any live trading it would use REST?  Do you know if there's anything special required on the LEAN side to access Twitter streaming for live trades with REST?  I'm a little unsure how LEAN communicates with other servers like Twitter when using REST but am under the assumption that with the REST modifier and server address it would pull whatever data is available?

Thanks for the help!

0

I'm not sure you'll be able to bind to live streaming (REST is not the same as streaming). You can make simple REST requests though so if you have your code set up properly it'll be fine. 

1

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.


Update Backtest





0

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.


Loading...

This discussion is closed