Read downloaded file
cache=TRUE
TOTAL<-read.csv("Data/TOTAL.csv",header=TRUE,sep=",")
head(TOTAL)
## Date Open High Low Close Volume Adj.Close
## 1 2015-04-10 48.00 48.60 47.67 48.52 5457900 47.91
## 2 2015-04-09 47.13 47.97 46.50 47.97 6463500 47.36
## 3 2015-04-08 48.00 48.60 46.91 47.05 7678000 46.46
## 4 2015-04-07 46.42 47.90 46.34 47.60 8326300 47.00
## 5 2015-04-06 45.85 45.85 45.85 45.85 0 45.27
## 6 2015-04-03 45.85 45.85 45.85 45.85 0 45.27
names(TOTAL)
## [1] "Date" "Open" "High" "Low" "Close" "Volume"
## [7] "Adj.Close"
Set date format
TOTAL$Date=as.Date(TOTAL$Date, format="%Y-%m-%d")
Is there any NA values in dataset
sum(is.na(TOTAL))
## [1] 0
Plotting Stock Price
par("mar"=c(5.1,4,4.1,2.1))
library(quantmod)
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
##
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Loading required package: TTR
## Version 0.4-0 included new data defaults. See ?getSymbols.
getSymbols("FP.PA")
## As of 0.4-0, 'getSymbols' uses env=parent.frame() and
## auto.assign=TRUE by default.
##
## This behavior will be phased out in 0.5-0 when the call will
## default to use auto.assign=FALSE. getOption("getSymbols.env") and
## getOptions("getSymbols.auto.assign") are now 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 more details.
## [1] "FP.PA"
chartSeries(FP.PA, subset='last 3 months')
addBBands()
library(xts)
library(forecast)
## Loading required package: timeDate
## This is forecast 5.9
TOTAL.df<-read.table("Data/TOTAL.csv",header=TRUE,sep=",")
head(TOTAL.df)
## Date Open High Low Close Volume Adj.Close
## 1 2015-04-10 48.00 48.60 47.67 48.52 5457900 47.91
## 2 2015-04-09 47.13 47.97 46.50 47.97 6463500 47.36
## 3 2015-04-08 48.00 48.60 46.91 47.05 7678000 46.46
## 4 2015-04-07 46.42 47.90 46.34 47.60 8326300 47.00
## 5 2015-04-06 45.85 45.85 45.85 45.85 0 45.27
## 6 2015-04-03 45.85 45.85 45.85 45.85 0 45.27
TOTAL<-xts(TOTAL.df$Close,as.Date(TOTAL.df$Date))
Subset from 2010 to 2015 tail(TOTAL.df) head(TOTAL.df)
TOTAL<-window(TOTAL,start="2010-01-03", end="2015-04-03")
fit<-auto.arima(TOTAL)
fit
## Series: TOTAL
## ARIMA(0,1,0)
##
## sigma^2 estimated as 0.3172: log likelihood=-1154.93
## AIC=2311.87 AICc=2311.87 BIC=2317.09
plot(TOTAL)