DISCLAIMER: I am not a financial advisor and this is not financial advice. All information found here, including any ideas, opinions, views, predictions, forecasts, commentaries, suggestions, or stock picks, expressed or implied herein, are for informational, entertainment or educational purposes only and should not be construed as personal investment advice. While the information provided is believed to be accurate, it may include errors or inaccuracies.
“In short, history has given gold a power surpassing that of any other commodity on the planet, and that power has never really disappeared.”
SPDR’s Gold Shares ETF (GLD)
VanEck >Vectors Gold Miners ETF (GDX).
install.packages("quantmod", repos = "http://cran.rstudio.com/")
install.packages("shiny", repos = "http://cran.rstudio.com/")
library(shiny)
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
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
getSymbols(c("GLD", "GDX"), src='yahoo')
## '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.
## [1] "GLD" "GDX"
## GLD.Open GLD.High GLD.Low GLD.Close GLD.Volume GLD.Adjusted
## 2007-01-03 63.58 64.02 62.00 62.28 8061900 62.28
## 2007-01-04 62.07 62.50 61.52 61.65 4858600 61.65
## 2007-01-05 60.75 60.78 59.66 60.17 12500100 60.17
## 2007-01-08 60.38 60.54 59.85 60.48 3478700 60.48
## 2007-01-09 60.14 61.09 60.06 60.85 4170400 60.85
## 2007-01-10 60.46 60.82 60.06 60.59 3766000 60.59
## GDX.Open GDX.High GDX.Low GDX.Close GDX.Volume GDX.Adjusted
## 2007-01-03 40.19 40.22 38.11 38.43 950300 35.05513
## 2007-01-04 38.10 38.24 37.53 37.72 680300 34.40749
## 2007-01-05 36.65 37.34 36.65 37.21 1869400 33.94226
## 2007-01-08 37.30 37.41 36.77 37.30 946000 34.02436
## 2007-01-09 36.75 37.20 36.25 37.05 742800 33.79631
## 2007-01-10 36.32 36.80 36.19 36.61 622700 33.39497
quarterGLD <-quarterlyReturn(GLD)
quarterGDX <-quarterlyReturn(GDX)
## quarterly.returns
## 2007-03-30 0.03397288
## 2007-06-29 -0.02236083
## 2007-09-28 0.14376856
## 2007-12-31 0.12175210
## 2008-03-31 0.09641044
## 2008-06-30 0.01095009
## quarterly.returns
## 2007-03-30 -0.01542670
## 2007-06-29 -0.04245643
## 2007-09-28 0.19688570
## 2007-12-31 0.01058443
## 2008-03-31 0.04080294
## 2008-06-30 0.01865826
“As the price of gold goes up, miners’ higher profit margins can boost earnings exponentially. Suppose a mining company has a profit margin of $200 when the price of gold is $1000. If the price rises 10%, to $1100 an ounce, the operating margin of the gold miners goes up to $300 – a 50% increase.”
chart_Series(quarterGLD, name = "Quartly Returns of Gold and Gold Miners 2007-03-30 / 2021-07-16")
add_TA(quarterGDX, on = 1, col="blue")
legend("topright",c("GLD", "GDX"), fill=c("orange","blue"))
var(quarterGLD)
## quarterly.returns
## quarterly.returns 0.005211046
var(quarterGDX)
## quarterly.returns
## quarterly.returns 0.02666254
cov(quarterGLD, y = quarterGDX)
## quarterly.returns
## quarterly.returns 0.009239913
cor(quarterGLD, y = quarterGDX)
## quarterly.returns
## quarterly.returns 0.7838891
hist(quarterGLD, main= "Quarterly Returns of GLD", xlab= "Quarterly Returns", col="lightblue")
abline(v=c(mean(quarterGLD),median(quarterGLD)), col=c("blue", "red"), lty=c(1,2), lwd=c(1, 3))
legend("topright",c("Mean", "Medium"), fill=c("blue","red"))
mean(quarterGLD)
## [1] 0.01936648
median(quarterGLD)
## [1] 0.02270116
hist(quarterGDX, main= "Quarterly Returns of GDX", xlab= "Quarterly Returns", col="lightblue")
abline(v=c(mean(quarterGDX),median(quarterGDX)), col=c("blue", "red"), lty=c(1,2), lwd=c(1, 3))
legend("topright",c("Mean", "Medium"), fill=c("blue","red"))
mean(quarterGDX)
## [1] 0.009232774
median(quarterGDX)
## [1] 0.01058443