Showing posts with label we will access the stock price information of AAPL and analyze the performance. Show all posts
Showing posts with label we will access the stock price information of AAPL and analyze the performance. Show all posts

Tuesday, August 13, 2019

we will access the stock price information of AAPL and analyze the performance

We will obtain the price data of AAPLstock from Yahoo! -R Finance for the given time period

data of AAPLstock

 "AAPL"
> ret.aapl <- dailyReturn(Cl(AAPL), type='log')
> chartSeries(ret.aapl)
> chartSeries(Cl(AAPL))
> addRSI()
> tail(AAPL)
           AAPL.Open AAPL.High AAPL.Low
2020-01-16    313.59    315.70   312.09
2020-01-17    316.27    318.74   315.00
2020-01-21    317.19    319.02   316.00
2020-01-22    318.58    319.99   317.31
2020-01-23    317.92    319.56   315.65
2020-01-24    320.25    323.33   317.52
           AAPL.Close AAPL.Volume
2020-01-16     315.24    27207300
2020-01-17     318.73    34454100
2020-01-21     316.57    27710800
2020-01-22     317.70    25458100
2020-01-23     319.23    26118000
2020-01-24     318.31    36600500
           AAPL.Adjusted
2020-01-16        315.24
2020-01-17        318.73
2020-01-21        316.57
2020-01-22        317.70
2020-01-23        319.23
2020-01-24        318.31
aapl_stock<- new.env()
> getSymbols("AAPL", env = aapl_stock, src = "yahoo", from = as.Date("2010-01-01"), to = as.Date("2019-08-12"))
[1] "AAPL"

we need to define the character vector

AAPL<-aapl_stock$AAPL
> head(AAPL)
           AAPL.Open AAPL.High AAPL.Low
2010-01-04  30.49000  30.64286 30.34000
2010-01-05  30.65714  30.79857 30.46429
2010-01-06  30.62571  30.74714 30.10714
2010-01-07  30.25000  30.28571 29.86429
2010-01-08  30.04286  30.28571 29.86572
2010-01-11  30.40000  30.42857 29.77857
           AAPL.Close AAPL.Volume
2010-01-04   30.57286   123432400
2010-01-05   30.62571   150476200
2010-01-06   30.13857   138040000
2010-01-07   30.08286   119282800
2010-01-08   30.28286   111902700
2010-01-11   30.01572   115557400
           AAPL.Adjusted
2010-01-04      26.68133
2010-01-05      26.72746
2010-01-06      26.30233
2010-01-07      26.25370
2010-01-08      26.42825
2010-01-11      26.19511
> chartSeries(AAPL,multi.col=TRUE,theme="white")
> addMACD()
> addBBands()
stock market,stocks,stock,how to analyze stocks,aapl stock price,apple stock price,stock trading,stock market for beginners,stock analysis,analyze stock,technical analysis of stocks,aapl stock,analyze stocks,apple stock,how to analyze a stock,stock prices,stock at low price,apple stock analysis,stock market basics


> AAPL_return <-
+     log(AAPL$AAPL.Close/AAPL$AAPL.Open)
> qqnorm(AAPL_return, main = "Normal Q-Q Plot of AAPL daily log return",
+        xlab = "Theoretical Quantiles",
+        ylab = "Sample Quantiles", plot.it = TRUE, datax = FALSE
+ )
> qqline(AAPL_return, col="red")
https://www.r-languagestatistics.co



Black-Scholes formula-R

 Black-Scholes formula-R > BlackScholes <- function(TypeFlag = c("c", "p"), S, X, Time, r, b, sigma) { TypeFla...