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.

tq_mutate() tq_mutate_() tq_mutate_xy() tq_mutate_xy_() tq_mutate_fun_options() tq_transmute() tq_transmute_() tq_transmute_xy() tq_transmute_xy_() tq_transmute_fun_options()

Mutates 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

SUM() AVERAGE() MEDIAN() MIN() MAX() COUNT() COUNT_UNIQUE() STDEV() VAR() COR() COV() FIRST() LAST() NTH() CHANGE_FIRSTLAST() PCT_CHANGE_FIRSTLAST()

Excel Statistical Summary Functions

Mutation Functions

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

ABS() SQRT() LOG() EXP() RETURN() PCT_CHANGE() CHANGE() LAG() LEAD() CUMULATIVE_SUM() CUMULATIVE_PRODUCT() CUMULATIVE_MAX() CUMULATIVE_MIN() CUMULATIVE_MEAN() CUMULATIVE_MEDIAN()

Excel Statistical Mutation Functions

Date & Time Functions

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

AS_DATE() AS_DATETIME() DATE() DATEVALUE() YMD() MDY() DMY() YMD_HMS() MDY_HMS() DMY_HMS() YMD_HM() MDY_HM() DMY_HM() YMD_H() MDY_H() DMY_H() WEEKDAY() WDAY() DOW() MONTHDAY() MDAY() DOM() QUARTERDAY() QDAY() DAY() WEEKNUM() WEEK() WEEKNUM_ISO() MONTH() QUARTER() YEAR() YEAR_ISO() DATE_TO_NUMERIC() DATE_TO_DECIMAL() SECOND() MINUTE() HOUR() NOW() TODAY() EOMONTH() EDATE() NET_WORKDAYS() COUNT_DAYS() YEARFRAC() DATE_SEQUENCE() WORKDAY_SEQUENCE() HOLIDAY_SEQUENCE() HOLIDAY_TABLE() FLOOR_DATE() FLOOR_DAY() FLOOR_WEEK() FLOOR_MONTH() FLOOR_QUARTER() FLOOR_YEAR() CEILING_DATE() CEILING_DAY() CEILING_WEEK() CEILING_MONTH() CEILING_QUARTER() CEILING_YEAR() ROUND_DATE() ROUND_DAY() ROUND_WEEK() ROUND_MONTH() ROUND_QUARTER() ROUND_YEAR()

Excel Date and Time Functions

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: Integrating quantitative financial analysis tools with the tidyverse

Deprecated

tq_transform() tq_transform_xy()

Deprecated functions