Skip to contents

Financial APIs

Functions for getting financial data from various API sources.

Get Data from APIs

tq_get() tq_get_options()
Get quantitative data in tibble format
tq_index() tq_exchange() tq_index_options() tq_exchange_options()
Get all stocks in a stock index or stock exchange in tibble format

API Keys

quandl_api_key()
Query or set Quandl API Key
quandl_search()
Search the Quandl database
av_api_key()
Set Alpha Vantage API Key
tiingo_api_key()
Set Tiingo API Key

Financial Analysis

Quantitative Transformations

Functions for mutating quantitative data.

Portfolio Aggregation

Functions for aggregating 1 or more portfolios.

tq_portfolio() tq_portfolio_() tq_repeat_df()
Aggregates a group of returns by asset into portfolio returns

Performance Analytics

Functions for performing various financial performance analyses.

tq_performance() tq_performance_() tq_performance_fun_options()
Computes a wide variety of summary performance metrics from stock or portfolio returns

Charting with ggplot2

Functions for creating ggplots for financial charting.

geom_bbands() geom_bbands_()
Plot Bollinger Bands using Moving Averages
geom_barchart() geom_candlestick()
Plot Financial Charts in ggplot2
geom_ma() geom_ma_()
Plot moving averages
theme_tq() theme_tq_dark() theme_tq_green()
tidyquant themes for ggplot2.
palette_light() palette_dark() palette_green()
tidyquant palettes for use with scales
scale_color_tq() scale_colour_tq() scale_fill_tq()
tidyquant colors and fills for ggplot2.
coord_x_date() coord_x_datetime()
Zoom in on plot regions using date ranges or date-time ranges

Excel

Pivot Table, VLOOKUP, & Sum-Ifs

These Power-Excel Functions provide common functionality that power-users coming from Excel use frequently.

pivot_table()
Excel Pivot Table
VLOOKUP()
Excel Reference Functions
SUM_IFS() COUNT_IFS() AVERAGE_IFS() MEDIAN_IFS() MIN_IFS() MAX_IFS() CREATE_IFS()
Excel Summarising "If" Functions

Summary Functions

These functions return a single value from a vector of values

Mutation Functions

These functions return a vector of multiple values the length of the input vector

Date & Time Functions

These functions provide lubridate (date & date-time) and timeDate (Business Calendar Holiday) functionality

Financial Functions

These functions provide common financial calcuations from Excel

NPV() IRR() FV() PV() PMT() RATE()
Excel Financial Math Functions

Data Sets

FANG
Stock prices for the "FANG" stocks.

Tidyquant

Package level information.

tidyquant tidyquant-package
tidyquant: Integrating quantitative financial analysis tools with the tidyverse
tidyquant_conflicts()
Conflicts between the tidyquant and other packages

Deprecated

tq_transform() tq_transform_xy()
Deprecated functions