Publications by Sumaj Billin

Apply13

05.12.2024

# Load packages # Core library(tidyverse) library(tidyquant) # Source function source("../Desktop/PSU_FIN3100_FinancialAnalytics/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("SPY", ...

1239 sym R (4898 sym/25 pcs) 2 img

Code Along 13

03.12.2024

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

414 sym R (8930 sym/35 pcs) 2 img

Apply12

21.11.2024

# 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("TSLA", "MSFT", "GOOG") prices <- tq_get(x = symbol...

742 sym R (19583 sym/23 pcs) 2 img

Code Along 12

19.11.2024

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

655 sym R (15279 sym/23 pcs) 2 img

Apply11

14.11.2024

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

468 sym 7 tbl

Code Along 11

12.11.2024

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

293 sym

Apply10

07.11.2024

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("TSLA", "MSFT", "GOOG") prices <- tq_get(x = symbols, get = "stock.prices", from = "2012-12-31") 2 Con...

933 sym R (2546 sym/16 pcs) 1 img

Code Along 10

05.11.2024

# Load packages # Core library(tidyverse) library(tidyquant) Goal Measure the portfolio’s beta coefficient, which can be thought of as the portfolio’s sensitivity to the market or its riskiness relative to the market. five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” market: “SPY” from 2012-12-31 to 2017-12-31 1 Imp...

540 sym R (3631 sym/17 pcs) 2 img

Apply9

30.10.2024

# 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("AAPL", "MSFT", "GOOG") prices <- tq_get(x = symbols, get ...

1064 sym R (2916 sym/11 pcs) 1 img

CodeAlong9

29.10.2024

# Load packages # Core library(tidyverse) library(tidyquant) Goal Measure which portfolio is expected to yield a higher return adjusted for risk using the Sharpe Ratio. The Sharpe Ratio is the mean of the excess portfolio returns (returns - risk free rate) divided by the standard deviation of the excess returns. five stocks: “SPY”, “E...

603 sym R (5359 sym/18 pcs) 3 img