tidyquant v1.0.1

0

Monthly downloads

0th

Percentile

Tidy Quantitative Financial Analysis

Bringing business and financial analysis to the 'tidyverse'. The 'tidyquant' package provides a convenient wrapper to various 'xts', 'zoo', 'quantmod', 'TTR' and 'PerformanceAnalytics' package functions and returns the objects in the tidy 'tibble' format. The main advantage is being able to use quantitative functions with the 'tidyverse' functions including 'purrr', 'dplyr', 'tidyr', 'ggplot2', 'lubridate', etc. See the 'tidyquant' website for more information, documentation and examples.

Readme

tidyquant

Build
Status codecov CRAN\_Status\_Badge

Bringing financial and business analysis to the tidyverse

2-Minutes To Tidyquant

Our short introduction to tidyquant on YouTube.

Anomalize

Features of Tidyquant

tidyquant integrates the best resources for collecting and analyzing financial data, zoo, xts, quantmod, TTR, and PerformanceAnalytics, with the tidy data infrastructure of the tidyverse allowing for seamless interaction between each. You can now perform complete financial analyses in the tidyverse.

  • A few core functions with a lot of power
  • Integrates the quantitative analysis functionality of zoo, xts, quantmod, TTR, and now PerformanceAnalytics
  • Designed for modeling and scaling analyses using the the tidyverse tools in R for Data Science
  • Implements ggplot2 functionality for beautiful and meaningful financial visualizations
  • User-friendly documentation to get you up to speed quickly!

NEW EXCEL in tidyquant 1.0.0

Tidyquant 1.0.0 is the “R for Excel Users” release. My aim is to build functionality that helps users coming from an Excel Background (background I came from). It’s important to have these users feel at home. I have a full suite of functionality to accomplish your Excel-to-R transition.

EXCEL Tutorials:

One-Stop Shop for Serious Financial Analysis

With tidyquant all the benefits add up to one thing: a one-stop shop for serious financial analysis!

Core Functions

  • Getting Financial Data from the web: tq_get(). This is a one-stop shop for getting web-based financial data in a “tidy” data frame format. Get data for daily stock prices (historical), key statistics (real-time), key ratios (historical), financial statements, dividends, splits, economic data from the FRED, FOREX rates from Oanda.

  • Manipulating Financial Data: tq_transmute() and tq_mutate(). Integration for many financial functions from xts, zoo, quantmod,TTR and PerformanceAnalytics packages. tq_mutate() is used to add a column to the data frame, and tq_transmute() is used to return a new data frame which is necessary for periodicity changes.

  • Performance Analysis and Portfolio Analysis: tq_performance() and tq_portfolio(). The newest additions to the tidyquant family integrate PerformanceAnalytics functions. tq_performance() converts investment returns into performance metrics. tq_portfolio() aggregates a group (or multiple groups) of asset returns into one or more portfolios.

Comparing Stock Prices

Visualizing the stock price volatility of four stocks side-by-side is quick and easy…

Evaluating Stock Performance

What about stock performance? Quickly visualize how a $10,000 investment in various stocks would perform.

Evaluating Portfolio Performance

Ok, stocks are too easy. What about portfolios? With the PerformanceAnalytics integration, visualizing blended portfolios are easy too!

  • Portfolio 1: 50% FB, 25% AMZN, 25% NFLX, 0% GOOG
  • Portfolio 2: 0% FB, 50% AMZN, 25% NFLX, 25% GOOG
  • Portfolio 3: 25% FB, 0% AMZN, 50% NFLX, 25% GOOG
  • Portfolio 4: 25% FB, 25% AMZN, 0% NFLX, 50% GOOG

This just scratches the surface of tidyquant. Here’s how to install to get started.

Installation

Development Version with Latest Features:

# install.packages("devtools")
devtools::install_github("business-science/tidyquant")

CRAN Approved Version:

install.packages("tidyquant")

Further Information

The tidyquant package includes several vignettes to help users get up to speed quickly:

Want to Learn tidyquant?

  • Learning Lab #9:

    • Performance Analysis & Portfolio Optimization with tidyquant - A 1-hour course on tidyquant in Learning Labs PRO
  • Learning Lab #10:

    • Building an API with plumber - Build a stock optimization API with plumber and tidyquant
  • Learning Lab #16:

    • Stock Portfolio Optimization and Nonlinear Programming - Use the ROI package with tidyquant to calculate optimal minimum variance portfolios and develop an efficient frontier.
  • Learning Lab #30:

    • Shiny Financial Analysis with Tidyquant API & Excel Pivot Tables - Learn how to use the new Excel Functionality to make Pivot Tables, VLOOKUPs, Sum-If’s, and more!

Functions in tidyquant

Name Description
coord_x_date Zoom in on plot regions using date ranges or date-time ranges
excel_ref_functions Excel Reference Functions
deprecated Deprecated functions
excel_if_functions Excel Summarising "If" Functions
excel_stat_mutation_functions Excel Statistical Mutation Functions
excel_pivot_table Excel Pivot Table
av_api_key Set Alpha Vantage API Key
excel_date_functions Excel Date and Time Functions
FANG Stock prices for the "FANG" stocks.
excel_financial_math_functions Excel Financial Math Functions
palette_tq tidyquant palettes for use with scales
quandl_api_key Query or set Quandl API Key
quandl_search Search the Quandl database
scale_manual tidyquant colors and fills for ggplot2.
theme_tq tidyquant themes for ggplot2.
tq_portfolio Aggregates a group of returns by asset into portfolio returns
geom_bbands Plot Bollinger Bands using Moving Averages
tq_performance Computes a wide variety of summary performance metrics from stock or portfolio returns
excel_stat_summary_functions Excel Statistical Summary Functions
tq_mutate Mutates quantitative data
tiingo_api_key Set Tiingo API Key
%>% Pipe operator
geom_chart Plot Financial Charts in ggplot2
geom_ma Plot moving averages
tq_get Get quantitative data in tibble format
tidyquant tidyquant: Integrating quantitative financial analysis tools with the tidyverse
tq_index Get all stocks in a stock index or stock exchange in tibble format
No Results!

Vignettes of tidyquant

Name
TQ00-introduction-to-tidyquant.Rmd
TQ01-core-functions-in-tidyquant.Rmd
TQ02-quant-integrations-in-tidyquant.Rmd
TQ03-scaling-and-modeling-with-tidyquant.Rmd
TQ04-charting-with-tidyquant.Rmd
TQ05-performance-analysis-with-tidyquant.Rmd
TQ06-excel-in-r.Rmd
perfomance_analysis_workflow.png
r-for-excel-users.jpg
No Results!

Last month downloads

Details

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/tidyquant)](http://www.rdocumentation.org/packages/tidyquant)