Library Setup:
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.
library(psych)
Stock and graph setup:
start=as.Date("2014-01-01")
end=as.Date("2018-08-10")
getSymbols("HMNY", src="yahoo", from=start, to=end)
## '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).
## [1] "HMNY"
plot.ts(HMNY$HMNY.Close, main="Helios and Matheson Analytics Inc \nDaily Stock Prices from 1/1/14 to 8/10/18", ylab="$ / Share")
Various analyses:
str(HMNY) #structure
## An 'xts' object on 2014-01-02/2018-08-09 containing:
## Data: num [1:1160, 1:6] 1425 1402 1400 1388 1450 ...
## - attr(*, "dimnames")=List of 2
## ..$ : NULL
## ..$ : chr [1:6] "HMNY.Open" "HMNY.High" "HMNY.Low" "HMNY.Close" ...
## Indexed by objects of class: [Date] TZ: UTC
## xts Attributes:
## List of 2
## $ src : chr "yahoo"
## $ updated: POSIXct[1:1], format: "2018-08-13 00:00:55"
describe(HMNY) #common formulas applied to it
## vars n mean sd median trimmed mad min
## HMNY.Open 1 1160 1012.90 839.21 708.75 875.71 428.10 0.07
## HMNY.High 2 1160 1074.87 930.52 742.50 917.63 459.61 0.07
## HMNY.Low 3 1160 962.00 764.34 672.50 841.28 404.01 0.06
## HMNY.Close 4 1160 1009.21 827.13 705.00 875.66 435.51 0.06
## HMNY.Volume 5 1160 1299714.48 18969805.11 0.00 2467.89 0.00 0.00
## HMNY.Adjusted 6 1160 1008.70 826.83 705.00 875.02 435.51 0.06
## max range skew kurtosis se
## HMNY.Open 8350.0 8349.93 2.45 10.39 24.64
## HMNY.High 9715.0 9714.93 2.67 12.44 27.32
## HMNY.Low 7052.5 7052.44 2.15 7.44 22.44
## HMNY.Close 8225.0 8224.94 2.38 9.88 24.29
## HMNY.Volume 473889400.0 473889400.00 19.03 408.59 556972.66
## HMNY.Adjusted 8225.0 8224.94 2.38 9.90 24.28
head(HMNY) #older data
## HMNY.Open HMNY.High HMNY.Low HMNY.Close HMNY.Volume
## 2014-01-02 1425.0 1425.0 1417.5 1417.5 0
## 2014-01-03 1402.5 1402.5 1397.5 1397.5 0
## 2014-01-06 1400.0 1400.0 1387.5 1387.5 0
## 2014-01-07 1387.5 1470.0 1387.5 1450.0 0
## 2014-01-08 1450.0 1505.0 1450.0 1472.5 0
## 2014-01-09 1412.5 1485.0 1412.5 1485.0 0
## HMNY.Adjusted
## 2014-01-02 1398.181
## 2014-01-03 1378.454
## 2014-01-06 1368.590
## 2014-01-07 1430.239
## 2014-01-08 1452.432
## 2014-01-09 1464.761
tail(HMNY) #newer data
## HMNY.Open HMNY.High HMNY.Low HMNY.Close HMNY.Volume
## 2018-08-02 0.20 0.20 0.10 0.10 98048900
## 2018-08-03 0.11 0.14 0.06 0.07 155377100
## 2018-08-06 0.07 0.18 0.07 0.08 473889400
## 2018-08-07 0.10 0.12 0.07 0.07 313246200
## 2018-08-08 0.07 0.08 0.06 0.07 197437600
## 2018-08-09 0.07 0.07 0.06 0.06 136594900
## HMNY.Adjusted
## 2018-08-02 0.10
## 2018-08-03 0.07
## 2018-08-06 0.08
## 2018-08-07 0.07
## 2018-08-08 0.07
## 2018-08-09 0.06
head(HMNY) tail(HMNY)