-
Notifications
You must be signed in to change notification settings - Fork 0
/
tidyquant.Rmd
36 lines (24 loc) · 863 Bytes
/
tidyquant.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
---
title: "R Notebook"
output: html_notebook
---
```{r}
library(tidyquant)
library(dplyr)
AAPL <- tq_get("AAPL", get = "stock.prices", from = "2006-01-01")
GOOG <- tq_get("GOOG", get = "stock.prices", from = "2006-01-01")
MSFT <- tq_get("MSFT", get = "stock.prices", from = "2006-01-01")
AMZN <- tq_get("AMZN", get = "stock.prices", from = "2006-01-01")
FB <- tq_get("FB", get = "stock.prices", from = "2006-01-01")
TWTR <- tq_get("TWTR", get = "stock.prices", from = "2006-01-01")
bind_rows("AAPL" = AAPL, "GOOG" = GOOG, "MSFT" = MSFT, "AMZN" = AMZN, "FB" = FB, "TWTR" = TWTR, .id = "id")
```
```{r}
require(tidyquant)
# Set category id for Oil and Gold.
oil <- tq_get("DCOILWTICO", get = "economic.data")
gold <- tq_get("GOLDAMGBD228NLBM", get = "economic.data")
bind_rows("Oil" = oil, "Gold" = gold, .id = "commodity_name")
```
```{r}
```