-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathShinyStocks.Rpres
More file actions
78 lines (68 loc) · 3.15 KB
/
ShinyStocks.Rpres
File metadata and controls
78 lines (68 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Shiny Stocks
========================================================
author: Ruslan Kharitonov
date: January 24, 2015
Overview
========================================================
This Shiny Application helps to visualize Stock price
and trading volume using 'quantmod' package.
- 'quntmod' package
- Deployment of ShinyStocks
- Visualizing 'AAPL' stock
- Analyzing 'AAPL' stock
- Determining 'APPL' price direction
- Conclusion
'quntmod' package
========================================================
- It is 'A rapid prototyping environment,
where quant traders can quickly
and cleanly explore and build trading models.'
- More details on http://www.quantmod.com/
- Used 'quntmod' in this project to simplify downloading and visualizing stock data.
- Installation of 'quntmod' package
```{r, eval=FALSE}
install.packages('quntmod')
```
Deployment of ShinyStocks
========================================================
- Could not use shyniapps.io due to it's lack of support for packages on 'R-Forge' repository
- 'zoo' is a dependency of 'quantmod', and it is on 'R-Forge' repository
- Created and configured Shiny Server on Amazon AWS EC2 Linux instance
- Used 'Ubuntu With R and Shiny (ami-5fe69f6f)' AMI to simplify the setup
- http://ec2-54-149-56-170.us-west-2.compute.amazonaws.com:3838/ShinyStocks/
Visualizing 'AAPL' Stock
========================================================
- The Shine Stocks can be used to visual and analyze stocks
- Change 'Date range' will be reactive - recalculate the chart and other measures
- Example chart shows volatility of 'APPL' over 30 days
```{r, echo=FALSE}
library('quantmod')
data <- getSymbols('AAPL',
from = '2014-11-24',
to = '2015-01-24',
auto.assign=FALSE)
chartSeries(data,
theme = chartTheme("white"),
TA = NULL
)
```
Determining 'APPL' price direction
========================================================
- Determining price by comparing average (mean)
to the latest price ($112.98 per share).
- Will use the Adjusted close daily price (Ad)
- Price Direction Hypothesis: If latest price minus Adjusted Mean of a period is positive then direction is **Up**, otherwise it is **Down**.
- ('2015-01-22' to '2015-01-24') Adj Mean: $112.69 **Up**
- ('2015-01-19' to '2015-01-24') Adj Mean: $110.91 **Up**
- ('2014-11-24' to '2015-01-24') Adj Mean: $111.86 **Up**
- ('2014-01-24' to '2015-01-24') Adj Mean: $93.47 **Up**
- ('2010-01-24' to '2015-01-24') Adj Mean: $64.79 **Up**
Conclusion
========================================================
- chartSeries() can only be used with a period of 3 or more days, otherwise it produced an error.
- Need to take into account Stock splits (Adjusted Price) to determine correct average
- Latest price minus Adjusted Mean seems to predict historic direction of the stock price movement for 'APPL'
- It is unclear how the size of the period impacts the historic prediction
- Moving Average Convergence Divergence (MACD) is probably a better indicator of direction of a Stock price.
- Detail on MACD: http://en.wikipedia.org/wiki/MACD
- 'Past performance is not an indicator of future success'