Deprecated example in Bonds.cpp

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Deprecated example in Bonds.cpp

Dirk Eddelbuettel

RQuantLib has a bonds.cpp example which is pretty much a transcription of
Bonds.cpp example in QL itself.  When I build this now, I get a lot of line
noise about the deprecated FixedRateBondHelper:

bonds.cpp: In function ‘SEXPREC* FittedBondCurve(SEXP, SEXP, SEXP, SEXP, SEXP)’:
bonds.cpp:1242:88: warning: ‘QuantLib::FittedBondDiscountCurve::FittedBondDiscountCurve(QuantLib::Natural, const QuantLib::Calendar&, const std::vector<boost::shared_ptr<QuantLib::FixedRateBondHelper> >&, const QuantLib::DayCounter&, const QuantLib::FittedBondDiscountCurve::FittingMethod&, QuantLib::Real, QuantLib::Size, const QuantLib::Array&, QuantLib::Real)’ is deprecated (declared at /usr/include/ql/termstructures/yield/fittedbonddiscountcurve.hpp:115) [-Wdeprecated-declarations]
                                                  dc, exponentialSplines, tolerance, max));
                                                                                        ^
bonds.cpp:1251:92: warning: ‘QuantLib::FittedBondDiscountCurve::FittedBondDiscountCurve(QuantLib::Natural, const QuantLib::Calendar&, const std::vector<boost::shared_ptr<QuantLib::FixedRateBondHelper> >&, const QuantLib::DayCounter&, const QuantLib::FittedBondDiscountCurve::FittingMethod&, QuantLib::Real, QuantLib::Size, const QuantLib::Array&, QuantLib::Real)’ is deprecated (declared at /usr/include/ql/termstructures/yield/fittedbonddiscountcurve.hpp:115) [-Wdeprecated-declarations]
                                                            simplePolynomial, tolerance, max));
                                                                                            ^  
bonds.cpp:1259:88: warning: ‘QuantLib::FittedBondDiscountCurve::FittedBondDiscountCurve(QuantLib::Natural, const QuantLib::Calendar&, const std::vector<boost::shared_ptr<QuantLib::FixedRateBondHelper> >&, const QuantLib::DayCounter&, const QuantLib::FittedBondDiscountCurve::FittingMethod&, QuantLib::Real, QuantLib::Size, const QuantLib::Array&, QuantLib::Real)’ is deprecated (declared at /usr/include/ql/termstructures/yield/fittedbonddiscountcurve.hpp:115) [-Wdeprecated-declarations]
                                                            nelsonSiegel, tolerance, max));  
                                                                                        ^

I poked around a little and must admit that I didn't immediately see how to
fix that.  

Could someone wave the cluebat my way? I'd be happy to fix Bonds.cpp along
with what I need to update in RQuantLib.

Thanks!

Dirk

--
Dirk Eddelbuettel | [hidden email] | http://dirk.eddelbuettel.com

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Deprecated example in Bonds.cpp

Luigi Ballabio
Hi Dirk,
    it's not FixedRateBondHelper that is deprecated; it's just that
particular constructor of FittedBondDiscountCurve, which takes a
vector<shared_ptr<FixedRateBondHelper>> and now is superseded by the
one that takes a more general vector<shared_ptr<BondHelper>>.
You should be able to fix your code simply by changing the type of the
vector you're passing.

Luigi


On Mon, Mar 17, 2014 at 12:24 AM, Dirk Eddelbuettel <[hidden email]> wrote:

