Timing the Stock Market with Congress

Posted on Mar 21, 2023

Shiny App

Watch My Presentation

Github Repository

 

Background

This is an exploration and analysis of the trades made by Congress members over the past 9 years.

There has been increased public scrutiny around insider trading in Congress. Being in that position of power and having insight into so many aspects of society can lead to a conflict of interest for investments made by people in Congress. It undermines public trust in the government’s integrity in serving the public interest. This issue has been on my radar since March 2020 when a few prominent senators fell under heavy scrutiny over claims they used insider knowledge about the impending coronavirus crisis to sell shares before prices plummeted.1

I became even more intrigued once I realized that these trades were required to be reported to the public in a timely manner and that that investors referred to  these reports in deciding which stocks to buy and sell.This type of news gained so much traction that two ETFs started trading on the market on February 8th 2023 where tickers NANC and KRUZ buy and sell securities based on an analysis of the Financial Transaction Reports submitted by  Congress members.2

The entire situation is a giant gray area with a huge lack of enforced regulation.  The New York Times recently completed a massive analysis of  97 congress members and potential conflicts  between their committees and stock market activity.3 This investigation, which was a major inspiration for my project,  it took over 100 analysts thousands of hours to complete. Determining guilt of insider trading is an extremely complex form of litigation that I wouldn't be able to address within the constraints  of this project.  Instead, I decided to take a different angle in my analysis.

Approach

Through my analysis, I will aggregate all Congress members’ reported trades from 2014-2023 and determine the following:

  1. What is Congress' effectiveness at buying stocks
  2. Who are the top Congress traders?
  3. How can users explore this data on their own?

The Data

Congress members must submit a Periodic Transaction Report (PTR) every time they buy or sell a stock. Like many government programs, the data is publicly available but not easy to access. There is no central database, or API.  Instead a large collection of individual PDF's are submitted by each congress member. Luckily, there is a website sorting through each of those .pdf's into a central database. 4 5

From these PTRs I was able to gather the following data points:

Data Limitations

One major difficulty with this dataset is that   I am not able to gather the exact number of shares  of stocks traded or their exact value. As you can see in the PTR above, there is only a $value range that the trade is worth. And because the range is so large (i.e. $1,000,000 - $5,000,000) it is not possible to determine exactly how many stocks were bought/sold and at what price. I am also not able to accurately recreate each representative's stock portfolio.  Additionally, I do not know which stocks they held prior to 2012 when the requirement for reporting began.

 

Data Overview

After cleaning up the data, I was able to match around 16,000 transactions with the adjusted close price scraped from Yahoo Finance. The observations took place from January 31, 2014, to February 6, 2023, with an average of 12 trades per day and a maximum of 255 trades in a day on March 18, 2020.

Out of these 16,000 transactions, 8,793 trades were made by Democrats, and 7,591 were made by Republicans. When grouping the data by individuals, representatives made as few as 1 trade and as many as 1,050 trades throughout this time period. The average congress member traded 82.6 times, and the median number of trades was 17, implying a distribution curve skewed to the left.

The transactions themselves ranged from the minimum amount for reporting, which is $1,000, all the way up to a $25 million trade made by Senator Susan Collins from Maine, where she bought $25 million worth of the company 3M on March 3, 2015. The average transaction range was from $22,000 to $80,000, and the median transaction was in the $1,000 to $15,000 range.

How to Measure Success

Due to the fact that I was limited to stock value ranges instead of exact stock values, it was challenging to find a way to measure success. The way I decided to measure success was to take the adjusted close price of a stock that a representative traded on a specific day and calculate a percentage change on that same stock 7,30, 90, 365 days later, and also look at present value working on the  date  of 2/13/23. This way, every single trade could have a tangible value behind whether it was a good trade in the short, medium and long term.

However,  we see the limitations of the data given to us. If a representative purchases the stock, I don't really know when they will sell it or what the connection is to future transactions on that ticker.  The same is true for when they sell a stock, I don't really know how much of the stock they owned already or when they bought it previously and at what price. That is why I created these proxy percent change values and made some assumptions at different time intervals. My goal isn't to evaluate the exact gains or losses of congress members, but instead evaluate the TIMING of the trade itself.

Here is an example for clarification before moving forward:

Congress member Nancy Pelosi bought $1M-5M of AMZN on 01/16/20; the adjusted close price was $93.90. The price 30 days later was $106.74(+13.68%) and the price one year later was $155.21(+65.30%) This was a fantastic trade in the short and Long term! Again, I don't know if she held the stock for a year, but what matters is that the timing was good.

Congress Member Nancy Pelosi also sold $250k-500k of AMZN on the same date.  However, this was a poor trade in both the short term and long term. It would have been better to hold onto that stock longer.

Congress' Effectiveness ...at buying stocks

For the below graph, I compare the average returns of congress as a whole versus the returns of the S&P 500 on the same dates.

On average, throughout all 9 years of data, Congress outperforms the S&P 500 in the one year or less categories, but does not outperform the "to date" category.

 

However, transaction type is not considered in the previous chart. As previously mentioned, if there is a lower percentage increase on a SELL, that is actually BETTER. So I have created a new plot below in which I have faceted by transaction type as well as political party.

Here are some insights I gained from the graph above:

  1. For BUYS of less than 1 year, Congress has better timing.
  2. For BUYS greater than a year,the S&P 500 did better.
  3. For SELLS overall, representatives had worse timing compared to transacting on the S&P 500 (remember a smaller percentage % increase on sales is better).
  4. Republicans Overall had MUCH greater returns compared to Democrats.

Top Traders

I isolated the dataset to just the buy transactions and grouped it by each individual representative to get an average return rate at different time intervals. Greg Gianforte - R(MT) came to the top of the one week average return with an impressive 5.86% average return. Austin Scott - R(GA) led the average one month and three month return with an average return of 12.91%  and 35.41% across 31 buy transactions. Susan Davis - D(CA) had a potential average return of 91.09% over a year across 13 buy transactions. Lastly, Jack Reed - D(RI) had a potential to date return of 185% across 58 buy transactions.

Again the big assumption here is that the representative would hold onto that stock and sell at a specified time interval later. Although that is a big assumption, I'd argue that it still gives us a very interesting data point about how effective the Congress member is at timing a trade and some potential knowledge they might have about that industry or even that specific stock.

Top Trades

In addition to pointing out the best average traders, I wanted to identify some of the top trades from the past three years. The stock market has been particularly volatile over the past three years., which opens the potential for large wins and losses. It is interesting to identify the individual trades that made the most potential return, and who those traders are.

 

The App

I have created a shiny app to allow an individual user to sort through this mountain of information and start their own investigation. In the app, you can filter by individual Congress member and explore overall trading activity as well as specific trades to find out who is the best or worst at buying/selling stocks.

Credits:

Data: Timothy Carambat (StockWatchers) - Senate API / House API

Photo: Dan Nelson 

Thanks to all my mentors at NYCDSA

 

About Author

Brian Ralston

Experienced Data Scientist and Database Administrator with 3 years experience in SQL, Python, and R. Strong understanding of data warehousing, modeling, mining techniques, and dedicated to staying up to date with the latest technologies and industry trends. Excited...
View all posts by Brian Ralston >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI