Publications by Amanda Simpson
Apply to Data 2
Import stock prices stocks <- tq_get(c("HD", "XOM", "AXP"), get = "stock.prices", from = "2020-01-01", to = "2021-01-01") stocks ## # A tibble: 759 × 8 ## symbol date open high low close volume adjusted ## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 H...
200 sym Python (4805 sym/14 pcs) 1 img
Code Along 3 Performance Analysis
# load packages library(tidyverse) ## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ── ## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4 ## ✔ tibble 3.1.8 ✔ dplyr 1.0.10 ## ✔ tidyr 1.2.0 ✔ stringr 1.4.1 ##...
140 sym R (3470 sym/10 pcs)
Apply it to your data 3
# load packages library(tidyverse) library(tidyquant) 1 Get Stock Prices and Convert to Returns Ra <- c("HD", "XOM", "AXP") %>% tq_get(get = "stock.prices", from = "2022-01-01") %>% group_by(symbol) %>% tq_transmute(select = adjusted, mutate_fun = periodReturn, period =...
202 sym R (2459 sym/9 pcs)
Code Along 4
# Load packages # Core library(tidyverse) ## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ── ## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4 ## ✔ tibble 3.1.8 ✔ dplyr 1.0.10 ## ✔ tidyr 1.2.0 ✔ stringr 1....
217 sym R (2913 sym/8 pcs) 1 img
Apply it to your data 4
1 Import stock prices of your choice 2 Convert prices to returns by quarterly ## # A tibble: 80 × 3 ## asset date returns ## <chr> <date> <dbl> ## 1 AMZN 2012-03-30 0.123 ## 2 AMZN 2012-06-29 0.120 ## 3 AMZN 2012-09-28 0.108 ## 4 AMZN 2012-12-31 -0.0137 ## 5 AMZN 2013-03-28 0.0604 ## 6 AMZN 2013-06-...
534 sym 1 img
Code Along 5
# Load packages # Core library(tidyverse) library(tidyquant) Goal Collect individual returns into a portfolio by assigning a weight to each stock five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = sy...
354 sym R (2745 sym/14 pcs) 3 img
Apply it to your data 5
# Load packages # Core library(tidyverse) library(tidyquant) Goal Collect individual returns into a portfolio by assigning a weight to each stock Choose your stocks. from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("AMZN", "MSFT", "HD", "WMT") prices <- tq_get(x = symbols, get = "stock.prices", ...
422 sym R (3944 sym/15 pcs) 1 img
Code Along 6
# Load packages # Core library(tidyverse) library(tidyquant) Goal Collect individual returns into a portfolio by assigning a weight to each stock five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = sy...
379 sym R (5137 sym/25 pcs) 2 img
Apply 6
# Load packages # Core library(tidyverse) library(tidyquant) Goal Visualize expected returns and risk to make it easier to compare the performance of multiple assets and portfolios. Choose your stocks. from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("AMZN", "MSFT", "HD", "WMT") prices <- tq_get(x = symbols, ...
653 sym R (5336 sym/23 pcs) 1 img
Code Along 7
# Load packages # Core library(tidyverse) library(tidyquant) Goal Collect individual returns into a portfolio by assigning a weight to each stock five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = sy...
438 sym R (4497 sym/18 pcs) 3 img