%municipal securities
%(asset side)
%--------------------
clear
load baa.txt -ascii         %monthly corporate bond yields BAA  Long Term Composite  (starts in Jan 19)
load taxex.txt -ascii       %monthly corporate bond yields BAA on 10 year benchmark (starts in April 53)
%this rate is constructed in interest rates2.xls
%-------------------------------------------------------------------------
%10 year yield on corporates constructed using the spread on corp added to 
%Treasury benchmark
%----------------------------------------------------------------------------



rate=baa(:,2)-1.13;     %moody's average corporate bond yield BAA  (Jan 19) in percentage points
rate_2=taxex(:,2);      %10 year Treasury yield + spread (Apr 53) in percentage points


i=325;            %(Jan/1946)
n=1;


%constructing quarterly rates prior to April 53
%---------------------------------------------
while i<=411  %(March/53)
   rateq(n)=rate(i);
i=i+3;
n=n+1;
end;
m=n

%constructing quarterly rates  starting in April 53
%-------------------------------------------------
j=1;
while j<=561 
   rateq(n)=rate_2(j);
j=j+3;
n=n+1;
end;



rateq=rateq/100;

loans_l(1)=.25*1000;
load munia.txt -ascii %code 103062003
%series starts in 52/01
%balance sheet data 
loans_a(1)=0.31;%1946
loans_a(2)=0.35;
loans_a(3)=0.45;
loans_a(4)=0.49;
loans_a(5)=0.65;
loans_a(6)=0.84;%1951


loans_q(1:4,1)=(.31/4)*1000;

loans_a=loans_a*1000;

for n=2:6
   for i=1:4
   j=(n-1)*4+i
   loans_q(j,1)=( (loans_a(n)-loans_a(n-1))/4);
  end
end


M=25+190-1;

loans_q(25:25+190,1)=munia(:,2);

for n=2:M
   loans_l(n)=loans_l(n-1)+loans_q(n);
end   

for l=1:M
   loans_int(l)=loans_l(l)*( (1+rateq(l))^(1/4)-1);
end   
loans_int=loans_int';
save int_muni.txt loans_int -ascii