如果您有,可将其用于从雅虎下载历史金融数据。
Here is an example using only three tickers, but could be easily changed to read the values from file and applied to all 500 tickers you have:
endDate = date; %# today
startDate = datestr(addtodate(datenum(endDate),-1, year )); %# last year
tickers = { GOOG IBM AAPL };
headers = { Date Open High Low Close Volume Adj Close };
y = yahoo;
for i=1:numel(tickers)
%# fetch daily data
data = fetch(y, tickers{i}, startDate, endDate, d );
%# format dates, and add header row
A = [headers; cellstr(datestr(data(:,1))) num2cell(data(:,2:end))];
%# write to XLS file
xlswrite([tickers{i} .xls ], A);
end
close(y);
您获得的数据实例:
>> A
A =
Date Open High Low Close Volume Adj Close
21-Nov-2011 [ 370.4] [371.68] [365.91] [369.01] [15999300] [ 369.01]
18-Nov-2011 [378.92] [379.99] [374.88] [374.94] [13283500] [ 374.94]
17-Nov-2011 [383.98] [384.58] [ 375.5] [377.41] [17139300] [ 377.41]
16-Nov-2011 [389.25] [391.14] [384.32] [384.77] [12449900] [ 384.77]
15-Nov-2011 [ 380.8] [ 389.5] [379.45] [388.83] [15386100] [ 388.83]
...