Hello,
I am working on a program that will retrieve data the most recent data from yahoo fiance (without the DataFeed toolbox), to be processed in a separate program. I found a helpful webpage which details the necessary URL address to download data from.
So for a ticker, say GOOG, I can construct the appropriate URL and put it into my seachbar and the resulting .csv file is downloaded to my computer. I am now trying to implement this in matlab using the following:
url='https://finance.yahoo.com/d/quotes.csv?s=GOOG&f=og&ignore=.csv';[temp status]=urlread(strcat(url))if status data = textscan(temp, '%f%f', 'delimiter', ',','Headerlines', 0)elseend
In theory, this should return data with the requested information (in this case, the open price (o) and days low (g)). When running the program I get the following from temp.
<HTML><HEAD><TITLE>Document Has Moved</TITLE></HEAD><BODY BGCOLOR="white" FGCOLOR="black"><H1>Document Has Moved</H1><HR><FONT FACE="Helvetica,Arial"><B>Description: The document you requested has moved to a new location. The new location is "http://download.finance.yahoo.com/d/quotes.csv?s=GOOG&f=sog&ignore=.csv".</B></FONT><HR></BODY>
Although it says there is a new location for the document, I can still use the old URL to download directly by copying and pasting it into the seachbar.
Additionally, when downloaded that hard way, I can save the data and read it as normal. For instance, after downloading the .csv by copying and pasting the URL into my seachbar, the following code works to extract the data to matlab.
goog=fopen('GOOG.csv');data = textscan(goog, '%f%f', 'delimiter', ',','Headerlines', 0)
Any help as to why matlab will not let me access the data would be tremendously helpful.
Thanks, Carmelo
Best Answer