Publications by Daniel Lee
Apply code 1
knitr::opts_chunk$set(echo = TRUE) library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.3 ✔ readr 2.1.4 ## ✔ forcats 1.0.0 ✔ stringr 1.5.0 ## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1 ## ✔ lu...
355 sym R (3083 sym/17 pcs) 4 img 4 tbl
Code Along 1
knitr::opts_chunk$set(echo = TRUE) library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.3 ✔ readr 2.1.4 ## ✔ forcats 1.0.0 ✔ stringr 1.5.0 ## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1 ## ✔ lu...
317 sym R (10838 sym/20 pcs) 4 img 3 tbl
Code Along 13
# 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 ...
416 sym R (8381 sym/36 pcs) 2 img
Apply to Data 13
# Load packages # Core library(tidyverse) library(tidyquant) # Source function source("../00_scripts/simulate_accumulation.R") 1 Import stock prices # Choose stocks symbols <- c("AAPL", "NVDA", "ADBE", "AVGO", "AMD") # Using tq_get() ---- prices <- tq_get(x = symbols, get = "stock.prices", from = "20...
710 sym R (4939 sym/25 pcs) 2 img
Code Along 12
# 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”, �...
483 sym R (14562 sym/30 pcs) 4 img
Apply to Data 12
# 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 stocks symbols <- c("AAPL", "NVDA", "ADBE", "AVGO", "AMD") # Using tq_get() ---- prices <- tq_get(x = ...
217 sym R (723 sym/3 pcs)
Code Along 12
# 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”, �...
483 sym R (14562 sym/30 pcs) 4 img
Apply to Data 9
# 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 # Choose stocks symbols <- c("AAPL", "NVDA", "ADBE", "AVGO", "AMD") # Using tq_get() --...
437 sym R (3978 sym/12 pcs) 1 img
Code Along 11
Ch19 Functions Introduction When should you write a function? # For reproducible work set.seed(1234) # Creat 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.rm = TRUE)) / (max(df$a, na.rm = TRUE) - min(df$a, na.rm = TRUE)) df...
184 sym
Apply13
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_un...
527 sym 4 tbl