Datafeed returns an error using fetch function
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Adriano
el 18 de Abr. de 2017
Comentada: Denis Alaev
el 18 de Jun. de 2017
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!
0 comentarios
Respuesta aceptada
MathWorks Support Team
el 2 de Mayo de 2017
The MathWorks Support Team recently posted an update on this issue. Here is the answer to save you the click:
“In April 2017, Yahoo introduced some changes in the protocol of their API. These changes prevented the Datafeed Toolbox from connecting to the service. The following webpage contains the workaround for this issue and instructions on how to apply the fix. https://www.mathworks.com/support/bugreports/1571158 ”
0 comentarios
Más respuestas (6)
Shashank
el 21 de Abr. de 2017
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 comentarios
Walter Roberson
el 14 de Jun. de 2017
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
el 21 de Abr. de 2017
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 comentarios
Duncan Aitken
el 25 de Abr. de 2017
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.
avia gubbuy alon
el 19 de Mayo de 2017
again not working. please help.
1 comentario
Denis Alaev
el 18 de Jun. de 2017
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
el 29 de Mayo de 2017
Where can i download the two mentioned files yahoo.m and fetch.m ? Can't find it anywhere!!
Thanks!
0 comentarios
Ver también
Categorías
Más información sobre Money.Net en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!