Publications by SheaClark7
Document
1 Import stock prices of your choice 2 Convert prices to returns by quarterly 3 Make plot ## $y ## [1] "frequency" ## ## $x ## [1] "Rate of Returns" ## ## $title ## [1] "Distribution of quarterly returns, 2023-2024" ## ## attr(,"class") ## [1] "labels" 4 Interpret the Plot Based on the histogram, a typical quarterly return is high...
400 sym 1 img
Document
# Load packages # Core library(tidyverse) library(tidyquant) Goal Take raw prices of five individual stocks and transform them into monthly returns five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” 1 Import stock prices # Choose Stocks symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = symbols, ...
215 sym R (1306 sym/6 pcs) 1 img
Publish Document
library(tidyverse) library(tidyquant) Get stock prices and convert to returns Ra <- c("FDX", "ADBE", "BA") %>% tq_get(get = "stock.prices", from = "2024-01-01") %>% group_by(symbol) %>% tq_transmute(select = adjusted, mutate_fun = periodReturn, period = "monthly", ...
305 sym R (3150 sym/11 pcs)
Document
library(tidyverse) # Core Functions library(tidyquant) # For Financial Analysis ## Import Data AAPL <- tq_get("AAPL") Line Chart AAPL %>% ggplot(aes(x = date, y = close)) + geom_line() + labs(title = "AAPL Line Chart", y = "Closing Price", x = "") + theme_tq() Bar Chart AAPL %>% tail(30) %>% ggplot(aes(x = date, ...
55 sym R (737 sym/4 pcs) 3 img
Document
# Load Packages library(tidyverse) library(tidyquant) Stock Index tq_index_options() ## [1] "DOW" "DOWGLOBAL" "SP400" "SP500" "SP600" data <- tq_index("DOW") tq_index("DOW") ## # A tibble: 31 × 8 ## symbol company identifier sedol weight sector shares_held local_currency ## <chr> <chr> <chr> <chr> <dbl>...
81 sym R (2681 sym/11 pcs)
Document
Provide Major Takeaways from Chapter 1 in 50 words Reproducible finance is a philosophy about how to do quantitative, data driven financial analysis. The book focuses on 3 main universes. The most focused on is XTS, which stands for extensable time series. XTS is followed by tidyverse and tidyquant. The work done in these universes will then be...
469 sym
Document
Get stock prices and convert to returns Ra <- c("AAPL", "GOOG", "NFLX") %>% tq_get(get = "stock.prices", from = "2010-01-01", to = "2015-12-31") %>% group_by(symbol) %>% tq_transmute(select = adjusted, mutate_fun = periodReturn, period = "monthly", ...
130 sym Python (2825 sym/8 pcs)
Document
Import stock prices stocks <- tq_get(c("AVGO", "AMD", "CRWD"), get = "stock.prices", from = "2022-10-25", to = "2024-03-15") stocks ## # A tibble: 1,044 × 8 ## symbol date open high low close volume adjusted ## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ##...
143 sym Python (5115 sym/15 pcs) 1 img
Document
Import Data flights ## # A tibble: 336,776 × 19 ## year month day dep_time sched_dep_time dep_delay arr_time sched_arr_time ## <int> <int> <int> <int> <int> <dbl> <int> <int> ## 1 2013 1 1 517 515 2 830 819 ## 2 2013 1 1 533 529 ...
336 sym Python (19905 sym/49 pcs) 1 img
Document
Coding basics R as a calculator 1000 / 10 ## [1] 100 x <- 1000/10 # x assignment symbol What’s in a name? Calling functions Use of TAB seq(from = 1, to = 10, by = 1) ## [1] 1 2 3 4 5 6 7 8 9 10 continuation character, + seq(from = 1, to = 10) ## [1] 1 2 3 4 5 6 7 8 9 10 Printing to screen y <- seq(from = 1, to = 10) y...
171 sym Python (229 sym/9 pcs)