-
Notifications
You must be signed in to change notification settings - Fork 177
/
README.Rmd
154 lines (92 loc) · 7.21 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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 <img src="man/figures/logo.png" width="147" height="170" align="right" />
<!-- badges: start -->
[![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)
<!-- badges: end -->
> 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).
<a href="https://www.youtube.com/embed/woxJZTL2hok" target="_blank"><img src="http://img.youtube.com/vi/woxJZTL2hok/0.jpg" alt="Anomalize" width="100%" height="350"/></a>
# 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!