joshuaulrich / quantmod

Quantitative Financial Modelling Framework
http://www.quantmod.com/
GNU General Public License v3.0
794 stars 219 forks source link

getSymbol error #379

Closed Arissyz closed 1 year ago

Arissyz commented 1 year ago

Description

both " " and ' ' don't work

> library("quantmod")
> TSLA = getSymbols("TSLA")
Error in getSymbols.yahoo(Symbols = "TSLA", env = <environment>, verbose = FALSE,  : 
  Unable to import “TSLA”.
$ operator is invalid for atomic vectors
joshuaulrich commented 1 year ago

This works for me using the latest quantmod on CRAN (0.4.21). Can you please provide the output from sessionInfo()?

Arissyz commented 1 year ago

This works for me using the latest quantmod on CRAN (0.4.21). Can you please provide the output from sessionInfo()?

It's really weird but I always get the same error.

> sessionInfo()
R version 4.2.3 (2023-03-15 curt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] quantmod_0.4.21 TTR_0.24.3      xts_0.13.0      zoo_1.8-11     

loaded via a namespace (and not attached):
[1] compiler_4.2.3  tools_4.2.3     curl_5.0.0      grid_4.2.3     
[5] lattice_0.20-45
Noobesch commented 1 year ago

UPDATE:

got the 0.4.20 version from github and with that it still works

UPDATE END Seems to be the same error to me

if(!require('quantmod')) {
  install.packages('quantmod')
  library('quantmod')
}

TSLA = getSymbols("TSLA")

With sessionInfo()

R version 4.2.3 (2023-03-15 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale: [1] LC_COLLATE=English_United Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8
[3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.utf8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] quantmod_0.4.21 TTR_0.24.3 xts_0.13.0 zoo_1.8-11

loaded via a namespace (and not attached): [1] compiler_4.2.3 tools_4.2.3 curl_5.0.0 grid_4.2.3 lattice_0.20-45

joshuaulrich commented 1 year ago

Thanks for the info. Can you provide the output of packageDescription("jsonlite")?

If that returns NA and throws a warning about jsonlite not found, can you try again after installing the quantmod version on branch 380-import-jsonlite?

You can install it with remotes::install_github("joshuaulrich/quantmod@380-import-jsonlite")

Arissyz commented 1 year ago

It works after installing 380-import-jsonlite . Thank you very much!!

> packageDescription("jsonlite")
Package: jsonlite
Version: 1.8.4
Title: A Simple and Robust JSON Parser and Generator for R
License: MIT + file LICENSE
Depends: methods
Authors@R: c( person("Jeroen", "Ooms", role = c("aut", "cre"), email =
         "jeroen@berkeley.edu", comment = c(ORCID = "0000-0002-4035-0289")),
         person("Duncan", "Temple Lang", role = "ctb"), person("Lloyd", "Hilaiel",
         role = "cph", comment="author of bundled libyajl"))
URL: https://arxiv.org/abs/1403.2805 (paper)
BugReports: https://github.com/jeroen/jsonlite/issues
Maintainer: Jeroen Ooms <jeroen@berkeley.edu>
VignetteBuilder: knitr, R.rsp
Description: A reasonably fast JSON parser and generator, optimized for statistical
         data and the web. Offers simple, flexible tools for working with JSON in
         R, and is particularly powerful for building pipelines and interacting
         with a web API.  The implementation is based on the mapping described in
         the vignette (Ooms, 2014).  In addition to converting JSON data from/to R
         objects, 'jsonlite' contains functions to stream, validate, and prettify
         JSON data. The unit tests included with the package verify that all edge
         cases are encoded and decoded consistently for use with dynamic data in
         systems and applications.
Suggests: httr, vctrs, testthat, knitr, rmarkdown, R.rsp, sf
RoxygenNote: 7.2.1
Encoding: UTF-8
NeedsCompilation: yes
Packaged: 2022-12-05 23:21:23 UTC; jeroen
Author: Jeroen Ooms [aut, cre] (<https://orcid.org/0000-0002-4035-0289>), Duncan
         Temple Lang [ctb], Lloyd Hilaiel [cph] (author of bundled libyajl)
Repository: CRAN
Date/Publication: 2022-12-06 08:10:02 UTC
Built: R 4.2.3; x86_64-w64-mingw32; 2023-04-02 01:01:57 UTC; windows
ExperimentalWindowsRuntime: ucrt
Archs: x64

-- File: D:/R/R-4.2.3/library/jsonlite/Meta/package.rds 
joshuaulrich commented 1 year ago

Related to (and fixed by) #380.