% Bitcoin
clear
Data = xlsread('BITCOINprice.xlsx');
%  Monthly Prices from coindesk.com
%  Weekly averages, M-Sunday, from last M in month
%  12/26/10 - 2/16/18 (87 observations)
%  Mo - day - yr - price - wks
%  wks = 4 or 5, depending on number of wks in preceding mo.
s = size(Data)            % 54 5 
T = s(1)
P = Data(:,4)';
Time = (0:T-1)/12 + 2011;
figure
plot(Time, P)
title ('Bitcoin Price')
ylabel('$ / Bitcoin')
grid on
figure 
semilogy(Time, P)
title ('Bitcoin Price')
ylabel('$ / Bitcoin')
grid on
R = 100*log(P(2:T)./P(1:T-1));
Time = Time(2:T);
figure
plot(Time, R)
title('Bitcoin Returns')
ylabel('Percent per month (100 \Delta log P)')
grid on
meanR = mean(R)

N = 10000
plots = 1;
if N < 51
  plots = 2;
end % if N
dbeta = .01;
seed = 1;

[xF, pF, alpha, betaeps, ceps, ceta, sigalpha, logl, pci, ci, ESS] = ...
      SearchBeta(R,  N, dbeta, plots, seed); 

