getSymbols("JACK",from="2015-01-01")
## 'getSymbols' currently uses auto.assign=TRUE by default, but will
## use auto.assign=FALSE in 0.5-0. You will still be able to use
## 'loadSymbols' to automatically load data. getOption("getSymbols.env")
## and getOption("getSymbols.auto.assign") will still be checked for
## alternate defaults.
##
## This message is shown once per session and may be disabled by setting
## options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
## Warning: 'indexClass<-' is deprecated.
## Use 'tclass<-' instead.
## See help("Deprecated") and help("xts-deprecated").
## [1] "JACK"
getSymbols('RUTH',from='2015-10-01')
## Warning: 'indexClass<-' is deprecated.
## Use 'tclass<-' instead.
## See help("Deprecated") and help("xts-deprecated").
## [1] "RUTH"
getSymbols('SBUX',from='2015-10-01')
## Warning: 'indexClass<-' is deprecated.
## Use 'tclass<-' instead.
## See help("Deprecated") and help("xts-deprecated").
## [1] "SBUX"
getSymbols('TXRH',from='2015-10-01')
## Warning: 'indexClass<-' is deprecated.
## Use 'tclass<-' instead.
## See help("Deprecated") and help("xts-deprecated").
## [1] "TXRH"
Jack In The Box
chartSeries(JACK,
type = "bar",
show.grid = TRUE,
name = "Jack In The Box",
time.scale = NULL,
log.scale = FALSE,
TA = c(addVo(),addEMA(),addSMI(),addCMF(),addRSI()), # indicators on the chart
TAsep=';',
line.type = "l",
bar.type = "ohlc",
theme = chartTheme("white"),
layout = NA,
major.ticks='auto', minor.ticks=TRUE,
yrange=NULL,
plot=TRUE)
## Warning: 'indexClass<-' is deprecated.
## Use 'tclass<-' instead.
## See help("Deprecated") and help("xts-deprecated").

Ruth’s Hospitality Group
chartSeries(RUTH,
type = "bar",
show.grid = TRUE,
name = "Ruth's Hospitality Group",
time.scale = NULL,
log.scale = FALSE,
TA = c(addVo(),addEMA(),addSMI(),addCMF(),addRSI()), # indicators on the chart
TAsep=';',
line.type = "l",
bar.type = "ohlc",
theme = chartTheme("white"),
layout = NA,
major.ticks='auto', minor.ticks=TRUE,
yrange=NULL,
plot=TRUE)
## Warning: 'indexClass<-' is deprecated.
## Use 'tclass<-' instead.
## See help("Deprecated") and help("xts-deprecated").

Texas Roadhouse
chartSeries(TXRH,
type = "bar",
show.grid = TRUE,
name = "Texas Roadhouse",
TA = c(addVo(),addEMA(),addSMI(),addCMF(),addRSI()), # indicators on the chart
TAsep=';',
line.type = "l",
bar.type = "ohlc",
theme = chartTheme("white"),
layout = NA,
major.ticks='auto', minor.ticks=TRUE,
yrange=NULL,
plot=TRUE)
## Warning: 'indexClass<-' is deprecated.
## Use 'tclass<-' instead.
## See help("Deprecated") and help("xts-deprecated").

Starbucks Corp
chartSeries(SBUX,
type = "bar",
show.grid = TRUE,
name = "Starbucks Corp",
#time.scale = NULL,
#log.scale = FALSE,
TA = c(addVo(),addEMA(),addSMI(),addCMF(),addRSI()), # indicators on the chart
TAsep=';',
line.type = "l",
bar.type = "ohlc",
theme = chartTheme("white"),
layout = NA,
major.ticks='auto', minor.ticks=TRUE,
#yrange=NULL,
plot=TRUE)
## Warning: 'indexClass<-' is deprecated.
## Use 'tclass<-' instead.
## See help("Deprecated") and help("xts-deprecated").

Comparing annual return from 2015 to 2020
ra <- c("RUTH", "TXRH", "SBUX","JACK") %>%
tq_get(get = "stock.prices",
from = "2015-01-01",
to = "2020-10-04") %>%
group_by(symbol) %>%
tq_transmute(select = adjusted,
mutate_fun = periodReturn,
period = "yearly",
col_rename = "Return")
ggplot(ra, aes(x=date, y=Return, colour = symbol)) +
geom_line(size=1) +
labs(title="Annual Return Comparison", y= "Percent", x = "")
