Auto Recalls as Alternative Data
A Python package for retrieving automotive recalls, and an application of event-based trading strategies.
Background
During the final year of my undergraduate degree at McGill I wanted to gain more practical experience in investment management. As such, I enrolled in a course called Applied Investments. The course was a year long and involved students developing, implementing and refining an active investment strategy. A unique aspect of this course, is that the students managed real money. More precisely, a portion of the endowment which was allocated to the course for students to manage. My group and I managed ~250,000CAD.
The purpose of this post is not to describe the investment strategy itself but instead highlight a package which I developed to help streamline the data retrieval process. However, to provide a brief summary of our strategy, we believed that large automotive recalls would create temporary negative price effects on the automotive companies stock price. If you wish, you can read more about the strategy and its empirical result here.
The Data
To execute our trading strategy we required consistent access to up to date recall information. Fortunately, the automotive industry is highly regulated and thus requires strict reporting. As a result, the National Highway Traffic Safety Administration, which is a department of the US Government, provides an API to allow users to search for recalls placed on their vehicle.
The issue with this is that while their API provides the ability to search by Make, Model, Year or even VIN, there is no direct way to easily work with this data in an analytical environment. In particular, retrieving structured recall data, validating responses and preparing the results for analysis requires additional processing.
As such, I wrote a Python package called nhtsa-recalls, which provides a typed client for accessing NHTSA’s vehicle recalls API. The package handles API requests, validates responses, and returns recall data directly as a pandas DataFrame, making it easier to use this alternative data source for analysis.
Usage
You can pip install the package as follows:
1
pip install nhtsa-recalls
Then, you can access recall data using the following code:
1
2
3
4
5
6
7
8
9
10
from nhtsa_recalls import RecallClient
with RecallClient() as client:
recalls = client.get_by_vehicle(
make="Toyota",
model="Camry",
model_year="2010"
)
print(recalls.head())
The result is returned as a pandas DataFrame, allowing users to immediately apply standard data analysis workflows:
1
2
recalls.to_csv("recalls.csv", index=False)
recalls.sort_values("report_received_date", ascending=False)
You can also retrieve a specific recall campaign using its NHTSA campaign number:
1
2
with RecallClient() as client:
recall = client.get_by_campaign("19V182000")
Additionally, the package provides helper methods to discover available makes, models and model years:
1
2
3
4
with RecallClient() as client:
makes = client.get_makes(model_year="2021")
models = client.get_models(model_year="2021", make="Toyota")
years = client.get_model_years()
To access and record daily recalls, one might consider compiling a database of make, model and year combinations and periodically querying the API. Since recall announcements are timestamped, this data could then be used to study the market impact of recall events or develop event-based trading strategies (not financial advice.).