MATLAB Answers

Pulling Financial Data Error

1 view (last 30 days)
dsmalenb on 4 Nov 2016
The script below uses the DataFeed Toolbox to pull a list of historical securities data. I would like to access the entire historical data set for particular securities. However, I am not sure how to figure out which data is the first entry. IN addition, if you try to simply pull all data from say 1900 until now in the hope of capturing that first data (for most this statement holds true), you obtain the following error message:
Error using yahoo/fetch (line 387)
Unable to return historical data for given security.
Error in RunningAlpha2 (line 25)
d1 = fetch(c,TickerNameNYSE(j),{'Open', 'Close', 'Volume'},BeginDate,
The error was with ticker TWC. I stopped the runs there. The code is listed here:
clear all;
strNYSE = 'TWC'; % I left that last one with the error.
TickerNameNYSE = strread(strNYSE,'%s');
% Find number of Tickers in 'TickerName'
S = size(TickerNameNYSE)*[1;0];
formatOut = 'mm/dd/yyyy';
BeginDate = '01/01/1950';
c = yahoo;
format short g;
cnt = 0;
for j=1:S
clearvars dLAV
d1 = fetch(c,TickerNameNYSE(j),{'Open', 'Close', 'Volume'},BeginDate, EndDate);
L = size(d1)*[1;0];
dLAV(1:L) = 0;
for k=1:L-1
dLAV(k) = log(d1(k+1,3)/d1(k,3));
I would be very thankful if anyone could provide some direction on how to mitigate this error.


Sign in to comment.

Answers (0)

Sign in to answer this question.