[Rquantlib-commits] r184 - papers/rinfinance2010 pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 8 17:59:18 CET 2010


Author: knguyen
Date: 2010-03-08 17:59:17 +0100 (Mon, 08 Mar 2010)
New Revision: 184

Removed:
   papers/rinfinance2010/discountEx.r
   papers/rinfinance2010/discountEx.r.dvi
   papers/rinfinance2010/discountEx.r.tex
   papers/rinfinance2010/fittedBondCurveEx.r
   papers/rinfinance2010/fittedBondCurveEx.r.dvi
   papers/rinfinance2010/fittedBondCurveEx.r.tex
Modified:
   pkg/src/bonds.cpp
Log:
remove unwanted dvi and tex

Deleted: papers/rinfinance2010/discountEx.r
===================================================================
--- papers/rinfinance2010/discountEx.r	2010-03-08 13:54:45 UTC (rev 183)
+++ papers/rinfinance2010/discountEx.r	2010-03-08 16:59:17 UTC (rev 184)
@@ -1,13 +0,0 @@
-params <- list(tradeDate=as.Date('2004-09-20'),
-               settleDate=as.Date('2004-09-22'),
-               interpWhat="discount",
-               interpHow="loglinear")
-tsQuotes <- list(d1w=0.0382, d1m=0.0372,
-                 d3m=0.0363, d6m=0.0353,
-                 d9m=0.0348, d1y=0.0345,
-                 fut2=96.7875, fut3=96.9875,
-                 fut4=96.6875, fut5=96.4875,
-                 fut7=96.2875, s2y=0.037125,
-                 s3y=0.0398, s5y=0.0443,
-                 s10y=0.05165, s15y=0.055175)
-curves <- DiscountCurve(params, tsQuotes)

Deleted: papers/rinfinance2010/discountEx.r.dvi
===================================================================
(Binary files differ)

