[Rquantlib-commits] r208 - papers/rinfinance2010

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 22 22:34:43 CET 2010


Author: knguyen
Date: 2010-03-22 22:34:42 +0100 (Mon, 22 Mar 2010)
New Revision: 208

Modified:
   papers/rinfinance2010/rquantlib_slides.tex
Log:
fix font for example slides

Modified: papers/rinfinance2010/rquantlib_slides.tex
===================================================================
--- papers/rinfinance2010/rquantlib_slides.tex	2010-03-22 20:43:24 UTC (rev 207)
+++ papers/rinfinance2010/rquantlib_slides.tex	2010-03-22 21:34:42 UTC (rev 208)
@@ -1,6 +1,7 @@
 %% add 'handout' option for handouts, and pgfpages for 2-on-1
 %\documentclass[smaller,compress]{beamer}   
 \documentclass[compress]{beamer}   
+  
 %\usepackage{pgfpages}
 %\pgfpagesuselayout{2 on 1}[letterpaper,border shrink=5mm]
 %\pgfpagesuselayout{4 on 1}[letterpaper,border shrink=5mm]
@@ -305,6 +306,7 @@
 \vskip15pt
 \pagecolor{bgcolor}
 \noindent
+\scriptsize
 \ttfamily
 \hlstd{params\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{tradeDate}\hlsym{=}\hlstd{}\hlkwc{as.Date}\hlstd{}\hlsym{(}\hlstd{}\hlstr{'2004{-}09{-}20'}\hlstd{}\hlsym{),}\hspace*{\fill}\\
 \hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{settleDate}\hlsym{=}\hlstd{}\hlkwc{as.Date}\hlstd{}\hlsym{(}\hlstd{}\hlstr{'2004{-}09{-}22'}\hlstd{}\hlsym{),}\hspace*{\fill}\\
@@ -328,11 +330,12 @@
 	\framesubtitle{Examples: Curve fitting with DiscountCurve function}
 \pagecolor{bgcolor}
 \noindent
+\scriptsize
 \ttfamily
 \hlstd{}\hlkwc{plot}\hlstd{}\hlsym{(}\hlstd{curves)}
 \normalfont
 \begin{center}
-\resizebox{75mm}{!}{\includegraphics{figures/discountCurve.png}}
+\resizebox{60mm}{!}{\includegraphics{figures/discountCurve.png}}
 \end{center}
 \end{frame}
 
@@ -376,6 +379,7 @@
 \vskip5pt
 \pagecolor{bgcolor}
 \noindent
+\scriptsize
 \ttfamily
 \hlstd{lengths\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{c}\hlstd{}\hlsym{(}\hlstd{}\hlnum{2}\hlstd{}\hlsym{,}\hlstd{}\hlnum{4}\hlstd{}\hlsym{,}\hlstd{}\hlnum{6}\hlstd{}\hlsym{,}\hlstd{}\hlnum{8}\hlstd{}\hlsym{,}\hlstd{}\hlnum{10}\hlstd{}\hlsym{,}\hlstd{}\hlnum{12}\hlstd{}\hlsym{,}\hlstd{}\hlnum{14}\hlstd{}\hlsym{,}\hlstd{}\hlnum{16}\hlstd{}\hlsym{,}\hlstd{}\hlnum{18}\hlstd{}\hlsym{,}\hspace*{\fill}\\
 \hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{}\hlnum{20}\hlstd{}\hlsym{,}\hlstd{}\hlnum{22}\hlstd{}\hlsym{,}\hlstd{}\hlnum{24}\hlstd{}\hlsym{,}\hlstd{}\hlnum{26}\hlstd{}\hlsym{,}\hlstd{}\hlnum{28}\hlstd{}\hlsym{,}\hlstd{}\hlnum{30}\hlstd{}\hlsym{)}\hspace*{\fill}\\
@@ -410,7 +414,7 @@
 \hlstd{}\hlkwc{plot}\hlstd{}\hlsym{(}\hlstd{z, xlab='Date', ylab='Zero Rates')}
 \normalfont
 \begin{center}
-\resizebox{75mm}{!}{\includegraphics{figures/fittedBondCurve.png}}
+\resizebox{60mm}{!}{\includegraphics{figures/fittedBondCurve.png}}
 \end{center}
 \end{frame}
 
@@ -881,6 +885,7 @@
 \vskip5pt
 \pagecolor{bgcolor}
 \noindent
+\scriptsize
 \ttfamily
 \hlstd{fixingDays\ }\hlsym{$<${-}\ }\hlstd{}\hlnum{3}\hspace*{\fill}\\
 \hlstd{settlementDays\ }\hlsym{$<${-}\ }\hlstd{}\hlnum{3}\hspace*{\fill}\\
@@ -938,6 +943,7 @@
 	\framesubtitle{Examples: Bond pricing}
 \pagecolor{bgcolor}
 \noindent
+\scriptsize
 \ttfamily
 \hlstd{}\hlslc{\#begin\ to\ set\ up\ swap\ term\ structure}\hspace*{\fill}\\
 \hlstd{swp.tsr.params\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{tradeDate}\hlsym{=}\hlstd{todaysDate}\hlsym{,}\hspace*{\fill}\\
@@ -988,6 +994,7 @@
 	\framesubtitle{Examples: Bond pricing}	
 \pagecolor{bgcolor}
 \noindent
+\scriptsize
 \ttfamily
 \hlstd{}\hlslc{\#Zero{-}Coupon\ Bond}\hspace*{\fill}\\
 \hlstd{zc.bond.param\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hspace*{\fill}\\
@@ -1004,11 +1011,13 @@
 \mbox{}
 \normalfont
 \end{frame}
+
 \begin{frame}[fragile]
 	\frametitle{Fixed Income in RQuantLib}
 	\framesubtitle{Examples: Bond pricing}
 \pagecolor{bgcolor}
 \noindent
+\scriptsize
 \ttfamily
 \hlstd{}\hlslc{\#Fixed{-}Coupon\ Bond}\hspace*{\fill}\\
 \hlstd{fixed.bond.param\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hspace*{\fill}\\
@@ -1060,6 +1069,7 @@
 \begin{frame}[fragile]
 	\frametitle{Fixed Income in RQuantLib}
 	\framesubtitle{Examples: Convertible Bond from Matlab's Fixed Income Toolbox}	
+	\scriptsize
 Perform a spread effect analysis of a 4\%-coupon convertible bond callable at 110 at the end of the second year, maturing at par in 5 years, with yield to maturity of 5\% and spread (of YTM versus 5-year treasury) of 0, 50, 100, and 150 basis points. The underlying stock pays no dividend. 
 \lstset{language=Matlab,basicstyle=\tiny}
 	\begin{lstlisting}
@@ -1068,19 +1078,16 @@
 IssueDate    = datenum('2-Jan-2002');
 Settle       = datenum('2-Jan-2002');
 Maturity     = datenum('2-Jan-2007');
-CouponRate   = 0.04;    Period       = 2;
-Basis        = 1;		EndMonthRule = 1;
+CouponRate   = 0.04;    Period       = 2; Basis        = 1;		EndMonthRule = 1;
 DividendType = 0;		DividendInfo = [];
 CallInfo     = [datenum('2-Jan-2004'), 110]; 
 CallType     = 1;		TreeType     = 1;   
-% Nested loop accross prices and static spread dimensions
-% to compute convertible prices.
+% Nested loop accross prices and static spread dimensions to compute convertible prices.
 for j = 0:0.005:0.015;
 StaticSpread = j;
       for i = 0:10:100
           Price = 40+i;
-          [CbMatrix, UndMatrix, DebtMatrix, EqtyMatrix] =  cbprice(RiskFreeRate, StaticSpread, Sigma, Price, ConvRatio, NumSteps, IssueDate, Settle, Maturity, CouponRate, Period, Basis, EndMonthRule, DividendType, DividendInfo, CallType, CallInfo, TreeType);
-   
+          [CbMatrix, UndMatrix, DebtMatrix, EqtyMatrix] =  cbprice(RiskFreeRate, StaticSpread, Sigma, Price, ConvRatio, NumSteps, IssueDate, Settle, Maturity, CouponRate, Period, Basis, EndMonthRule, DividendType, DividendInfo, CallType, CallInfo, TreeType);   
            convprice(i/10+1,j*200+1) =  CbMatrix(1,1);
            stock(i/10+1,j*200+1)     =  Price;
         end    
@@ -1114,7 +1121,7 @@
 \begin{frame}
 Doing it in R using RQuantLib....
 \vskip5pt
-\scriptsize
+\tiny
 \pagecolor{bgcolor}
 \noindent
 \ttfamily
@@ -1125,15 +1132,13 @@
 \hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{interpHow}\hlsym{=}\hlstd{}\hlstr{"loglinear"}\hlstd{}\hlsym{)}\hspace*{\fill}\\
 \hlstd{times\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{seq}\hlstd{}\hlsym{(}\hlstd{}\hlnum{0}\hlstd{}\hlsym{,}\hlstd{}\hlnum{10}\hlstd{}\hlsym{,}\hlstd{}\hlnum{.1}\hlstd{}\hlsym{)}\hspace*{\fill}\\
 \hlstd{\hspace*{\fill}\\
-RiskFreeRate\ }\hlsym{$<${-}\ }\hlstd{DiscountCurve}\hlsym{(}\hlstd{params}\hlsym{,\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{flat}\hlsym{=}\hlstd{}\hlnum{0.05}\hlstd{}\hlsym{),}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{times}\hlsym{)}\hspace*{\fill}\\
+RiskFreeRate\ }\hlsym{$<${-}\ }\hlstd{DiscountCurve}\hlsym{(}\hlstd{params}\hlsym{,\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{flat}\hlsym{=}\hlstd{}\hlnum{0.05}\hlstd{}\hlsym{),}\hlstd{times}\hlsym{)}\hspace*{\fill}\\
 \hlstd{Sigma\ }\hlsym{$<${-}\ }\hlstd{}\hlnum{0.3}\hspace*{\fill}\\
 \hlstd{ConvRatio\ }\hlsym{$<${-}\ }\hlstd{}\hlnum{1}\hspace*{\fill}\\
 \hlstd{issueDate\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{as.Date}\hlstd{}\hlsym{(}\hlstd{}\hlstr{'2002{-}01{-}02'}\hlstd{}\hlsym{)}\hspace*{\fill}\\
 \hlstd{settleDate\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{as.Date}\hlstd{}\hlsym{(}\hlstd{}\hlstr{'2002{-}01{-}02'}\hlstd{}\hlsym{)}\hspace*{\fill}\\
 \hlstd{maturityDate\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{as.Date}\hlstd{}\hlsym{(}\hlstd{}\hlstr{'2007{-}01{-}02'}\hlstd{}\hlsym{)}\hspace*{\fill}\\
-\hlstd{dividendYield\ }\hlsym{$<${-}\ }\hlstd{DiscountCurve}\hlsym{(}\hlstd{params}\hlsym{,\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{flat}\hlsym{=}\hlstd{}\hlnum{0.01}\hlstd{}\hlsym{),}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{times}\hlsym{)}\hspace*{\fill}\\
+\hlstd{dividendYield\ }\hlsym{$<${-}\ }\hlstd{DiscountCurve}\hlsym{(}\hlstd{params}\hlsym{,\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{flat}\hlsym{=}\hlstd{}\hlnum{0.01}\hlstd{}\hlsym{),}\hlstd{times}\hlsym{)}\hspace*{\fill}\\
 \hlstd{dividendSchedule\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{data.frame}\hlstd{}\hlsym{(}\hlstd{Type}\hlsym{=}\hlstd{}\hlkwc{character}\hlstd{}\hlsym{(}\hlstd{}\hlnum{0}\hlstd{}\hlsym{),}\hspace*{\fill}\\
 \hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{Amount}\hlsym{=}\hlstd{}\hlkwc{numeric}\hlstd{}\hlsym{(}\hlstd{}\hlnum{0}\hlstd{}\hlsym{),}\hspace*{\fill}\\
 \hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{Rate}\hlsym{=}\hlstd{}\hlkwc{numeric}\hlstd{}\hlsym{(}\hlstd{}\hlnum{0}\hlstd{}\hlsym{),}\hspace*{\fill}\\
@@ -1154,10 +1159,12 @@
 \mbox{}
 \normalfont
 \end{frame}
+
 \begin{frame}
 \scriptsize
 \pagecolor{bgcolor}
 \noindent
+\tiny
 \ttfamily
 \hlstd{\hspace*{\fill}\\
 dateparams\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{settlementDays}\hlsym{=}\hlstd{}\hlnum{3}\hlstd{}\hlsym{,}\hspace*{\fill}\\
@@ -1207,7 +1214,7 @@
 \hlstd{}\hlsym{+\ }\hlstd{opts}\hlsym{(}\hlstd{}\hlkwc{title}\hlstd{}\hlsym{=}\hlstd{}\hlstr{'Effect\ of\ spread\ on\ a\ convertible\ bond'}
 \normalfont
 \begin{center}
-\resizebox{75mm}{!}{\includegraphics{figures/matlab_cbond.png}}
+\resizebox{60mm}{!}{\includegraphics{figures/matlab_cbond.png}}
 \end{center}
 \end{frame}
 



More information about the Rquantlib-commits mailing list