Show the code
source("setup.qmd") # Sourcing necessary libraries
To kick things off, we need to import the essential libraries that will empower us to interact with the SEC’s data and perform insightful analysis. The magic happens when we source the necessary files via setup.qmd
.
To start, we need to import the required libraries. These libraries provide functions and tools that enable us to interact with the SEC’s data and perform data analysis. The necessary libraries are listed in setup.qmd
.
The data retrieval process is orchestrated using a set of functions located in separate R script files. We’ll be sourcing these files via setup.qmd
to access the functions for retrieving, processing, and analyzing SEC data.
This sets the stage for retrieving and working with SEC data efficiently.
In this example, we will focus on one company, JAKKS Pacific Inc. (AAPL), as the target for our data retrieval.
To access the SEC API, we need to define user headers. These headers will be used for making HTTP requests to the SEC servers. We can set our user agent as an example:
x | |
---|---|
User-Agent | email@address.com |
It’s essential to set user headers as a standard practice when accessing web APIs to identify the source of the requests.
Our first step in data retrieval is to obtain the list of companies available on the SEC. This list contains essential information, including the Central Index Key (CIK), which uniquely identifies each company that files reports with the SEC. We’ll make an HTTP request to fetch this list:
cik_str | ticker | title | |
---|---|---|---|
0 | 0000789019 | MSFT | MICROSOFT CORP |
1 | 0000320193 | AAPL | Apple Inc. |
2 | 0001045810 | NVDA | NVIDIA CORP |
3 | 0001652044 | GOOGL | Alphabet Inc. |
4 | 0001018724 | AMZN | AMAZON COM INC |
5 | 0001326801 | META | Meta Platforms, Inc. |
For our analysis, we’ll use JAKKS Pacific Inc. (JAKK) as the company of interest. The CIK for JAKKS Pacific Inc. is 0001009829.
Let’s now select JAKKS Pacific Inc. by its CIK and retrieve its data from the SEC. The data we retrieve will be stored in the company_data
object for further analysis:
cik_str | ticker | title | |
---|---|---|---|
4090 | 0001009829 | JAKK | JAKKS PACIFIC INC |
By following these steps, we’ve imported the necessary libraries, sourced relevant files, and initiated the retrieval of financial data from the SEC. In the subsequent chapters, we will delve deeper into exploring and analyzing the SEC data for JAKKS Pacific Inc.
Before we move to the next chapter we save the files.