knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

fmpapi: An R package for interfacing with the Financial Modeling Prep API

CRAN status Lifecycle: maturing

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.

Installation

You can install the latest development version of fmp from Github with:

remotes::install_github('jpiburn/fmpapi')

Getting Started

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')

Company Information and Financials

library(fmpapi)
library(tidyverse)

my_stocks <- c("AAPL", "GE")

d <- fmp_profile(my_stocks)

glimpse(d)

Discounted Cash Flow Valuation

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"
  )

Key Metrics

d <- fmp_key_metrics(my_stocks)

glimpse(d)

Balance Sheets

d <- fmp_balance_sheet(my_stocks, quarterly = TRUE)

glimpse(d)

Form 13-F Statements

berkshire_cik <- '0001067983'
d <- fmp_13f(berkshire_cik)

glimpse(d)

Earnings Calendar

d <- fmp_earnings_calendar()

glimpse(d)

SEC RSS Feed

d <- fmp_sec_filings()

glimpse(d)

Quoting Cryptocurrencies

d <- fmp_quote_cryptos()

glimpse(d)


jpiburn/fmpapi documentation built on Aug. 20, 2021, 12:51 a.m.