Datafeed returns an error using fetch function
이전 댓글 표시
Hi everybody,
I'm trying to use "fetch" function with this code:
fetch(yahoo,'SPY',today())
but I recive this error:
Error using yahoo Unable to connect or retrieve data from given URL.
I used the same code 3 days ago and it worked. What's going on? Thanks!
채택된 답변
추가 답변 (6개)
Shashank
2017년 4월 21일
Hi Adraino,
MATLAB uses Yahoo's API under the hood. Around April 18 Yahoo introduced some changes in the protocol of their API. These changes prevented the Datafeed Toolbox from connecting to the service.
The development team implemented a fix that takes into account those changes, but the fix needs to be applied manually. To apply the fix, follow these steps:
1) Download the attached files: 'yahoo.m' and 'fetch.m'
2) Remove the following file
%MATLAB_ROOT%\toolbox\datafeed\datafeed\@yahoo\yahoo.p
%MATLAB_ROOT%\toolbox\datafeed\datafeed\@yahoo\fetch.m
where %MATLAB_ROOT% can be found with the following MATLAB command:
>> matlabroot
3) Place the downloaded files in the following locations:
%MATLAB_ROOT%\toolbox\datafeed\datafeed\@yahoo\yahoo.m
%MATLAB_ROOT%\toolbox\datafeed\datafeed\@yahoo\fetch.m
4) Run the following MATLAB command
>> rehash toolboxcache
>> clear classes
Now you should be able to retrieve historic and current data as usual:
>> % Historic data
>> d = fetch(yahoo,'IBM','Close','01/01/2012','06/30/2012');
>> d(1:3,:)
>>
>> % Current data
>> fetch(yahoo,'IBM')
댓글 수: 5
Alec Jeffery
2017년 4월 25일
Thanks, works perfectly!
Benjamin Wah
2017년 5월 25일
Hi, where can I download the files yahoo.m and fetch.m?
James Richard
2017년 5월 30일
Hi, how to find the attached files? thx
marcobar975
2017년 6월 14일
I cannot find the attachment either...
Walter Roberson
2017년 6월 14일
The attachments were withdrawn. Yahoo changed their system, disabling the interface that MATLAB used, and has not replaced it with anything useful as yet. You will not be able to get historical data from yahoo until Yahoo implements some new arrangment, and Mathworks writes a new routine to access it.
Philippe Loustaunau
2017년 4월 21일
0 개 추천
I tried this and it is not working. First there is inconsistency in the answer: The file you provided is yahoo.m, but you suggest we delete yahoo.p. The yahoo.m file is in the datafeed directory, the yahoo.p file is in the @yahoo directory, inside the datafeed directory. Since you attached the yahoo.m file, I assume you wanted to replace the one in the datafeed directory. I followed the steps, but it is not working, same error.
댓글 수: 2
Duncan Aitken
2017년 4월 25일
It works if you follow the instructions correctly.
The '@' character in the @yahoo folder name indicates that it's a class folder. Inside that folder are the class definition file and method files.
yahoo.p is an obfuscated version the yahoo class definition.
The new yahoo.m is a new yahoo class definition to replace the old one that was causing the error.
Replacing the yahoo.m in the datafeed directory was a mistake.
Philippe Loustaunau
2017년 4월 25일
thank you, I got it to work.
Alexandre Amorim
2017년 4월 30일
0 개 추천
Sweet!! Simple to solve and works fine!
avia gubbuy alon
2017년 5월 19일
0 개 추천
again not working. please help.
댓글 수: 1
Denis Alaev
2017년 6월 18일
It seems that after several changes Yahoo Finance closed their API forever, I think that's just Verizon costs cutting strategy and I'm pretty sure this API will not be working again. The API was closed on May 15, one month ago already.
I've tested several alternatives and found that https://eodhistoricaldata.com the best one for those who used Yahoo Finance. They provide raw data, adjusted closes and splits/dividends.
They also have CSV output, with very similar format for Yahoo Finance users, API Documentation and even VBA Examples (https://eodhistoricaldata.com/knowledgebase/)
Also there is a https://intrinio.com/ data provider, looks good, but they much more expensive, have no data for Mutual Funds and API is very different in compare to Yahoo Finance. Then you need to significantly change your code.
Munir Ruffo
2017년 5월 29일
0 개 추천
Where can i download the two mentioned files yahoo.m and fetch.m ? Can't find it anywhere!!
Thanks!
카테고리
도움말 센터 및 File Exchange에서 Web Services에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!