-
-
Save zachlim98/0daa400fc0daabdd972beebbf204f0d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(riingo) | |
library(ggplot2) | |
library(tidyverse) | |
RIINGO_TOKEN <- "YOUR-TOKEN-HERE" | |
#set token for riingo | |
riingo_set_token(RIINGO_TOKEN) | |
#get prices for ROKU | |
aapl_price <- riingo_prices("AAPL", start_date = "2019-01-01") | |
#calculate log daily returns | |
returns_tib <- tibble(returns = diff(log(aapl_price$adjClose), lag=1)) | |
#plot log daily returns | |
returns_tib %>% ggplot(aes(x=returns)) + | |
geom_density(fill="#69b3a2", color="#e9ecef", alpha=0.8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment