http://quantlib.414.s1.nabble.com/Pricing-American-Options-using-a-bootstrapped-yield-curve-tp7416.html
I am currently working on a project , where we are trying to price American options by passing in a "piecewise yield curve" object ( as opposed to generating a flat forward yield term structure using the risk free rate) . To this end, I am trying to modify the GeneralizedBlackScholesProcess class in qlo/processes.cpp so as to take in a PiecewiseYieldCurve object as a parameter. I believe , we dont need to modify any other class in order to achieve this objective. Please let me know if my understanding is correct .
I have however run in to problems while trying to modify the code in processes.hpp . I am copy-pasting my modifications below
namespace QuantLib {
class GeneralizedBlackScholesProcess;
class BlackVolTermStructure;
class DayCounter;
class Date;
template <class Traits, class Interpolator,
template <class> class Bootstrap = IterativeBootstrap>
class PiecewiseYieldCurve;
}
namespace QuantLibAddin {
template <class Traits, class Interpolator,
template <class> class Bootstrap = IterativeBootstrap>
class GeneralizedBlackScholesProcess2:public ObjectHandler::LibraryObject<QuantLib::GeneralizedBlackScholesProcess> {
public:
GeneralizedBlackScholesProcess2(
const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
const boost::shared_ptr<QuantLib::BlackVolTermStructure>& blackVolTermStructureP,
QuantLib::Real underlying,
const QuantLib::DayCounter& dayCounter,
const QuantLib::Date& settlementDate,
const boost::shared_ptr<QuantLib::PiecewiseYieldCurve<Traits,Interpolator,Bootstrap>>& piecewiseYieldCurveP,
QuantLib::Spread dividendYield,
bool permanent);
};
}
Processes.cpp
template <class Traits, class Interpolator,
template <class> class Bootstrap = IterativeBootstrap>
GeneralizedBlackScholesProcess2::GeneralizedBlackScholesProcess2(
const boost::shared_ptr<ObjectHandler::ValueObject> &properties,
const boost::shared_ptr<QuantLib::BlackVolTermStructure> &blackVolTermStructureP,
QuantLib::Real underlying,
const QuantLib::DayCounter &dayCounter,
const QuantLib::Date &settlementDate,
const boost::shared_ptr<QuantLib::PiecewiseYieldCurve<Traits,Interpolator,Bootstrap>>& piecewiseYieldCurveP,
QuantLib::Spread dividendYield,
bool permanent)
: ObjectHandler::LibraryObject<QuantLib::GeneralizedBlackScholesProcess>(properties, permanent) {
QuantLib::Handle<QuantLib::Quote> underlyingH(
boost::shared_ptr<QuantLib::Quote>(
new QuantLib::SimpleQuote(underlying)));
QuantLib::Handle<QuantLib::YieldTermStructure> yieldTermStructure(piecewiseYieldCurveP);
QuantLib::Handle<QuantLib::YieldTermStructure> flatDividendTS(
boost::shared_ptr<QuantLib::YieldTermStructure>(
new QuantLib::FlatForward(settlementDate, dividendYield, dayCounter)));
QuantLib::Handle<QuantLib::BlackVolTermStructure>
blackVolTermStructureH(blackVolTermStructureP);
libraryObject_ = boost::shared_ptr<QuantLib::GeneralizedBlackScholesProcess> (
new QuantLib::GeneralizedBlackScholesProcess(
underlyingH,
flatDividendTS,
yieldTermStructure,
blackVolTermStructureH));
}
However, when I compile I am getting the following error.
QuantLibAddin::GeneralizedBlackScholesProcess2' : use of class template requires template argument list
1> .\qlo/processes.hpp(67) : see declaration of 'QuantLibAddin::GeneralizedBlackScholesProcess2'
1>.\qlo\processes.cpp(104) : error C2244: 'QuantLibAddin::GeneralizedBlackScholesProcess2<Traits,Interpolator,Bootstrap>::GeneralizedBlackScholesProcess2' : unable to match function definition to an existing declaration
1> .\qlo/processes.hpp(69) : see declaration of 'QuantLibAddin::GeneralizedBlackScholesProcess2<Traits,Interpolator,Bootstrap>::GeneralizedBlackScholesProcess2'
1> definition
1> 'QuantLibAddin::GeneralizedBlackScholesProcess2::GeneralizedBlackScholesProcess2(const boost::shared_ptr<T> &,const boost::shared_ptr<QuantLib::BlackVolTermStructure> &,QuantLib::Real,const QuantLib::DayCounter &,const QuantLib::Date &,const boost::shared_ptr<QuantLib::PiecewiseYieldCurve<Traits,Interpolator,Bootstrap>> &,QuantLib::Spread,bool)'
1> with
1> [
1> T=ObjectHandler::ValueObject
1> ]
1> existing declarations
1> 'QuantLibAddin::GeneralizedBlackScholesProcess2<Traits,Interpolator,Bootstrap>::GeneralizedBlackScholesProcess2(const boost::shared_ptr<T> &,const boost::shared_ptr<QuantLib::BlackVolTermStructure> &,QuantLib::Real,const QuantLib::DayCounter &,const QuantLib::Date &,const boost::shared_ptr<QuantLib::PiecewiseYieldCurve<Traits,Interpolator,Bootstrap>> &,QuantLib::Spread,bool)'
1> with
1> [
1> T=ObjectHandler::ValueObject
I have tried all possible options but to no avail . Could someone please point out where I am going wrong??
processing features enabled.