knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of fmpapi
is to provide a simple and consistent interface to the Financial Modeling Prep Financial Data API that can be used along side and integrated with other common R resources
for collecting and analyzing financial data, such as tidyquant
, xts
, TTR
, and quantmod
.
You can install the latest development version of fmp from Github with:
remotes::install_github('jpiburn/fmpapi')
Before getting started with fmpapi
you first must obtain an API key for the Financial Modeling Prep Financial Data API. For details, see here.
Once you sign up, you can add your API key to your .Renviron
file by using fmp_api_key()
. This will add a FMP_API_KEY
entry to your .Renviron
file so it will automatically be available in future sessions. When first installed however, you will need to reload your .Renviron file by either restarting R or running readRenviron('~/.Renviron')
library(fmpapi) api_key <- 'my_api_key' fmp_api_key(api_key) # reload readRenviron('~/.Renviron')
library(fmpapi) library(tidyverse) my_stocks <- c("AAPL", "GE") d <- fmp_profile(my_stocks) glimpse(d)
fmp_dcf(my_stocks, historical = TRUE, quarterly = TRUE) %>% ggplot( aes(x = date, y = dcf, colour = symbol) ) + geom_line(size = 1) + theme_minimal() + labs( title = "Historical Discounted Cash Flow Valuation", y = "Discounted Cash Flow Value" )
d <- fmp_key_metrics(my_stocks) glimpse(d)
d <- fmp_balance_sheet(my_stocks, quarterly = TRUE) glimpse(d)
berkshire_cik <- '0001067983' d <- fmp_13f(berkshire_cik) glimpse(d)
d <- fmp_earnings_calendar() glimpse(d)
d <- fmp_sec_filings() glimpse(d)
d <- fmp_quote_cryptos() glimpse(d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.