Closed lobo-az closed 4 years ago
Thanks for the report! I can replicate. It looks like the issue is that XML::htmlParse()
doesn't recognize https:// as a URL. We should be able to fix by setting isURL = TRUE
in the call.
That didn't work. Investigating other approaches now.
Just pushed a commit that fixes your example for me. I'd really appreciate it if you could test other stocks too. Especially some stocks that have splits and/or dividends in the time window you pull. I noticed that Toyota didn't have any splits between 2007-2020.
Let me know if you run into any issues while testing.
ive run into this before and used an explicit call to curl::curl(URL)
to get around it. that said, moving to xml2
is prolly the right call here as well
I tryied branch 310-yahooj-error
.
> library(devtools)
> devtools::install_github("joshuaulrich/quantmod", ref="310-yahooj-error")
> library(quantmod)
> > x<-getSymbols("4445.T", src="yahooj", from="2020-05-10", to="2020-05-15", auto.assign=FALSE)
> x
YJ4445.T.Open YJ4445.T.High YJ4445.T.Low
2020-05-11 1380 1406 1315
2020-05-12 1423 1465 1375
2020-05-13 1465 1530 1465
2020-05-14 1514 1580 1439
2020-05-15 1471 1565 1471
> y<-getSymbols("8306.T", src="yahooj", from="2020-05-10", to="2020-05-15", auto.assign=FALSE)
> y
YJ8306.T.Open YJ8306.T.High YJ8306.T.Low
2020-05-11 421.0 426.4 420.2
2020-05-12 420.0 420.8 414.3
2020-05-13 412.0 420.6 411.5
2020-05-14 414.4 415.4 406.1
2020-05-15 410.0 410.3 403.0
> z<-getSymbols("7203.T", src="yahooj", from="2020-05-10", to="2020-05-15", auto.assign=FALSE)
> z
YJ7203.T.Open YJ7203.T.High YJ7203.T.Low
2020-05-11 6620 6675 6582
2020-05-12 6610 6655 6485
2020-05-13 6412 6460 6372
2020-05-14 6300 6326 6243
2020-05-15 6300 6320 6208
Thanks @joshuaulrich ! 😄
I'd really appreciate it if you could test other stocks too.
I was able to get it with no problem. 🙆♂️
Thanks a lot!! This also solves #312 , much appreciated, including @lobo1981 's clear resolution. Just a pity Google
never returned this thread. devtools::install_github("joshuaulrich/quantmod")
solved the issue for me.
Description
Call
getSymbols("7203.T", src="yahooj")
is raised XML error.I tried use
debug
function.step through the execution of a function is https://github.com/joshuaulrich/quantmod/blob/c9777da6140dee9d7750cf5474df0481c2bc7c57/R/getSymbols.R#L501
Next, open URL https://info.finance.yahoo.co.jp/history/?code=7203.T&sm=1&sd=01&sy=2007&em=7&ed=11&ey=2020&tm=d&p=1 is displayed stock price of TOYOTA.
Expected behavior
Get stock price of TOYOTA.
Minimal, reproducible example
Session Info