Back

Using Majority Party in the Senate to Trade Firearm Stocks

Hi everyone, 

I read an article in the Wall Street Journal about how firearm company stocks tend to swing depending on which party holds majority office in the Senate. I created a simple alpha depicting this and wanted to share it.

When I finish up my other projects, I will see if it is possible to use Tingo News data to pull senate election results and machine learning to determine the effect on the guns industry. 

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.


Hi Jovad,

Interesting strategy.

Just note that

self.Securities[i].SetDataNormalizationMode(DataNormalizationMode.Adjusted)

is not neccessary as Adjusted is the default option.

To further test the theory behind this strategy, I've attached a backtest below which makes the strategy logic symmetrical. That is, if Democrats hold majority office, we long each symbol; If Republicans do, we short. See the attached backtest for reference.

Best,
Derek Melchin

2

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.


"An example of an indirect influence on markets is the announcement of a new military venture by a country in response to the outbreak of civil unrest or conflict abroad. This announcement likely would cause the price of the stocks of military equipment and weapons manufacturers to rise due to an expected increase in defense contracts, which in turn can raise the value of stocks for companies that supply military equipment parts and technology. It likely would raise the demand for, and price of, natural resources used to make these parts, which would raise the price of stocks representing particular mining and natural resource processing companies."

Maybe you can add this effect to the algorithm [when you add news reading] ...

2

Thank you Derek and Miriam. 

I implemented a simple sentiment analysis into the alpha. However, more research regarding the keywords needs to be done. Miriam, right now the analysis is only scanning articles pertaining to the specific stocks. Soon it will also scan articles about military ventures. Hopefully, with these upcoming changes, we can increase the alpha and lower the variance of this strategy. 

The alpha still has some flaws. However, I will explain some of the changes made:

1st: Insight direction is determined by total points

2nd: 3 points are added if majority senate is Democratic and -3 points for Republican.

3rd: Points are added or removed by sentiment analysis

4th: If total points are greater than 10, Long. If total points are less than -1, short.

All values were determined based on the distribution of total points logged over a period of time. Further improvements can be made by the better justification of these values. 

Working on this side project has been a lot of fun. 

1


Hi Jovad,

There are a couple improvements we can make on the above implementation.

First, we can simplify the calculation of `politicalPoints` into a one-liner instead of looping:

politicalPoints = 3 * (1 if self.senators[algorithm.Time.year] == 'D' else -1)

Secondly, the above algorithm has a guard to only emit insights once a month. This guard is before the code that fetches data from the TiingoNews. Thus, only a small fraction of the news articles are actually being analyzed by the alpha model. We can fix this by moving the sentiment analysis code or increasing the ETF resolutions to the second level. See the attached backtest for reference.

Going forward, I'd recommend adding a warm-up period for the RollingWindow of sentiment analysis. Our documentation provides an example of making a History request with the TiingoNews data source.

Best,
Derek Melchin

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