The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
R package for accessing the FMP
Cloud and Financial
Modeling Prep API. fmpcloudr
can be used
interchangeably with either API key. FMP Provides access to a wide range
of financial data such as historical prices for stocks, indexes,
cryptos, currencies, and commodities. FMP also provides data for 13F,
Balance Sheet, Income Statements, Discounted Cash Flow, and much more.
Create an account to get an API token and explore the
fmpcloudr
functions to see the capabilities.
See the article on analyzing the S&P 500 to see a detailed analysis and working example using FMP data.
You can install fmpcloudr
using:
# Available on CRAN
install.packages('fmpcloudr')
# Pull the GitHub development version - currently same as CRAN
# install.packages("devtools")
::install_github("exploringfinance/fmpcloudr") devtools
Register an API token on FMP Cloud or Financial Modeling Prep. To use the package without an API key, see the bottom section ‘Examples using a demo API’ for API calls on Apple.
Please note: for most functions, each symbol entered will generate a
single API call. fmpc_set_token
sets time between API calls
so that no more than 10 calls will be made per second. However, raw
number of calls can be breached depending on the subscription. For
example, the free API tier allows for 250 API calls. This will be
exceeded if 251 symbols are run through
fmpc_price_history
.
Get current and historical prices using a range of functions. Prices can be pulled for stocks, ETFs, Mutual Funds, Indexes, Crypto, Currencies, and Commodities. See the Market Information section below to explore all available symbols on FMP.
library(fmpcloudr)
# Set API Token
# The default setting will buffer requests so that no more than 10 requests are made every second
fmpc_set_token('VALID_FMP_API_TOKEN')
# Change the options to suppress the bulk request warning or to decrease time between
# API calls if the registered token allows for more than 10 API calls per second.
# fmpc_set_token('VALID_FMP_API_TOKEN', timeBtwnReq = 0, noBulkWarn = TRUE)
# Make requests for stock tickers, Mutual Funds, Indexes, Currencies, and Commodities
= c('AAPL','SPY','SWTSX')
symbols = c('^SP500TR','JPYUSD','BTCUSD','GCUSD')
indexes
# Get historical prices
fmpc_price_history(c(symbols,indexes))
# Get historical data frame of price, div, and splits
# NOTE: This will generate 3 API calls per symbol
fmpc_price_history_spldiv(c(symbols,indexes),startDate = '2020-01-01')
# Get Intraday prices
fmpc_price_intraday(c(symbols,indexes), freq = '5min')
fmpc_price_intraday(c(symbols,indexes), freq = '1hour')
# Get all prices for a single day
fmpc_price_batch_eod('2020-06-24')
# Get most recent price
fmpc_price_current(c(symbols,indexes))
# Get most recent price for all available indexes and ETFs
fmpc_price_full_market('index')
fmpc_price_full_market('etf')
# Get two month price history for the entire S&P 500
# Note: this will take about two minutes and will generate 500 unique API Calls
fmpc_set_token('VALID_FMP_API_TOKEN', noBulkWarn = TRUE)
= fmpc_symbols_index()
SP500 = fmpc_price_history(SP500$symbol, startDate = Sys.Date() - 60) SPPrice
Use these functions to find available tickers, search for companies, check market hours, and screen stocks.
# Set API Token
fmpc_set_token('VALID_FMP_API_TOKEN')
# Pull available symbols for one or more markets
fmpc_symbols_by_market() # default will pull all markets making 11 API calls
fmpc_symbols_by_market(market = c('index','commodity'))
# Pull all available symbols that also have a profile
fmpc_symbols_available()
# Search for securities using text
fmpc_symbol_search('tech', 100)
fmpc_symbol_search('utilit', 100)
fmpc_symbol_search('Buffer ETF', 100)
# Get a list of all symbols in the Nasdaq
fmpc_symbols_index(index= 'nasdaq')
# Find all securities that have been added and removed from the S&P 500
fmpc_symbols_index('historical')
# Get current day market hours and a list of trading holidays
fmpc_market_hours()
# Screen for securities on a range of metrics
fmpc_security_screener(mrktCapAbove = 1e9, dividendBelow = 1, volumeAbove = 1e6)
fmpc_security_screener(dividendBelow = 1, betaAbove = 1)
# Search on CUSIP
fmpc_cusip_search('000360206')
Use these functions to get split history, dividend history, security profiles, biggest gainers/losers, earnings, analyst grades/recommendations, press releases, and earnings call transcripts.
# Set API Token
fmpc_set_token('VALID_FMP_API_TOKEN')
= c('AAPL','SPY','SWTSX')
symbols
# Get historical dividend
fmpc_security_dividends(symbols, startDate = '2020-01-01')
# Get historical splits
fmpc_security_splits(symbols, startDate = '2020-01-01')
# Get sector returns for 30 trading days
fmpc_security_sector(30)
# Security Profile
fmpc_security_profile(symbols)
# Get current days biggest gainers/losers and most active
fmpc_security_gla('gainers')
fmpc_security_gla('losers')
fmpc_security_gla('actives')
# Pull news for a set of symbols
fmpc_security_news(symbols)
# Get analyst ratings
fmpc_security_ratings(symbols)
## Pull Analyst Outlooks
# Grades
fmpc_analyst_outlook(symbols, 'grade', limit = 120)
# Quarterly Earnings
fmpc_analyst_outlook(symbols, 'estimateQtr')
# Annual Earnings
fmpc_analyst_outlook(symbols, 'estimateAnnl')
# Recommendations
fmpc_analyst_outlook(symbols, 'recommend')
# Press releases
fmpc_analyst_outlook(symbols, 'press')
# Earnings call transcript
fmpc_earning_call_transcript(symbols, quarter = 1, year = 2019)
Pull a range of technical indicators over different frequencies and periods.
# Set API Token
fmpc_set_token('VALID_FMP_API_TOKEN')
= c('AAPL', 'SPY')
symbols
# Simple moving average
= fmpc_security_tech_indic(symbols, indicator = 'SMA', freq = 'daily', period = 10)
sma
# Exponential moving average
= fmpc_security_tech_indic(symbols, indicator = 'EMA', freq = '1min', period = 10)
ema
# Weighted Moving Average
= fmpc_security_tech_indic(symbols, indicator = 'WMA', freq = '5min', period = 10)
wma
# Double Exponential moving average
= fmpc_security_tech_indic(symbols, indicator = 'dema', freq = '30min', period = 10)
dema
# Triple Exponential moving average
= fmpc_security_tech_indic(symbols, indicator = 'Tema', freq = '1hour', period = 10)
tema
# Williams momentum
= fmpc_security_tech_indic(symbols, indicator = 'Williams', freq = '4hour', period = 10)
will
# Average Directional Moving Index
= fmpc_security_tech_indic(symbols, indicator = 'adx', freq = 'daily', period = 10)
adx
# Standard Deviation
= fmpc_security_tech_indic(symbols, indicator = 'StandardDeviation', freq = '1hour', period = 10)
sd
# Relative Strength Indicator
= fmpc_security_tech_indic(symbols, indicator = 'rsi', freq = 'daily', period = 14) rsi
Pull historic data for Balance Sheet, Income Statement, and Cash Flow Statement. Data can be pulled annually or quarterly with a growth indicator set.
# Set API Token
fmpc_set_token('VALID_FMP_API_TOKEN')
= c('AAPL','MSFT','BAC','TSLA')
symbols
# Balance Sheet
= fmpc_financial_bs_is_cf(symbols,statement = 'balance')
Bal = fmpc_financial_bs_is_cf(symbols,statement = 'balance', growth = TRUE)
BalG
# Income statements
= fmpc_financial_bs_is_cf(symbols,statement = 'income')
IS = fmpc_financial_bs_is_cf(symbols,statement = 'income', quarterly = FALSE)
ISa
# Cash Flow Statements
= fmpc_financial_bs_is_cf(symbols,statement = 'cashflow')
cf = fmpc_financial_bs_is_cf('AAPL',statement = 'cashflow', SECReported = TRUE)
cfsec
### Discounted Cash Flow Value
fmpc_financial_dcfv(symbols, period = 'current')
fmpc_financial_dcfv(symbols, period = 'quarterly')
### Other financial metrics
# Financial Ratios
= fmpc_financial_metrics(symbols, metric = 'ratios', quarterly = TRUE, trailingTwelve = TRUE, limit = 100)
ratio
# Key Metrics
= fmpc_financial_metrics(symbols, metric = 'key', quarterly = FALSE, trailingTwelve = TRUE, limit = 100)
keym
# Enterprise Value
= fmpc_financial_metrics(symbols, metric = 'ev', quarterly = TRUE, trailingTwelve = FALSE, limit = 100)
ev
# Growth of revenue, profit, operating income, EPS, EBIT, etc.
= fmpc_financial_metrics(symbols, metric = 'growth', quarterly = FALSE, trailingTwelve = FALSE, limit = 120) growth
Holdings data can include institutions holding the security (13F) or what a security is actually holding, for example what is SPY holding?
# Set API Token
fmpc_set_token('VALID_FMP_API_TOKEN')
## Get 13F data
# Search for available ciks
fmpc_13f_cik_list()
# Narrow search for particular firms
= fmpc_13f_cik_search('Goldman S')
GS
# Pull 13F data for dates and ciks
fmpc_13f_data(cik = GS$cik, date = c('2020-03-31','2019-12-31'))
# Find out which mutual funds are holding speific symbols
fmpc_held_by_mfs(c('AAPL','MSFT','GOOGL'))
# Understand the holdings within an ETF - by individual security, sector weighting, or country weighting
fmpc_holdings_etf(c('SPY','EFA'), 'symbol')
fmpc_holdings_etf(c('SPY','EFA'), 'sector')
fmpc_holdings_etf(c('SPY','EFA'), 'sector')
Pull data for specific calendar events. Economic data releases can be searched with historical data pulled.
# Set API Token
fmpc_set_token('VALID_FMP_API_TOKEN')
# Get a list of economic events that can be searched
= fmpc_economic_events()
Events
## Search for specific economic event results
# US ADP Employment Change
fmpc_economic_results(event = 'adpEmploymentChange', country = 'US')
# Italy three month interbank rate
fmpc_economic_results(event = Events[100,1], country = Events[100,2])
# Consumer credit - RS
fmpc_economic_results(event = Events[1000,1], country = Events[1000,2])
# Find out upcoming or past IPOs
fmpc_calendar_events('ipo', startDate = Sys.Date()-100)
# Find out earnings results vs estimates
fmpc_calendar_events('earning')
The demo API token allows for pulls on Apple.
library(fmpcloudr)
# Set API Token
fmpc_set_token()
# Get historical prices
fmpc_price_history('AAPL')
# Get historical dividend
fmpc_security_dividends('AAPL', startDate = '2020-01-01')
# Get historical splits
fmpc_security_splits('AAPL', startDate = '2020-01-01')
# Get historical data frame of price, div, and splits
# NOTE: This will generate 3 API calls per symbol
fmpc_price_history_spldiv('AAPL',startDate = '2020-01-01')
# Get Intraday prices
fmpc_price_intraday('AAPL', freq = '5min')
# Modify the frequency and start date
fmpc_price_intraday('AAPL', freq = '1hour', startDate = Sys.Date()-7)
# Get most recent price
fmpc_price_current('AAPL')
# Get technical indicators like ema, sma, rsi, williams, etc
fmpc_security_tech_indic('AAPL', indicator = 'ema')
fmpc_security_tech_indic('AAPL', indicator = 'rsi', freq = '15min', period = 25)
# Download balance sheet, cash flow, and income statement
fmpc_financial_bs_is_cf('AAPL',statement = 'balance')
fmpc_financial_bs_is_cf('AAPL',statement = 'income')
fmpc_financial_bs_is_cf('AAPL',statement = 'cashflow', quarterly = FALSE)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.