forked from business-science/tidyquant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
111 lines (72 loc) · 4.67 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
devtools::load_all()
```
# tidyquant
[![Travis-CI Build Status](https://travis-ci.org/business-science/tidyquant.svg?branch=master)](https://travis-ci.org/business-science/tidyquant.svg?branch=master)
[![codecov](https://codecov.io/gh/business-science/tidyquant/branch/master/graph/badge.svg)](https://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)
<img src="tools/logo.png" width="147" height="170" align="right" />
> Bringing financial analysis to the tidyverse
`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`.
## Benefits
* __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_](http://r4ds.had.co.nz/)__
* __Implements `ggplot2` functionality for beautiful and meaningful financial visualizations__
* __User-friendly documentation to get you up to speed quickly!__
## 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("tools/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("tools/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("tools/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`
* TQ01 - Core Functions in `tidyquant`
* TQ02 - R Quantitative Analysis Package Integrations in `tidyquant`
* TQ03 - Scaling and Modeling with `tidyquant`
* TQ04 - Charting with `tidyquant`
* TQ05 - Performance Analysis with `tidyquant`
See the [`tidyquant` vignettes](https://cran.r-project.org/package=tidyquant) for further details on the package.