Dear all,
I am trying to follow along/ recreate this page ( but I do not get the
same results) :-
https://bookdown.org/sstoeckl/Tidy_Portfoliomanagement_in_R/s-2Data.html
Here is a reprex / what I have done till now / my queries ( 3 in
number ) are as comments :-
> library(tidyquant)
Loading required package: lubridate
Attaching package: ?lubridate?
The following object is masked from ?package:base?:
date
Loading required package: PerformanceAnalytics
Loading required package: xts
Loading required package: zoo
Attaching package: ?zoo?
The following objects are masked from ?package:base?:
as.Date, as.Date.numeric
Attaching package: ?PerformanceAnalytics?
The following object is masked from ?package:graphics?:
legend
Loading required package: quantmod
Loading required package: TTR
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
Version 0.4-0 included new data defaults. See ?getSymbols.
?? Need to Learn tidyquant? ????????????????????????????????????????????????????
Business Science offers a 1-hour course - Learning Lab #9: Performance
Analysis & Portfolio Optimization with tidyquant!
</> Learn more at:
https://university.business-science.io/p/learning-labs-pro
</>> library(tidyverse)
?? Attaching packages ??????????????????????????????????????? tidyverse 1.3.0 ??
? ggplot2 3.2.1 ? purrr 0.3.3
? tibble 3.0.3 ? dplyr 1.0.1
? tidyr 1.1.1 ? stringr 1.4.0
? readr 1.3.1 ? forcats 0.4.0
?? Conflicts ?????????????????????????????????????????? tidyverse_conflicts() ??
? lubridate::as.difftime() masks base::as.difftime()
? lubridate::date() masks base::date()
? dplyr::filter() masks stats::filter()
? dplyr::first() masks xts::first()
? lubridate::intersect() masks base::intersect()
? dplyr::lag() masks stats::lag()
? dplyr::last() masks xts::last()
? lubridate::setdiff() masks base::setdiff()
? lubridate::union() masks base::union()> tq_exchange_options()
[1] "AMEX" "NASDAQ"
"NYSE"> tq_index_options()
[1] "DOW" "DOWGLOBAL" "SP400"
"SP500" "SP600"
# Query 1 : The above should also show RUSSELL3000. Why is it not showing?
> tq_get_options()
[1] "stock.prices" "stock.prices.japan"
"dividends"
[4] "splits" "economic.data"
"quandl"
[7] "quandl.datatable" "tiingo"
"tiingo.iex"
[10] "tiingo.crypto" "alphavantager"
"alphavantage"
[13] "rblpapi"> glimpse(sp500)
Error in glimpse(sp500) : object 'sp500' not found
# Query 2 : This is working fine in the page mentioned on top. What
mistake have I made?
> tq_exchange("NYSE")
Getting data...
[1] NA
Warning messages:
1: In download.file(url, destfile = tmp, quiet = TRUE) :
URL
'https://old.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nyse&render=download':
status was 'Failure when receiving data from the peer'
2: In value[[3L]](cond) : Error at nyse during call to
tq_exchange.>
# Query 3 : Is this a networking issue? Should I try after some time ?
Here is my session info:-
> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS
Matrix products: default
BLAS/LAPACK:
/opt/intel/compilers_and_libraries_2018.2.199/linux/mkl/lib/intel64_lin/libmkl_rt.so
locale:
[1] LC_CTYPE=en_IN LC_NUMERIC=C LC_TIME=en_IN
[4] LC_COLLATE=en_IN LC_MONETARY=en_IN LC_MESSAGES=en_IN
[7] LC_PAPER=en_IN LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_IN LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.4.0 stringr_1.4.0
[3] dplyr_1.0.1 purrr_0.3.3
[5] readr_1.3.1 tidyr_1.1.1
[7] tibble_3.0.3 ggplot2_3.2.1
[9] tidyverse_1.3.0 tidyquant_1.0.1
[11] quantmod_0.4-15 TTR_0.23-6
[13] PerformanceAnalytics_2.0.4 xts_0.12-0
[15] zoo_1.8-7 lubridate_1.7.4
loaded via a namespace (and not attached):
[1] tidyselect_1.1.0 haven_2.2.0 lattice_0.20-38 colorspace_1.4-1
[5] vctrs_0.3.2 generics_0.0.2 rlang_0.4.7 pillar_1.4.6
[9] withr_2.1.2 glue_1.4.1 DBI_1.1.0 dbplyr_1.4.2
[13] modelr_0.1.5 readxl_1.3.1 lifecycle_0.2.0 Quandl_2.10.0
[17] cellranger_1.1.0 munsell_0.5.0 gtable_0.3.0 rvest_0.3.5
[21] curl_4.3 fansi_0.4.1 broom_0.5.3 Rcpp_1.0.3
[25] backports_1.1.5 scales_1.1.0 jsonlite_1.6 fs_1.3.1
[29] hms_0.5.2 stringi_1.4.6 grid_3.6.2 quadprog_1.5-8
[33] cli_2.0.1 tools_3.6.2 magrittr_1.5 lazyeval_0.2.2
[37] crayon_1.3.4 pkgconfig_2.0.3 ellipsis_0.3.0 xml2_1.2.2
[41] reprex_0.3.0 assertthat_0.2.1 httr_1.4.1 rstudioapi_0.10
[45] R6_2.4.1 nlme_3.1-143 compiler_3.6.2>
Many thanks,
Ashim