A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/eddelbuettel/rquantlib/commit/9c05688452bd54e9331590b8cc8536c91ad3eae2 below:

update for QuantLib 1.23 deprecations · eddelbuettel/rquantlib@9c05688 · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+42

-14

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+42

-14

lines changed Original file line number Diff line number Diff line change

@@ -1,3 +1,18 @@

1 +

2021-08-26 Dirk Eddelbuettel <edd@debian.org>

2 + 3 +

* src/bonds.cpp (fittedBondCurveEngine): Use Actual365Fixed() instead

4 +

of deprecated ActualActual()

5 +

* src/discount.cpp (discountCurveEngine): Idem

6 +

* src/utils.cpp (rebuildCurveFromZeroRates): Idem

7 +

* src/zero.cpp (zbtyield): Idem

8 + 9 +

* src/utils.cpp (buildTermStructure): Switch to

10 +

ActualActual::Convention::ISDA in ctor following

11 +

(getDayCounter): Condition away ActualActual() and Thirty360()

12 + 13 +

* man/BondUtilities.Rd: Document that ActualActual() and Thirty360()

14 +

can be enabled locally via #define

15 + 1 16

2021-08-17 Dirk Eddelbuettel <edd@debian.org>

2 17 3 18

* man/Enum.Rd: Correct eleven-year old typo

Original file line number Diff line number Diff line change

@@ -1,4 +1,3 @@

1 -

% $Id$

2 1

\name{BondUtilities}

3 2

\alias{matchBDC}

4 3

\alias{matchCompounding}

@@ -16,7 +15,7 @@ possible values---the user is not expected to call these functions directly..}

16 15

matchBDC(bdc = c("Following", "ModifiedFollowing", "Preceding",

17 16

"ModifiedPreceding", "Unadjusted",

18 17

"HalfMonthModifiedFollowing", "Nearest"))

19 -

matchCompounding(cp = c("Simple", "Compounded", "Continuous", "SimpleThenCompounded"))

18 +

matchCompounding(cp = c("Simple", "Compounded", "Continuous", "SimpleThenCompounded"))

20 19

