Publications by Cody Grube

Apply 13

04.05.2023

# Load packages # Core library(tidyverse) library(tidyquant) # Source function source("../00_scripts/simulate_accumulation.R") 1 Import stock prices Revise the code below. Replace symbols with your stocks. Replace the from and the to arguments to date from 2012-12-31 to present. symbols <- c("NVDA", "AAPL", "NFLX", "MSFT", "TSLA") price...

1560 sym R (5178 sym/26 pcs) 1 img

Code Along 13

02.05.2023

# Load packages # Core library(tidyverse) library(tidyquant) # time series library(timetk) Goal Simulate future portfolio returns five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” market: “SPY” from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = ...

457 sym R (9258 sym/40 pcs) 2 img

Code Along 12

24.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) library(readr) # Time series library(lubridate) library(tibbletime) # modeling library(broom) Goal Examine how each asset contributes to portfolio standard deviation. This is to ensure that our risk is not concentrated in any one asset. five stocks: “SPY”, “EFA”, �...

694 sym R (15724 sym/25 pcs) 2 img

Apply 12

24.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) Goal Examine how each asset contributes to portfolio standard deviation. This is to ensure that our risk is not concentrated in any one asset. 1 Import stock prices Choose your stocks from 2012-12-31 to present. symbols <- c("NVDA", "AAPL", "NFLX", "MSFT", "TSLA") prices <- tq_ge...

1082 sym R (12628 sym/8 pcs) 1 img

Code Along 11

18.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) library(scales) Ch19 Functions When Should You Write a Function? # For Reproducible Work set.seed(1234) # Create a Data Frame df <- tibble::tibble( a = rnorm(10), b = rnorm(10), c = rnorm(10), d = rnorm(10) ) # Rescale Each Column df$a <- (df$a - min(df$a, na...

619 sym R (2212 sym/25 pcs)

Apply 11

18.04.2023

Import your data data(flights) flights %>% skimr::skim() Data summary Name Piped data Number of rows 336776 Number of columns 19 _______________________ Column type frequency: character 4 numeric 14 POSIXct 1 ________________________ Group variables None Variable type: character skim_variable n_missing complete_rate min max empty n_u...

553 sym R (5545 sym/46 pcs) 4 tbl

Code Along 10

11.04.2023

# 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 = symbols...

477 sym R (3565 sym/17 pcs) 2 img

Apply 10

11.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) Goal Calculate and visualize your portfolio’s beta. Choose your stocks and the baseline market. from 2012-12-31 to present 1 Import stock prices symbols <- c("NVDA", "AAPL", "NFLX", "MSFT", "TSLA") prices <- tq_get (x = symbols, from = "2012-12-31", ...

1062 sym R (2852 sym/16 pcs) 1 img

Apply 9

03.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) Goal Visualize and examine changes in the underlying trend in the performance of your portfolio in terms of Sharpe Ratio. Choose your stocks. from 2012-12-31 to present 1 Import stock prices symbols <- c("NVDA", "AAPL", "NFLX", "MSFT", "TSLA") prices <- tq_get (x = symbols, ...

1130 sym R (3299 sym/15 pcs) 1 img

Code Along 9

02.04.2023

# 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 = symbols...

447 sym R (4699 sym/17 pcs) 3 img