Deleted: papers/rinfinance2010/discountEx.r.tex
===================================================================
--- papers/rinfinance2010/discountEx.r.tex	2010-03-08 13:54:45 UTC (rev 183)
+++ papers/rinfinance2010/discountEx.r.tex	2010-03-08 16:59:17 UTC (rev 184)
@@ -1,29 +0,0 @@
-\documentclass{article}
-\usepackage{color}
-\usepackage{alltt}
-\usepackage[latin1]{inputenc}
-
-\input {highlight.sty}
-
-\title{discountEx.r}
-\begin{document}
-\pagecolor{bgcolor}
-\noindent
-\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}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{interpWhat}\hlsym{=}\hlstd{}\hlstr{"discount"}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{interpHow}\hlsym{=}\hlstd{}\hlstr{"loglinear"}\hlstd{}\hlsym{)}\hspace*{\fill}\\
-\hlstd{tsQuotes\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{d1w}\hlsym{=}\hlstd{}\hlnum{0.0382}\hlstd{}\hlsym{,\ }\hlstd{d1m}\hlsym{=}\hlstd{}\hlnum{0.0372}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{d3m}\hlsym{=}\hlstd{}\hlnum{0.0363}\hlstd{}\hlsym{,\ }\hlstd{d6m}\hlsym{=}\hlstd{}\hlnum{0.0353}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{d9m}\hlsym{=}\hlstd{}\hlnum{0.0348}\hlstd{}\hlsym{,\ }\hlstd{d1y}\hlsym{=}\hlstd{}\hlnum{0.0345}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{fut2}\hlsym{=}\hlstd{}\hlnum{96.7875}\hlstd{}\hlsym{,\ }\hlstd{fut3}\hlsym{=}\hlstd{}\hlnum{96.9875}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{fut4}\hlsym{=}\hlstd{}\hlnum{96.6875}\hlstd{}\hlsym{,\ }\hlstd{fut5}\hlsym{=}\hlstd{}\hlnum{96.4875}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{fut7}\hlsym{=}\hlstd{}\hlnum{96.2875}\hlstd{}\hlsym{,\ }\hlstd{s2y}\hlsym{=}\hlstd{}\hlnum{0.037125}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{s3y}\hlsym{=}\hlstd{}\hlnum{0.0398}\hlstd{}\hlsym{,\ }\hlstd{s5y}\hlsym{=}\hlstd{}\hlnum{0.0443}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{s10y}\hlsym{=}\hlstd{}\hlnum{0.05165}\hlstd{}\hlsym{,\ }\hlstd{s15y}\hlsym{=}\hlstd{}\hlnum{0.055175}\hlstd{}\hlsym{)}\hspace*{\fill}\\
-\hlstd{curves\ }\hlsym{$<${-}\ }\hlstd{DiscountCurve}\hlsym{(}\hlstd{params}\hlsym{,\ }\hlstd{tsQuotes}\hlsym{)}\hlstd{}\hspace*{\fill}\\
-\mbox{}
-\normalfont
-\end {document}
-(* LaTeX generated by highlight 2.10, http://www.andre-simon.de/ *)

Deleted: papers/rinfinance2010/fittedBondCurveEx.r
===================================================================
--- papers/rinfinance2010/fittedBondCurveEx.r	2010-03-08 13:54:45 UTC (rev 183)
+++ papers/rinfinance2010/fittedBondCurveEx.r	2010-03-08 16:59:17 UTC (rev 184)
@@ -1,19 +0,0 @@
-lengths <- c(2,4,6,8,10,12,14,16,18,
-             20,22,24,26,28,30)
-coupons <- c(0.0200, 0.0225, 0.0250, 0.0275,
-             0.0300, 0.0325, 0.0350, 0.0375,
-             0.0400, 0.0425, 0.0450, 0.0475,
-             0.0500, 0.0525, 0.0550 )
-marketQuotes <- rep(100, length(lengths))
-dateparams <- list(settlementDays=0,
-                   period="Annual",
-                   dayCounter="ActualActual",
-                   businessDayConvention="Unadjusted")
-curveparams <- list(method="ExponentialSplinesFitting",
-                    origDate = Sys.Date())
-curve <- FittedBondCurve(curveparams, lengths,
-                         coupons, marketQuotes,
-                         dateparams)
-library(zoo)
-z <- zoo(curve$table$zeroRates, order.by=curve$table$date)
-plot(z)

Deleted: papers/rinfinance2010/fittedBondCurveEx.r.dvi
===================================================================
(Binary files differ)

Deleted: papers/rinfinance2010/fittedBondCurveEx.r.tex
===================================================================
--- papers/rinfinance2010/fittedBondCurveEx.r.tex	2010-03-08 13:54:45 UTC (rev 183)
+++ papers/rinfinance2010/fittedBondCurveEx.r.tex	2010-03-08 16:59:17 UTC (rev 184)
@@ -1,35 +0,0 @@
-\documentclass{article}
-\usepackage{color}
-\usepackage{alltt}
-\usepackage[latin1]{inputenc}
-
-\input {highlight.sty}
-
-\title{fittedBondCurveEx.r}
-\begin{document}
-\pagecolor{bgcolor}
-\noindent
-\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}\\
-\hlstd{coupons\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{c}\hlstd{}\hlsym{(}\hlstd{}\hlnum{0.0200}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0225}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0250}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0275}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{}\hlnum{0.0300}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0325}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0350}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0375}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{}\hlnum{0.0400}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0425}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0450}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0475}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{}\hlnum{0.0500}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0525}\hlstd{}\hlsym{,\ }\hlstd{}\hlnum{0.0550\ }\hlstd{}\hlsym{)}\hspace*{\fill}\\
-\hlstd{marketQuotes\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{rep}\hlstd{}\hlsym{(}\hlstd{}\hlnum{100}\hlstd{}\hlsym{,\ }\hlstd{}\hlkwc{length}\hlstd{}\hlsym{(}\hlstd{lengths}\hlsym{))}\hspace*{\fill}\\
-\hlstd{dateparams\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{settlementDays}\hlsym{=}\hlstd{}\hlnum{0}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{period}\hlsym{=}\hlstd{}\hlstr{"Annual"}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{dayCounter}\hlsym{=}\hlstd{}\hlstr{"ActualActual"}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{businessDayConvention}\hlsym{=}\hlstd{}\hlstr{"Unadjusted"}\hlstd{}\hlsym{)}\hspace*{\fill}\\
-\hlstd{curveparams\ }\hlsym{$<${-}\ }\hlstd{}\hlkwc{list}\hlstd{}\hlsym{(}\hlstd{method}\hlsym{=}\hlstd{}\hlstr{"ExponentialSplinesFitting"}\hlstd{}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{origDate\ }\hlsym{=\ }\hlstd{}\hlkwc{Sys.Date}\hlstd{}\hlsym{())}\hspace*{\fill}\\
-\hlstd{}\hlkwc{curve\ }\hlstd{}\hlsym{$<${-}\ }\hlstd{FittedBondCurve}\hlsym{(}\hlstd{curveparams}\hlsym{,\ }\hlstd{lengths}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{coupons}\hlsym{,\ }\hlstd{marketQuotes}\hlsym{,}\hspace*{\fill}\\
-\hlstd{}\hlstd{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\hlstd{dateparams}\hlsym{)}\hspace*{\fill}\\
-\hlstd{}\hlkwc{library}\hlstd{}\hlsym{(}\hlstd{zoo}\hlsym{)}\hspace*{\fill}\\
-\hlstd{z\ }\hlsym{$<${-}\ }\hlstd{zoo}\hlsym{(}\hlstd{}\hlkwc{curve}\hlstd{\$}\hlkwc{table}\hlstd{\$zeroRates}\hlsym{,\ }\hlstd{order.by}\hlsym{=}\hlstd{}\hlkwc{curve}\hlstd{\$}\hlkwc{table}\hlstd{\$}\hlkwc{date}\hlstd{}\hlsym{)}\hspace*{\fill}\\
-\hlstd{}\hlkwc{plot}\hlstd{}\hlsym{(}\hlstd{z}\hlsym{)}\hlstd{}\hspace*{\fill}\\
-\mbox{}
-\normalfont
-\end {document}
-(* LaTeX generated by highlight 2.10, http://www.andre-simon.de/ *)

Modified: pkg/src/bonds.cpp
===================================================================
--- pkg/src/bonds.cpp	2010-03-08 13:54:45 UTC (rev 183)
+++ pkg/src/bonds.cpp	2010-03-08 16:59:17 UTC (rev 184)
@@ -1084,7 +1084,7 @@
         double businessDayConvention = misc.getDoubleValue("businessDayConvention");
        
         QuantLib::Date todayDate(dateFromR(iDate));
-        
+	Settings::instance().evaluationDate() = todayDate;
         Calendar calendar = UnitedStates(UnitedStates::GovernmentBond);
         if (cal == "us"){
             calendar = UnitedStates(UnitedStates::GovernmentBond);
@@ -1100,7 +1100,6 @@
 
         RelinkableHandle<Quote> underlying;
         RelinkableHandle<BlackVolTermStructure> volatility;
-        boost::shared_ptr<BlackScholesMertonProcess> blackProcess;
 
         Handle<YieldTermStructure> dividendYield(rebuildCurveFromZeroRates(
                                                                            dividendYieldDateSexp,
@@ -1116,10 +1115,16 @@
         boost::shared_ptr<SimpleQuote> vol(new SimpleQuote( volatilityQuote ));
         volatility.linkTo(flatVol(todayDate, vol, dc));
 
+	boost::shared_ptr<BlackScholesMertonProcess> blackProcess;
         blackProcess = boost::shared_ptr<BlackScholesMertonProcess>(
-                    new BlackScholesMertonProcess(underlying, dividendYield,
-                                                  rff, volatility));
+								    new BlackScholesMertonProcess(underlying, dividendYield,
+												  rff, volatility));
+	//	boost::shared_ptr<BlackScholesProcess> blackProcess;
+        //ackProcess = boost::shared_ptr<BlackScholesProcess>(
+	//					      new BlackScholesProcess(underlying, 
+	//								      rff, volatility));
 
+
         RelinkableHandle<Quote> creditSpread;
         creditSpread.linkTo(
                             boost::shared_ptr<Quote>(new SimpleQuote(creditSpreadQuote)));



More information about the Rquantlib-commits mailing list