urlread - IP address could not be determined
5 views (last 30 days)
Show older comments
Amit Patel
on 29 Jan 2025
Commented: Amit Patel
on 30 Jan 2025
Hi team
I am using EODHD.COM for stock data. I get the following error every now and then. example - if I am iterating over say 50 stocks data, the code sometimes throw an error for 1 stock, then I rerun the full script allover again and it will work. I used webread to start with but webread doesn't even read the webpage and returns no data (urlread returns data instead).
Error using urlreadwrite_legacy (line 88)
The IP address of "eodhd.com" could not be determined.
Error in urlreadwrite (line 88)
[output,status] = urlreadwrite_legacy(fcn,catchErrors,varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in urlread (line 16)
[s,status] = urlreadwrite(mfilename,catchErrors,url,varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in NSE_all (line 78)
EOD_data = urlread(URL2); % json data
^^^^^^^^^^^^^
My codes are:
url2A = 'https://eodhd.com/api/eod/';
url2B = '?from=';
url2C = '&period=d&api_token=';
url2D = '&fmt=json';
From = datetime("today") - (365 * 20);
dt_str = char(From);
URL2 = url2A + company + url2B + dt_str + url2C + token + url2D;
EOD_data = urlread(URL2);
*please note company is a name of the stock ticker I take from the list for the For loop so I iterate through multiple companies stocks.
Is it possible to tell urlread to wait longer and try more before throwing an error? or even keep trying for the specified time? I want urlread to not stop my script at any random time. I am new to Matlab so if anyone can help it would be great.
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Web Services in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!