function calendar = GetCurrencyCalendar(enddate)
c = clock;
%must add zeros if only one digit
month = c(2);
%remove the +1
day = c(3);
if month < 10
month = strcat('0',num2str(month));
end
if day < 10
day = strcat('0',num2str(day));
end
bdates = busdays(strcat(num2str(month),'-', num2str(day), '-', num2str(c(1))), enddate, 'daily')
bdates = datestr(bdates,26); %26 for required format year month day
%replace / by -
bdates(:,5) = ''
bdates(:,7) = ''
Size = size(bdates,1);
count = 0;
while count < Size
count = count +1;
[temp, status] = urlread(strcat('http://finance.yahoo.com/calendar/economic?start=', bdates(Size,:) ,'&countries=us,gb,ch,jp,ie,de,fr,eu,ca,au'));
if status
k = strfind(temp,'cellDate');
for idx=1:1:size(k,2)-1
if idx==1
calendar(idx).Date = temp(1,k+444:k+455);
calendar(idx).Time = temp(1,k+481:k+489);
calendar(idx).Country = temp(1,k+520:k+522);
endpos = strfind(temp(1,k+522:k+636),'cellFor');
begpos = strfind(temp(1,k+522:k+590),'">');
calendar(idx).Event =temp(1,k+522+begpos:k+522+endpos-22);
else
m = k(1,idx+1);
calendar(idx).Date = temp(1,m+10:m+20);
calendar(idx).Time = temp(1,m+46:m+54);
calendar(idx).Country = temp(1,m+85:m+87);
endpos = strfind(temp(1,m+87:m+200),'cellFor');
begpos = strfind(temp(1,m+87:m+150),'">');
calendar(idx).Event =temp(1,m+87+begpos:m+87+endpos-22);
end
calendar(idx).Date
calendar(idx).Time
calendar(idx).Country
calendar(idx).Event
end
end
end
end