Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/business-science/tidyquant
Bringing financial analysis to the tidyverse
https://github.com/business-science/tidyquant
dplyr financial-analysis financial-data financial-statements multiple-stocks performance-analysis performanceanalytics quantmod r-package stock stock-exchanges stock-indexes stock-lists stock-performance stock-prices stock-symbol tidyverse time-series timeseries xts
Last synced: 1 day ago
JSON representation
Bringing financial analysis to the tidyverse
- Host: GitHub
- URL: https://github.com/business-science/tidyquant
- Owner: business-science
- License: other
- Created: 2016-12-30T19:12:30.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-12-01T00:17:52.000Z (about 1 month ago)
- Last Synced: 2025-01-03T07:11:56.817Z (9 days ago)
- Topics: dplyr, financial-analysis, financial-data, financial-statements, multiple-stocks, performance-analysis, performanceanalytics, quantmod, r-package, stock, stock-exchanges, stock-indexes, stock-lists, stock-performance, stock-prices, stock-symbol, tidyverse, time-series, timeseries, xts
- Language: R
- Homepage: https://business-science.github.io/tidyquant/
- Size: 156 MB
- Stars: 859
- Watchers: 72
- Forks: 177
- Open Issues: 87
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
- awesome-quant - tidyquant - Bringing financial analysis to the tidyverse. (R / Time Series)
- awesome-quant - tidyquant - Bringing financial analysis to the tidyverse. (R / Time Series)
- jimsghstars - business-science/tidyquant - Bringing financial analysis to the tidyverse (R)
README
---
output: github_document
---```{r, echo = FALSE, message = FALSE, warning=F}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
dpi = 300,
message = F,
warning = F
)
```# tidyquant
[![R-CMD-check](https://github.com/business-science/tidyquant/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/business-science/tidyquant/actions/workflows/R-CMD-check.yaml)
[![Codecov](https://codecov.io/gh/business-science/tidyquant/branch/master/graph/badge.svg)](https://app.codecov.io/gh/business-science/tidyquant)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/tidyquant)](https://cran.r-project.org/package=tidyquant)
![](http://cranlogs.r-pkg.org/badges/tidyquant?color=brightgreen)
![](http://cranlogs.r-pkg.org/badges/grand-total/tidyquant?color=brightgreen)> Bringing financial and business analysis to the `tidyverse` in R.
Mission: Our number 1 goal is to make financial analysis easier in R. We've designed `tidyquant` to give you the flexibility of the tidyverse with the performance of the R `xts` system. The result: easier, faster, and more scalable financial analysis.
## Start: 2-Minutes To tidyquant
Our short introduction to `tidyquant` on
[YouTube](https://www.youtube.com/embed/woxJZTL2hok).# 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 `tidyverse` tools in [_R for Data Science_](https://r4ds.hadley.nz/)__
* __Implements `ggplot2` functionality for beautiful and meaningful financial visualizations__
* __User-friendly documentation to get you up to speed quickly!__### New Excel Functionality in tidyquant
- [__Excel in R - Pivot Tables, VLOOKUPs, and more__](https://www.business-science.io/finance/2020/02/26/r-for-excel-users.html): Details on the __Excel integrations__ are covered in the blog article.
## 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...
```{r echo=FALSE, out.width='100%'}
knitr::include_graphics("man/figures/sample_img_1_volatility.png")
```### Evaluating Stock Performance
What about stock performance? Quickly visualize how a $10,000 investment in various stocks would perform.
```{r echo=FALSE, out.width='100%'}
knitr::include_graphics("man/figures/sample_img_2_stock_returns.png")
```### 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```{r echo=FALSE, out.width='100%'}
knitr::include_graphics("man/figures/sample_img_3_portfolio_returns.png")
```This just scratches the surface of `tidyquant`. Here's how to install to get started.
## Installation
Development Version with Latest Features:
``` {r, eval = FALSE}
# install.packages("devtools")
devtools::install_github("business-science/tidyquant")
```CRAN Approved Version:
```{r, eval = FALSE}
install.packages("tidyquant")
```## Further Information
The `tidyquant` package includes several vignettes to help users get up to speed quickly:
* [TQ00 - Introduction to `tidyquant`](https://business-science.github.io/tidyquant/articles/TQ00-introduction-to-tidyquant.html)
* [TQ01 - Core Functions in `tidyquant`](https://business-science.github.io/tidyquant/articles/TQ01-core-functions-in-tidyquant.html)
* [TQ02 - R Quantitative Analysis Package Integrations in `tidyquant`](https://business-science.github.io/tidyquant/articles/TQ02-quant-integrations-in-tidyquant.html)
* [TQ03 - Scaling and Modeling with `tidyquant`](https://business-science.github.io/tidyquant/articles/TQ03-scaling-and-modeling-with-tidyquant.html)
* [TQ04 - Charting with `tidyquant`](https://business-science.github.io/tidyquant/articles/TQ04-charting-with-tidyquant.html)
* [TQ05 - Performance Analysis with `tidyquant`](https://business-science.github.io/tidyquant/articles/TQ05-performance-analysis-with-tidyquant.html)
* [Blog Article: Excel in R - Pivot Tables, VLOOKUPs, and more!](https://www.business-science.io/finance/2020/02/26/r-for-excel-users.html)# Want to Learn tidyquant?
- [Learning Lab #9:](https://university.business-science.io/p/learning-labs-pro)
- __Performance Analysis & Portfolio Optimization with `tidyquant`__ - A 1-hour course on `tidyquant` in Learning Labs PRO- [Learning Lab #10:](https://university.business-science.io/p/learning-labs-pro)
- __Building an API with `plumber`__ - Build a stock optimization API with `plumber` and `tidyquant`
- [Learning Lab #16:](https://university.business-science.io/p/learning-labs-pro)
- __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:](https://university.business-science.io/courses/learning-labs-pro/lectures/14630075)
- __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!