matchDayCounter(daycounter = c("Actual360", "ActualFixed", "ActualActual", "Business252",

21 20

"OneDayCounter", "SimpleDayCounter", "Thirty360",

22 21

"Actual365NoLeap", "ActualActual.ISMA", "ActualActual.Bond",

@@ -28,7 +27,7 @@ matchFrequency(freq = c("NoFrequency","Once", "Annual", "Semiannual",

28 27

"EveryFourthMonth", "Quarterly", "Bimonthly",

29 28

"Monthly", "EveryFourthWeek", "Biweekly",

30 29

"Weekly", "Daily"))

31 -

matchParams(params)

30 +

matchParams(params)

32 31

}

33 32

\arguments{

34 33

\item{bdc}{A string identifying one of the possible business day convention values.}

@@ -49,6 +48,12 @@ matchParams(params)

49 48

Note that \code{Actual365NoLeap} is deprecated as of QuantLib 1.11 and

50 49

no longer supported by default. It can be reinstated by defining

51 50

\code{RQUANTLIB_USE_ACTUAL365NOLEAP}.

51 + 52 +

Also note that \code{ActualActual} and \code{Thirty360} are deprecated as

53 +

of QuantLib 1.23 and no longer supported by default. They can be reinstated

54 +

by defining, respectively, \code{RQUANTLIB_USE_ACTUALACTUAL} and

55 +

\code{RQUANTLIB_USE_THIRTY360}.

56 + 52 57

}

53 58

\references{\url{http://quantlib.org} for details on \code{QuantLib}.}

54 59

\author{Khanh Nguyen \email{knguyen@cs.umb.edu} for the \R interface;

@@ -57,4 +62,3 @@ matchParams(params)

57 62

stabilises its own API.}

58 63

%\examples{}

59 64

\keyword{misc}

60 - Original file line number Diff line number Diff line change

@@ -8,6 +8,11 @@

8 8 9 9

using namespace Rcpp;

10 10 11 +

#ifdef RCPP_USE_GLOBAL_ROSTREAM

12 +

Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();

13 +

Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();

14 +

#endif

15 + 11 16

// affineWithRebuiltCurveEngine

12 17

Rcpp::List affineWithRebuiltCurveEngine(Rcpp::List rparam, Rcpp::List legparams, std::vector<QuantLib::Date> dateVec, std::vector<double> zeroVec, Rcpp::NumericVector swaptionMat, Rcpp::NumericVector swapLengths, Rcpp::NumericVector swaptionVols);

13 18

RcppExport SEXP _RQuantLib_affineWithRebuiltCurveEngine(SEXP rparamSEXP, SEXP legparamsSEXP, SEXP dateVecSEXP, SEXP zeroVecSEXP, SEXP swaptionMatSEXP, SEXP swapLengthsSEXP, SEXP swaptionVolsSEXP) {

Original file line number Diff line number Diff line change

@@ -1,7 +1,7 @@

1 1 2 2

// RQuantLib -- R interface to the QuantLib libraries

3 3

//

4 -

// Copyright (C) 2002 - 2019 Dirk Eddelbuettel

4 +

// Copyright (C) 2002 - 2021 Dirk Eddelbuettel

5 5

// Copyright (C) 2009 - 2012 Khanh Nguyen and Dirk Eddelbuettel

6 6

//

7 7

// This file is part of RQuantLib.

@@ -1101,7 +1101,7 @@ Rcpp::List fittedBondCurveEngine(Rcpp::List curveparam,

1101 1101

for (int i = 0; i < n; i++) {

1102 1102

QuantLib::Date d = current;

1103 1103

dates[i] = Rcpp::Date(d.month(), d.dayOfMonth(), d.year());

1104 -

zr[i] = curve->zeroRate(current, QuantLib::ActualActual(), QuantLib::Continuous);

1104 +

zr[i] = curve->zeroRate(current, QuantLib::Actual365Fixed(), QuantLib::Continuous);

1105 1105

di[i] = curve->discount(current);

1106 1106

current++;

1107 1107

}

Original file line number Diff line number Diff line change

@@ -2,7 +2,7 @@

2 2

// RQuantLib function DiscountCurve

3 3

//

4 4

// Copyright (C) 2005 - 2007 Dominick Samperi

5 -

// Copyright (C) 2007 - 2019 Dirk Eddelbuettel

5 +

// Copyright (C) 2007 - 2021 Dirk Eddelbuettel

6 6

// Copyright (C) 2009 - 2011 Dirk Eddelbuettel and Khanh Nguyen

7 7

//

8 8

// This file is part of RQuantLib.

@@ -67,7 +67,7 @@ Rcpp::List discountCurveEngine(Rcpp::List rparams,

67 67

// Handle<Quote>(flatRate),

68 68

// ActualActual()));

69 69

QuantLib::ext::shared_ptr<QuantLib::SimpleQuote> rRate(new QuantLib::SimpleQuote(rateQuote));

70 -

curve = flatRate(settlementDate,rRate,QuantLib::ActualActual());

70 +

curve = flatRate(settlementDate,rRate,QuantLib::Actual365Fixed());

71 71 72 72

} else { // Build curve based on a set of observed rates and/or prices.

73 73

std::vector<QuantLib::ext::shared_ptr<QuantLib::RateHelper> > curveInput;

@@ -114,7 +114,7 @@ Rcpp::List discountCurveEngine(Rcpp::List rparams,

114 114

QuantLib::Date d = current;

115 115

QuantLib::Date maxDate(31, QuantLib::December, 2150);

116 116

while (d < curve->maxDate() && d < maxDate) { // TODO set a max of, say, 5 or 10 years for flat curve

117 -

double z = curve->zeroRate(d, QuantLib::ActualActual(), QuantLib::Continuous);

117 +

double z = curve->zeroRate(d, QuantLib::Actual365Fixed(), QuantLib::Continuous);

118 118

dates.push_back(d);

119 119

zeroRates.push_back(z);

120 120

d = advanceDate(d, 21); // TODO: make the increment a parameter

Original file line number Diff line number Diff line change

@@ -1,7 +1,7 @@

1 1 2 2

// RQuantLib -- R interface to the QuantLib libraries

3 3

//

4 -

// Copyright (C) 2002 - 2020 Dirk Eddelbuettel

4 +

// Copyright (C) 2002 - 2021 Dirk Eddelbuettel

5 5

// Copyright (C) 2005 - 2006 Dominick Samperi

6 6

// Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Khanh Nguyen

7 7

//

@@ -128,7 +128,7 @@ QuantLib::ext::shared_ptr<QuantLib::YieldTermStructure> buildTermStructure(Rcpp:

128 128

//Integer fixingDays = RQLContext::instance().fixingDays;

129 129 130 130

// Any DayCounter would be fine; ActualActual::ISDA ensures that 30 years is 30.0

131 -

QuantLib::DayCounter termStructureDayCounter = QuantLib::ActualActual(QuantLib::ActualActual::ISDA);

131 +

QuantLib::DayCounter termStructureDayCounter = QuantLib::ActualActual(QuantLib::ActualActual::Convention::ISDA);

132 132

double tolerance = 1.0e-15;

133 133 134 134

if (firstQuoteName.compare("flat") == 0) { // Create a flat term structure.

@@ -269,7 +269,7 @@ rebuildCurveFromZeroRates(std::vector<QuantLib::Date> dates,

269 269

QuantLib::ext::shared_ptr<QuantLib::YieldTermStructure>

270 270

rebuilt_curve(new QuantLib::InterpolatedZeroCurve<QuantLib::LogLinear>(dates,

271 271

zeros,

272 -

QuantLib::ActualActual()));

272 +

QuantLib::Actual365Fixed()));

273 273

return rebuilt_curve;

274 274

}

275 275

@@ -367,16 +367,20 @@ QuantLib::DayCounter getDayCounter(const double n){

367 367

return QuantLib::Actual360();

368 368

else if (n==1)

369 369

return QuantLib::Actual365Fixed();

370 +

#ifdef RQUANTLIB_USE_ACTUALACTUAL

370 371

else if (n==2)

371 372

return QuantLib::ActualActual();

373 +

#endif

372 374

else if (n==3)

373 375

return QuantLib::Business252();

374 376

else if (n==4)

375 377

return QuantLib::OneDayCounter();

376 378

else if (n==5)

377 379

return QuantLib::SimpleDayCounter();

380 +

#ifdef RQUANTLIB_USE_THIRTY360

378 381

else if (n==6)

379 382

return QuantLib::Thirty360();

383 +

#endif

380 384

#ifdef RQUANTLIB_USE_ACTUAL365NOLEAP

381 385

else if (n==7)

382 386

return QuantLib::Actual365NoLeap();

Original file line number Diff line number Diff line change

@@ -2,7 +2,7 @@

2 2

// RQuantLib -- R interface to the QuantLib libraries

3 3

//

4 4

// Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Khanh Nguyen

5 -

// Copyright (C) 2013 - 2019 Dirk Eddelbuettel

5 +

// Copyright (C) 2013 - 2021 Dirk Eddelbuettel

6 6

//

7 7

// RQuantLib is free software: you can redistribute it and/or modify

8 8

// it under the terms of the GNU General Public License as published by

@@ -143,7 +143,7 @@ Rcpp::DataFrame zbtyield(std::vector<QuantLib::Date> MatDates,

143 143

for (unsigned int i = 0; i<numberOfBonds;i++){

144 144

QuantLib::Date d = MatDates[i];

145 145

dates[i] = Rcpp::Date(d.month(), d.dayOfMonth(), d.year());

146 -

zeros[i] = curve->zeroRate(d, QuantLib::ActualActual(), QuantLib::Simple);

146 +

zeros[i] = curve->zeroRate(d, QuantLib::Actual365Fixed(), QuantLib::Simple);

147 147

current++; // ?

148 148

}

149 149

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4