Back

Competition Algorithm Example: Tiingo NLP Sentiment

We've written a simple Alpha Model, Tiingo NLP Sentiment, as an example of how you can use the alternative data into your own Alpha Model for the competition.In this algorithm, we use Tiingo's News to filter for Technology ETF in the universe.

The Alpha Model takes a collection of the highest volume ETFs related to technology stocks in the TechnologyETFUniverse, collects words indicating the sentiment, and scores the positive or negative side of the news for each asset. The sum of the sentiment score is calculated for each security and then used as a proxy for the direction and weight of the insights. We take a long position in the top 10 assets by sentiment ranking. The algorithm emits 10 insights per day.

One of the limitations with this model is that the words used are not exhaustive and more could be added to better categorize positive and negative sentiment. The sample size, accuracy of describing a trend of an asset, and the scoring scale determine the trade signal and algorithm's performance. Generally speaking, the larger the sample size,the more precise the scoring scale is, and the more accurately the signal. If we polish the description words sample pool, the result should reflect this more refined.

Update Backtest






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.



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 Yiyun, thanks for the Algorithm. I wanted to extend the algorithm by using VaderSentiment instead of a word lookup. 

https://github.com/cjhutto/vaderSentiment

VaderSentiment is a part of the NLTK package. In order for it to work I have to download the vader lexicon using nltk.download("vader_lexicon"). However this is not possible (

connection failed: 403 Forbidden

), I guess this is due to security reasons. Is there any way around this? 

0

Alright here is my version. It uses VaderSentiment to analyze the sentiment. I managed to upload the dictionary to dropbox. I also changed the SentimentIntensityAnalyzer class from nltk in order to be able to retrieve the file. It works quite well! 

3


Hello Lukas,

Firstly, it is very generous of you to problem solve and then share your solution. 

I cloned the code for the above backtest in order to analyse your code for myself. Though I faced a problem; in trying to backtest the codei get the below error.

During the algorithm initialization, the following exception has occurred: TypeError : __init__() takes 1 positional argument but 2 were given
at Initialize in main.py:line 21
:: self.SetAlpha(NewsSentimentAlphaModel(self.vaderData))
TypeError : __init__() takes 1 positional argument but 2 were given

However I try to resolve it, when I backtest it the Algo breaches the 1.5 minute time limit in the 'Analyzing Strategy' step of Initiating the backtest. Any suggestions on how to resolve the issue would be greatly appreciated.

Regards,

Bolgac Gulen 

1

Hi Bolgac,To fix this, we need to add vaderData as a parameter in the constructor of NewsSentimentAlphaModel. Please see the attached backtest for reference (note: I added SetEndDate to reduce the backtest time)Best,
Shile Wen

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