Tag Archives: stocks.

From the stock exchange straight to MATLAB

Many creative and interested MATLAB files are posted on MATLAB Central. This week, I knew one extremely useful for those who use MATLAB to handle mathematical models for analizing stock quotes behavior and forecasting: Historical Stock Data downloader posted by Josiah Renfree. It makes possible to download stock data from Yahoo! Finance website straight to MATLAB workspace by a simple command line.

For example:

stock = hist_stock_data(‘01012007’, ‘08022008’, ‘PBR’);

Returns date, open, high, low, close, volume, and adjusted close price adjusted for dividends and splits of Petrobras ticker on NYSE between the dates given.

It’s also possible to retrieve multiple ticker information at once, and even to read a file with a list of symbols desired. Yahoo! Finance provides data from other Stock Exchanges than NYSE: NASDAQ, Bovespa, London Stock Exchange and others.

To make my own analysis – before using it – I used to go to financial websites, copy the historical data, paste in a spreadsheet and only than export to MATLAB variables. Because of this hard work, the mathematical models were only fed by a few selected tickers. But now, I can scan the whole spectrum of stocks and select the best ones based on my criteria. It really makes the analysis much easier and more comprehensive.