Comments (6)
I have the same problem. Copying the yahoo function and made some changes and it works. But parsing csv sometimes fails. Hope more can take a look at this problem. My adjusted functions below:
function getyahoocrumb()
ustr = "https://ca.finance.yahoo.com/quote/^GSPC/history?p=^GSPC";
response = Requests.get(ustr);
str = readstring(response);
m = match(r""user":{"crumb":"(.*?)"", str) ;
crumb = m[1]
mcookies = cookies(response)
return crumb, mcookies
end
function yahoo2(symb::String;
from::String="1900-01-01",
thru::String=string(Dates.today()),
freq::Char='d', crumb = getyahoocrumb())
@Assert freq in ['d','w','m','v'] "Argument freq
must be in ['d','w','m','v']"
@Assert from[5] == '-' && from[8] == '-' "Argument from
has invalid date format."
@Assert thru[5] == '-' && thru[8] == '-' "Argument thru
has invalid date format."
dtFrom = Dates.DateTime(from)
dtThru = Dates.DateTime(thru)
# symb = "XOM"
# dtFrom = Dates.DateTime("2016-01-01")
# dtThru = Dates.DateTime("2017-05-18")
per1 = Int(floor(Dates.datetime2unix(dtFrom)))
per2 = Int(floor(Dates.datetime2unix(dtThru)))
crumb = "Df1WvGdhjEg"
crumb, mcookies = getyahoocrumb()
qrystr= string("https://query1.finance.yahoo.com/v7/finance/download/",symb,"?period1=", per1, "&period2=", per2,"&interval=1d&events=history&crumb=", crumb)
# println(qrystr)
# indata = Temporal.csvresp(get(qrystr))
indata = Temporal.csvresp(get(qrystr, cookies = mcookies))
sleep(0.8)
return ts(indata[1], indata[2], indata[3][2:end])
end
from temporal.jl.
It seems that yahoo is discontinuing its service.
from temporal.jl.
@AntonioSaragga Could you provide a source suggesting this is the case? Best I've found is an answer on this forum. I know R's quantmod package has been experiencing this issue lately, but not sure if it's resolved (and given that Joshua Ulrich is a very proactive package maintainer, that would tell me this is a non-trivial issue).
from temporal.jl.
@haavardhvarnes Thanks for taking a crack at getting it to work again, that's much appreciated! I'll try it out see if it's possible to get it worked out. If Yahoo hasn't discontinued the service and we can get this solved I'll try to merge that into the package ASAP.
from temporal.jl.
Seeing some workarounds for packages in other languages out there. This project implements a "temporary fix" for the function in the Pandas package in Python that downloads data from the Yahoo Finance API. See this Stack Overflow thread for some insights around the work done on R's quantmod package to solve the issue. If anyone has experience with either of these please provide thoughts/feedback on how they've been working.
from temporal.jl.
Alright all, with the great help of @haavardhvarnes's initial workaround above, I have managed to get a fix put in place for the Yahoo Finance data downloading functionality. There are some changes to the arguments required to fit the new URL formatting needs:
freq
argument now a String (not Char) that can be "d", "wk", or "mo"- new
event
argument specifies what kind of data you want, can be "history", "div", or "split" - new
crumb_tuple
argument in case you don't want to re-generate cookies every time you run it
I'm about to send through an update / PR to Julia's METADATA repo, so hopefully this fix should be available to the wider community with a Pkg.update()
soon. Until then, feel free to pull the changes from git to your local package directory and you should be all set.
Thanks again everyone for the input on this issue and for helping out the legwork on a workaround. Hopefully this issue will be solved for the time being. However, it did also raise an interesting note in my mind that it would be good to have more options for market data sources going forward (Google, etc.). If anyone would like to contribute with any functionality for sources other than Yahoo and Quandl, I'd be happy to work with you on it. Cheers.
from temporal.jl.
Related Issues (20)
- AlphaVantage Support
- Modify column name of "Adj Close" HOT 9
- Move data reader out of Temporal HOT 2
- rename columns name using a (or several) Pair of Symbol or a Function (Symbol -> Symbol) HOT 2
- rename columns name using a function
- Deprecated syntax `@doc call with ->`
- Warning: Deprecated syntax `implicit assignment to global variable `x2`` HOT 2
- io parameter is missing HOT 1
- Yahoo API Bug HOT 4
- Construct TS from NamedTuple HOT 2
- Last row of TS is not displayed HOT 2
- Request HOT 2
- Reply HOT 1
- `using Temporal; using Temporal` takes 13 times slower on Julia 1.2, Julia 1.3 HOT 2
- Downloading data produces a stack trace HOT 2
- Can not install "Temporal.jl" with latest "Plots(v1.6.4)" and "RecipesBase" ! HOT 1
- Update HTTP version HOT 2
- Difference to TimeSeries.jl HOT 1
- TagBot trigger issue HOT 1
- Functions that accept a pad & padval (eg: lag) should not assert on too few rows.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from temporal.jl.