Introduction to tidyquant (original) (raw)

Benefits

A Few Core Functions with A Lot of Power

Minimizing the number of functions reduces the learning curve. What we’ve done is group the core functions into four categories:

  1. Get a Stock Index, [tq_index()](../reference/tq%5Findex.html), or a Stock Exchange, [tq_exchange()](../reference/tq%5Findex.html): Returns the stock symbols and various attributes for every stock in an index or exchange. Eighteen indexes and three exchanges are available.
  2. Get Quantitative Data, [tq_get()](../reference/tq%5Fget.html): A one-stop shop to get data from various web-sources.
  3. Transmute, [tq_transmute()](../reference/tq%5Fmutate.html), and Mutate,[tq_mutate()](../reference/tq%5Fmutate.html), Quantitative Data: Perform and scale financial calculations completely within the tidyverse. These workhorse functions integrate the xts,zoo, quantmod, TTR, andPerformanceAnalytics packages.
  4. Performance analysis, [tq_performance()](../reference/tq%5Fperformance.html), and portfolio aggregation, [tq_portfolio()](../reference/tq%5Fportfolio.html): ThePerformanceAnalytics integration enables analyzing performance of assets and portfolios. Refer to Performance Analysis with tidyquant.

For more information, refer to the first topic-specific vignette, Core Functions in tidyquant.

Integrates the Quantitative Analysis Functionality of xts/zoo, quantmod TTR and Performance Analytics

There’s a wide range of useful quantitative analysis functions (QAF) that work with time-series objects. The problem is that many of these_wonderful_ functions don’t work with data frames or thetidyverse workflow. That is until now. Thetidyquant package integrates the most useful functions from the xts, zoo, quantmod,TTR, and PerformanceAnalytics packages, enabling seamless usage within the tidyverse workflow.

Refer below for information on the performance analysis and portfolio attribution with the PerformanceAnalytics integration.

For more information, refer to the second topic-specific vignette, R Quantitative Analysis Package Integrations in tidyquant.

Designed for the data science workflow of the tidyverse

The greatest benefit to tidyquant is the ability to easily model and scale your financial analysis. Scaling is the process of creating an analysis for one security and then extending it to multiple groups. This idea of scaling is incredibly useful to financial analysts because typically one wants to compare many securities to make informed decisions. Fortunately, the tidyquant package integrates with the tidyverse making scaling super simple!

All tidyquant functions return data in thetibble (tidy data frame) format, which allows for interaction within the tidyverse. This means we can:

For more information, refer to the third topic-specific vignette, Scaling and Modeling with tidyquant.

Implements ggplot2 Functionality for Financial Visualizations

The tidyquant package includes charting tools to assist users in developing quick visualizations in ggplot2 using the grammar of graphics format and workflow.

For more information, refer to the fourth topic-specific vignette, Charting with tidyquant.

Performance Analysis of Asset and Portfolio Returns

Asset and portfolio performance analysis is a deep field with a wide range of theories and methods for analyzing risk versus reward. ThePerformanceAnalytics package consolidates many of the most widely used performance metrics as functions that can be applied to stock or portfolio returns. tidyquant implements the functionality with two primary functions:

Performance is based on the statistical properties of returns, and as a result both functions use returns as opposed to stock prices.

For more information, refer to the fifth topic-specific vignette, Performance Analysis with tidyquant.