Column

Alibaba (BABA)

BABA <- pdfetch_YAHOO("BABA", fields = c("open", "high", "low", "close"), from = as.Date("2019-01-01"),interval = "1d")
colnames(BABA)=c("Open","High","Low","Close")

m <- tail(BABA, n = 365)

#plot
dygraph(m,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
dyCandlestick() %>%
dyLegend(width = 400) %>%
dyRangeSelector(dateWindow = c("2019-01-01", "2019-12-18"))

Tesla (TSLA)

TSLA <- pdfetch_YAHOO("TSLA", fields = c("open", "high", "low", "close"), from = as.Date("2019-01-01"),interval = "1d")
colnames(TSLA)=c("Open","High","Low","Close")

m <- tail(TSLA, n = 365)

#plot
dygraph(m,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
dyCandlestick() %>%
dyLegend(width = 400) %>%
dyRangeSelector(dateWindow = c("2019-01-01", "2019-12-18"))

Amazon (AMZN)

AMZN <- pdfetch_YAHOO("AMZN", fields = c("open", "high", "low", "close"), from = as.Date("2019-01-01"),interval = "1d")
colnames(AMZN)=c("Open","High","Low","Close")

m <- tail(AMZN, n = 365)

#plot
dygraph(m,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
dyCandlestick() %>%
dyLegend(width = 400) %>%
dyRangeSelector(dateWindow = c("2019-01-01", "2019-12-18"))

JP Morgan (JPM)

JPM <- pdfetch_YAHOO("JPM", fields = c("open", "high", "low", "close"), from = as.Date("2019-01-01"),interval = "1d")
colnames(JPM)=c("Open","High","Low","Close")

m <- tail(JPM, n = 365)

#plot
dygraph(m,
        ylab = "Stock Price ($)",
        group = "stockprices") %>%
dyCandlestick() %>%
dyLegend(width = 400) %>%
dyRangeSelector(dateWindow = c("2019-01-01", "2019-12-18"))

According to the chart we created, we can see that all these four companies have increased their stock prices. Alibaba and JP Morgan are more stable, but we think JP Morgan is near the highest point. Base on the timeline, it’s the holiday season, and it’s about to reach Chinese New year, so we think Alibaba will be the best choice to invest.