Report for GOOG on 2018-12-11

Summary

library(stringr)
library(lubridate)
library(quantmod)
library(DT)
library(dygraphs)
library(forecast)
library(highcharter)

prices <- round(getSymbols(params$symbol, auto.assign = FALSE, src = "yahoo"), 2)
close <- Cl(last(prices))
open <- Op(last(prices))

recent <- last(prices, n=params$days)
recent_nv <- recent[,-5]

The stock closed up at 1039.55 dollars per share yesterday.

Price History

The chart below is made with the quantmod and highcharter R packages. An API returns all of the price history based on the stock tick symbol provided as a parameter. The candlestick chart is a default function from highcharter, as is the the Economist theme.

Raw Data

The table below displays the daily price data for GOOG for the last 90 days. A concise, interactive table is created with the DT package.

df <- as.data.frame(recent)
df[,paste0(params$symbol, ".Volume")] <- df[,paste0(params$symbol, ".Volume")]/1000000 
datatable(df) %>% 
  formatCurrency(c(paste0(params$symbol, ".Open"), paste0(params$symbol, ".High"), paste0(params$symbol, ".Low"), paste0(params$symbol,".Close")), digits=2) %>% 
  formatRound(c(paste0(params$symbol, ".Volume")), digits=0)

Model

arima_coefs <- eval(parse(text = paste0("c(", str_extract(params$model, "\\d,\\d,\\d"), ")")))
m <- arima(recent[,1], arima_coefs)
f <- forecast(m, as.numeric(params$forecast - Sys.Date()))

The forecast for 2018-12-12 is 1035.05 dollars.

This model is fit with the arima function in the forecast package. A First Difference - Arima 0,1,0 model is used though in practice any range of models could be used.

plot(forecast(m,7), main="")