Quote from tdev:
Feel free contact me for a free estimation.
Alex.
There are a few easy ways to get the data from yahoo finance directly.
The following is the example for matlab code as your reference:
-----------
3. The matlab code:
%download stock data
nyseExcelName = 'NYSE.csv';
nasdaqExcelName = 'Nasdqa.csv';
[num, nyseText, raw]=xlsread(nyseExcelName);
[num, nasdaqText, raw]=xlsread(nyseExcelName);
nyseCompnameList = nyseText(2:end,1);
nasdaqCompnameList = nasdaqText(2:end,1);
url = '';
for i = 1:length(nyseCompnameList)
name = char(nyseCompnameList(i));
url = ['http://ichart.finance.yahoo.com/table.csv?s' name '&a=00&b=01&c=1900&d=03&e=7&f=2011&g=d&ignore=.csv']
s = regexprep(name,'/','_');
s = regexprep(s,'\','-');
fname = ['..\hdata\NYSE-' name '.csv']
downloadCVSByURL(url,fname);
end
for i = 1:length(nasdaqCompnameList)
name = char(nasdaqCompnameList(i));
url = ['http://ichart.finance.yahoo.com/table.csv?s' name '&a=00&b=01&c=1900&d=03&e=7&f=2011&g=d&ignore=.csv']
s = regexprep(name,'/','_');
s = regexprep(s,'\','-');
fname = ['..\hdata\NASDAQ-' name '.csv']
downloadCVSByURL(url,fname);
end
-----downloadCVSByURL.m
function msg = downloadCVSByURL(urlName, fileName)
try
historicalPriceFile =urlread(urlName);
if(isempty(historicalPriceFile)==true)
return;
end;
fid = fopen(fileName,'w');
fwrite(fid,historicalPriceFile);
fclose(fid);
catch err
msg = sprintf('%s', err.message)
end
--------------
The smiliar to C++ or Java code but with different API invoking.