%
% file:      	read_yahoo_data.m, (c) Matthew Roughan, Fri Aug 20 2004
% directory:   /home/mroughan/Classes/Transformations/2004/Matlab/
% created: 	Fri Aug 20 2004 
% author:  	Matthew Roughan 
% email:   	matthew.roughan@adelaide.edu.au
% 
% READ_YAHOO_DATA reads in the downloaded Yahoo CSV table
%    if this doesn't work, check the file exists, and
%    check the file does not have an uncommented weird last line
%

clear;
file = 'yahoo_AORDs_table_long.csv';

[date, open, high, low, close, volume, adjust] ...
    = textread(file, '%s%f%f%f%f%f%f', 'commentstyle', 'matlab',...
	       'delimiter', ',', 'headerlines', 1);

date_as_numbers = datenum(date);

figure(1)
hold off
p1 = plot(date_as_numbers, high, 'b');
hold on
p2 = plot(date_as_numbers, low, 'r');
p3 = plot(date_as_numbers, open, 'c');
p4 = plot(date_as_numbers, close, 'm');
datetick('x', 12);
legend([p1 p2 p3 p4], 'high', 'low', 'open', 'close', 4);
xlabel('date');
ylabel('Australian all ordinaries');

figure(2)
hold off
k = find(volume > 0);
plot(date_as_numbers(k), volume(k));
datetick('x', 12);
xlabel('date');
ylabel('Australian all ord volume');