>
> RQuantLib has a bonds.cpp example which is pretty much a transcription of
> Bonds.cpp example in QL itself.  When I build this now, I get a lot of line
> noise about the deprecated FixedRateBondHelper:
>
> bonds.cpp: In function 'SEXPREC* FittedBondCurve(SEXP, SEXP, SEXP, SEXP, SEXP)':
> bonds.cpp:1242:88: warning: 'QuantLib::FittedBondDiscountCurve::FittedBondDiscountCurve(QuantLib::Natural, const QuantLib::Calendar&, const std::vector<boost::shared_ptr<QuantLib::FixedRateBondHelper> >&, const QuantLib::DayCounter&, const QuantLib::FittedBondDiscountCurve::FittingMethod&, QuantLib::Real, QuantLib::Size, const QuantLib::Array&, QuantLib::Real)' is deprecated (declared at /usr/include/ql/termstructures/yield/fittedbonddiscountcurve.hpp:115) [-Wdeprecated-declarations]
>                                                   dc, exponentialSplines, tolerance, max));
>                                                                                         ^
> bonds.cpp:1251:92: warning: 'QuantLib::FittedBondDiscountCurve::FittedBondDiscountCurve(QuantLib::Natural, const QuantLib::Calendar&, const std::vector<boost::shared_ptr<QuantLib::FixedRateBondHelper> >&, const QuantLib::DayCounter&, const QuantLib::FittedBondDiscountCurve::FittingMethod&, QuantLib::Real, QuantLib::Size, const QuantLib::Array&, QuantLib::Real)' is deprecated (declared at /usr/include/ql/termstructures/yield/fittedbonddiscountcurve.hpp:115) [-Wdeprecated-declarations]
>                                                             simplePolynomial, tolerance, max));
>                                                                                             ^
> bonds.cpp:1259:88: warning: 'QuantLib::FittedBondDiscountCurve::FittedBondDiscountCurve(QuantLib::Natural, const QuantLib::Calendar&, const std::vector<boost::shared_ptr<QuantLib::FixedRateBondHelper> >&, const QuantLib::DayCounter&, const QuantLib::FittedBondDiscountCurve::FittingMethod&, QuantLib::Real, QuantLib::Size, const QuantLib::Array&, QuantLib::Real)' is deprecated (declared at /usr/include/ql/termstructures/yield/fittedbonddiscountcurve.hpp:115) [-Wdeprecated-declarations]
>                                                             nelsonSiegel, tolerance, max));
>                                                                                         ^
>
> I poked around a little and must admit that I didn't immediately see how to
> fix that.
>
> Could someone wave the cluebat my way? I'd be happy to fix Bonds.cpp along
> with what I need to update in RQuantLib.
>
> Thanks!
>
> Dirk
>
> --
> Dirk Eddelbuettel | [hidden email] | http://dirk.eddelbuettel.com
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Deprecated example in Bonds.cpp

Dirk Eddelbuettel

Hi Luigi,

On 18 March 2014 at 11:20, Luigi Ballabio wrote:
| Hi Dirk,
|     it's not FixedRateBondHelper that is deprecated; it's just that
| particular constructor of FittedBondDiscountCurve, which takes a
| vector<shared_ptr<FixedRateBondHelper>> and now is superseded by the
| one that takes a more general vector<shared_ptr<BondHelper>>.

Sorry, that is what I meant.

| You should be able to fix your code simply by changing the type of the
| vector you're passing.

I think I tried that.  I shall try again...

Dirk

--
Dirk Eddelbuettel | [hidden email] | http://dirk.eddelbuettel.com

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Deprecated example in Bonds.cpp

Dirk Eddelbuettel

On 18 March 2014 at 06:38, Dirk Eddelbuettel wrote:
|
| Hi Luigi,
|
| On 18 March 2014 at 11:20, Luigi Ballabio wrote:
| | Hi Dirk,
| |     it's not FixedRateBondHelper that is deprecated; it's just that
| | particular constructor of FittedBondDiscountCurve, which takes a
| | vector<shared_ptr<FixedRateBondHelper>> and now is superseded by the
| | one that takes a more general vector<shared_ptr<BondHelper>>.
|
| Sorry, that is what I meant.
|
| | You should be able to fix your code simply by changing the type of the
| | vector you're passing.
|
| I think I tried that.  I shall try again...

Gosh was that ever simple, but as usual I need three runs around the class
hierarchy until I realized that FixedRateBond is what I wanted...

Sent you a pull request updating the example.

Dirk

--
Dirk Eddelbuettel | [hidden email] | http://dirk.eddelbuettel.com

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev