Publications by Daniel Lee

Document

14.11.2022

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 2 Convert prices to returns 3 Assign a weight to each asset ## [1] "AGG" "EEM" "EFA" "IJS" "SPY" ## [1] 0.25 0.25 0.20 0.20 0.10 ## # A tibbl...

419 sym 3 img

Week 12: Code Along 11

16.11.2022

# Load packages # Core library(tidyverse) library(tidyquant) Functions Introductions When should you write a function df <- tibble::tibble( a = rnorm(10), b = rnorm(10), c = rnorm(10), d = rnorm(10) ) df$a <- (df$a - min(df$a, na.rm = TRUE)) / (max(df$a, na.rm = TRUE) - min(df$a, na.rm = TRUE)) df$b <- (df$b - min(df$b, na.rm = TRU...

296 sym R (1541 sym/23 pcs)

Document

16.11.2022

Functions When should you write a function? ## # A tibble: 10 × 4 ## a b c d ## <dbl> <dbl> <dbl> <dbl> ## 1 0.332 0.153 0.782 1 ## 2 0.765 0 0.473 0.519 ## 3 1 0.0651 0.498 0.448 ## 4 0 0.311 0.943 0.511 ## 5 0.809 0.573 0.373 0.168 ## 6 0.831 0.260 0 0.308 ## 7 0.516 0.143 1 0 #...

256 sym

Apply 11

17.11.2022

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_...

528 sym Python (2561 sym/22 pcs) 4 tbl

Document

18.11.2022

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_...

399 sym Python (2678 sym/21 pcs) 4 tbl

Monte Carlo Simulation

22.11.2022

# Load packages # Core library(tidyverse) library(tidyquant) # Import Excel files library(readxl) # 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"...

408 sym R (5444 sym/22 pcs) 2 img

Document

30.11.2022

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”, “IJS”, “EEM”, “AGG” from 2012-12-31 to 2017-12-31 1 Import stock prices 2 Convert prices to returns 3 Component Contribution Step-by-Step Refresh your memo...

603 sym 2 img

Best Practices 11

30.11.2022

Write one key takeaway per chapter. Write at least 100 words for each chapter summary. Ch1 It’s Not Just about Forecasting In chapter one we learned the main ideologies of economics and how we as future managers should focus on making critical decisions that will impact our future businesses if we choose to build on them. We really dig into le...

8494 sym

Code Along 12

30.11.2022

# 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”, “IJS”, ...

691 sym R (15643 sym/23 pcs) 2 img

Document

02.12.2022

# 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 symbols <- c("NFLX", "AMZN", "GOOG") prices <- tq_get(x = symbols, get = "stock.prices", ...

849 sym R (18129 sym/28 pcs) 1 img