The R Programming language is used to perform a rudimentary analysis on singular stock return. The first step is to load the quantmod
package and then pick a stock variable that will represent the target equity. Then set variables that will represent the start and end dates for a scpecified time span. in our example I used one year. This variable will be used to pull the ticker symbol from Yahoo Finance as shown below:
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.
stock_symbol <- c("HBAN") #choose stock symbol/ticker
From_Date = as.character(Sys.Date()-365*1)
To_Date = as.character(Sys.Date())
After the above variables are in place we next pull the stock price data from Yahoo Finance site. AFter we verify that the data is in time series format in the xts
and zoo
class type.
ticker <- getSymbols(stock_symbol,src = "yahoo",from=From_Date,
to=To_Date,auto.assign =
FALSE,adjust=TRUE)
## '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: There have been significant changes to Yahoo Finance data.
## Please see the Warning section of '?getSymbols.yahoo' for details.
##
## This message is shown once per session and may be disabled by setting
## options("getSymbols.yahoo.warning"=FALSE).
class(ticker) #verify data is in time sries format i.e. xts and zoo class
## [1] "xts" "zoo"
Our first plot is a simple candlestick chart surrounded by Bollinger Bands accompanied by volume data.
This outlines stock price activiy over the span of 365 days. I next proceeded to perform return analysis on the stock represented by the four graphs below.