Code covered by the BSD License  

Highlights from
Frontier Demo

Frontier Demo

by

 

Retrieve stock data from Yahoo and draw the rolling frontier 3D graph

matproj.m
%define the range of data will be used
b='jun 1 2001';
e='dec 4 2009';
% l=['XOM';'CVX';'COP'];
l=['a';'b';'c';'d';'f';'k';'l';'m';'o';'q';'r';'s';'t';'x';'y'];
%get data from yahoo and make data suit for frontier()
t=(datenum(b):datenum(e))';
d=cell(size(l,1),1);
p=zeros(datenum(e)-datenum(b)+1,size(l,1));
r=zeros(datenum(e)-datenum(b),size(l,1));
for i=1:size(l,1)
    d{i}=fetch(yahoo,l(i),'close',b,e);
    p(:,i)=interp1(d{i}(:,1),d{i}(:,2),t);
    r(:,i)=diff(p(:,i))./p(1:end-1,i);
end
%show the rolling frontier
frontier([t(2:end) r],ceil((datenum(e)-datenum(b))/100),1,size(l,1));

Contact us