joshuaulrich / TTR

Technical analysis and other functions to construct technical trading rules with R
GNU General Public License v2.0
326 stars 102 forks source link

getYahooData no longer works #43

Closed humbletrader123 closed 7 years ago

humbletrader123 commented 7 years ago

Hi for last two days (started April 17, 2017) the TTR::getYahooData returns the following errors

> getYahooData("IBM", 19990404, 20050607)
Error in file(file, "rt") : cannot open the connection

There is absolutely no issue with my internet.

My TTR package version is 0.23-1 and R version is 2.15.2

I'd very much appreciate if someone takes a quick look and fix. This get function has been working daily for last 5 years.

Thanks

joshuaulrich commented 7 years ago

Thanks for the report! This is likely the same as https://github.com/joshuaulrich/quantmod/issues/149. Will patch this evening, but might not be on CRAN for a few more days.

Out of curiosity, why are you using a version of R that is nearly 5 years old?

humbletrader123 commented 7 years ago

Thank you for your quick response I need to upgrade it. I have tons of programs written under this version and it is very time consuming to test. Yes I will need to upgrade.

On Tue, Apr 18, 2017 at 9:56 PM, Joshua Ulrich notifications@github.com wrote:

Thanks for the report! This is likely the same as joshuaulrich/quantmod#149 https://github.com/joshuaulrich/quantmod/issues/149. Will patch this evening, but might not be on CRAN for a few more days.

Out of curiosity, why are you using a version of R that is nearly 5 years old?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joshuaulrich/TTR/issues/43#issuecomment-295040139, or mute the thread https://github.com/notifications/unsubscribe-auth/AadzdoyCMAb23Ab0OJF62I-VQybbqV7Lks5rxWndgaJpZM4NBGkK .

joshuaulrich commented 7 years ago

Okay, just pushed a patch to branch 43_yahoo_https. Note that HTTPS wasn't supported and used as a default on all platforms until R-3.3.0. So it's quite possible you will still have issues until you upgrade...

humbletrader123 commented 7 years ago

Hi this does not work starting two days ago

I've since upgraded to 3.3.3 and also applied two patches

"joshuaulrich/quantmod", ref="157_yahoo_502" "joshuaulrich/TTR", ref="43_yahoo_https"

But I got the following errors:

getYahooData('FB',start='20170101',end='20170501') Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open URL ' https://ichart.finance.yahoo.com/table.csv?s=FB&a=0&b=1&c=2017&d=4&e=17&f=2017&g=d&ignore=.csv': HTTP status was '502 Connection refused'

Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : cannot open URL 'https://ichart.finance.yahoo.com/table.csv?s= ^GSPC&a=0&b=01&c=2007&d=4&e=17&f=2017&g=d&q=q&y=0&z=^GSPC&x=.csv' In addition: Warning message: In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : cannot open URL 'https://ichart.finance.yahoo.com/table.csv?s=^GSPC&a=0&b=01&c=2007&d=4&e=17&f=2017&g=d&q=q&y=0&z=^GSPC&x=.csv': HTTP status was '502 Connection refused'

sessionInfo()

R version 3.3.3 (2017-03-06) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

locale: [1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252 LC_NUMERIC=C [5] LC_TIME=English_Canada.1252

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

other attached packages: [1] PerformanceAnalytics_1.4.3541 nortest_1.0-4 quantmod_0.4-8 xts_0.9-7 [5] zoo_1.8-0 moments_0.14 TTR_0.23-1

loaded via a namespace (and not attached): [1] tools_3.3.3 remotes_1.0.0 grid_3.3.3 lattice_0.20-35

On Tue, Apr 18, 2017 at 10:54 PM, Joshua Ulrich notifications@github.com wrote:

Okay, just pushed a patch to branch 43_yahoo_https. Note that HTTPS wasn't supported and used as a default on all platforms until R-3.3.0. So it's quite possible you will still have issues until you upgrade...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joshuaulrich/TTR/issues/43#issuecomment-295049068, or mute the thread https://github.com/notifications/unsubscribe-auth/AadzdhzYB3mSC3Mc5vvsGMipP3KDyoYNks5rxXdLgaJpZM4NBGkK .

joshuaulrich commented 7 years ago

@humbletrader123 It's the same issue as quantmod:157_yahoo_502, but I have to patch it in TTR too. The fix in quantmod doesn't apply to the TTR functions.

ghost commented 7 years ago

Joshua, thank you, fix 157 works well for downloading data off Yahoo again.. Somehow it did break something, when calculating historical volatility on a vector of logreturns: xts(apply(retGSPC,2,runSD,n=30),index(retGSPC))*sqrt(252) it gives a Error in runCov(x, x, n, use = "all.obs", sample = sample, cumulative) : Series contain non-leading NAs. The runCov function can't handle NAs and how did the quantmod patch change that ?

joshuaulrich commented 7 years ago

@ghost The running/rolling functions in TTR cannot handle missing values. Those are called inhomogeneous indicators, and they aren't simple to implement. While one single missing value may be easy to handle, missing values are hard to handle in these functions in a robust and general way.

humbletrader123 commented 7 years ago

Thanks Joshua for supporting this package for last few years I realized the days of free yahoo quotes are over.

Sent from my Samsung device

-------- Original message -------- From: Joshua Ulrich notifications@github.com Date: 05-29-2017 11:21 AM (GMT-05:00) To: joshuaulrich/TTR TTR@noreply.github.com Cc: humbletrader123 lawrence.sum@gmail.com, Mention mention@noreply.github.com Subject: Re: [joshuaulrich/TTR] getYahooData no longer works (#43)

@ghost The running/rolling functions in TTR cannot handle missing values. Those are called inhomogeneous indicators, and they aren't simple to implement. While one single missing value may be easy to handle, missing values are hard to handle in these functions in a robust and general way.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/joshuaulrich/TTR","title":"joshuaulrich/TTR","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/joshuaulrich/TTR"}},"updates":{"snippets":[{"icon":"PERSON","message":"@joshuaulrich in #43: @ghost The running/rolling functions in TTR cannot handle missing values. Those are called inhomogeneous indicators, and they aren't simple to implement. While one single missing value may be easy to handle, missing values are hard to handle in these functions in a robust and general way."}],"action":{"name":"View Issue","url":"https://github.com/joshuaulrich/TTR/issues/43#issuecomment-304685811"}}}