fmpapi
is an R package that provides a simple interface to the
Financial Modeling Prep (FMP) API. With this package, you can easily
retrieve financial data such as company profiles, balance sheet
statements, income statements, and cash flow statements. The package
returns data as tidy data frames, with snake_case column names, making
it easier to integrate into your data analysis workflows.
Currently, fmpapi
is not on CRAN. You can install the development
version from GitHub:
pak::pak("tidy-finance/r-fmpapi")
Before using the package, you need to set your Financial Modeling Prep
API key. You can set it using the set_fmp_api_key()
function, which
saves the key to your .Renviron
file for future use.
library(fmpapi)
set_fmp_api_key()
You can retrieve a company’s profile by providing its stock symbol:
get_company_profile("AAPL")
To retrieve the balance sheet statements for a company, use the
get_balance_sheet_statements()
function. You can specify whether to
retrieve annual or quarterly data and the number of records.
get_balance_sheet_statements("AAPL", period = "annual", limit = 5)
The get_income_statements()
function allows you to retrieve income
statements for a specific stock symbol. You can specify the period and
the limit of records to return.
get_income_statements("MSFT", period = "annual", limit = 5)
You can fetch cash flow statements using the get_cash_flow_statements() function, specifying the period and the number of records to retrieve.
get_cash_flow_statements("TSLA", period = "annual", limit = 5)
Feel free to open issues or submit pull requests to improve the package. Contributions are welcome!
This package is licensed under the MIT License.