Parallel Computing Toolbox To Speed Up Multiple Webread Calls

3 vues (au cours des 30 derniers jours)
Carmelo Gonzales
Carmelo Gonzales le 27 Juil 2017
Hello All,
I am wondering if any of you have experience using the parallel computing toolbox, specifically with webread. I am currently working on a program to download, and process google finance data. Everything is going great, however the download time for aournd 300 stock stymbols is rather long. I am interested in speeding this up, and thought webread might be a good option. For example, here is a simplified version of the code I am looking to speed up.
%General set of tickers, usually 250+ in length
tickers={'AAIO','AAPL','FB','GOOGL','NVDA','TWTR'}
Length='10';
Freq='60';
for ii = 1:length(tickers)
wop=weboptions('Timeout',15);
temp=webread(strcat('https://www.google.com/finance/getprices?i=',Freq,'&p=',Length,...
'd&f=d,o,h,l,c,v&df=cpct&q=',tickers{ii},'&ignore=.csv'),wop);
data = textscan(temp, '%s%f%f%f%f%f%f', 'delimiter', ',', ...
'Headerlines', 7);
min=str2double(data{1});
min(isnan(min))=0;
op=data{2};
high=data{3};
low=data{4};
cl=data{5};
vol=data{6};
stocks(ii).ticker=tickers{ii};
stocks(ii).min=min;
stocks(ii).op=op;
stocks(ii).high=high;
stocks(ii).low=low;
stocks(ii).cl=cl;
stocks(ii).vol=vol;
end
To clarify, I do not currently own the parallel computing toolbox, I am just wondering if it may help my particular situation.

Réponse acceptée

Kojiro Saito
Kojiro Saito le 30 Juil 2017
It is not always the case that doing parallel would speed up because of the overhead time of a parallel pool, but I think Parallel Computing Toolbox will improve your webread time. For using it, you need to change from
for ii = 1:length(tickers)
to
parfor ii = 1:length(tickers)
assuming "local" cluster profile is set as a default.
You can evaluate Parallel Computing Toolbox by asking a trial from this page in order to confirm it will improve your calculation time.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by