Error using QuantLib on Ubuntu using Eclipse SDK

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

Error using QuantLib on Ubuntu using Eclipse SDK

javier-32
Good evening everyone,

Please, I would appreciate any help on the following error below. I'm
trying to use QuantLib on Eclipse Eclipse SDK, Version: 3.2.2, with
Ubuntu 7.10 - the Gutsy Gibbon - released in October 2007, but
unfortunately I don't even success in running a simple Vanilla
example. Many thanks in advance for any help.

Javier


EXAMPLE CODE:
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset:
4 -*- */

// the only header you need to use QuantLib
#include <ql/quantlib.hpp>
#include <iostream>

using namespace QuantLib;

 int main()
 {
 Option::Type type(Option::Call);
 Real underlying = 7.00, strike = 8.00;
 Spread dividendYield = 0.05;
 Rate riskFreeRate = 0.05;
 Volatility volatility = 0.10;
 Date todaysDate(15, May, 1998);
 Date settlementDate(17, May, 1998), exerciseDate(17, May, 1999);
 Settings::instance().evaluationDate() = todaysDate;
 DayCounter dayCounter = Actual365Fixed();
 Time maturity = dayCounter.yearFraction(settlementDate,exerciseDate);

 boost::shared_ptr<Exercise> exercise(new EuropeanExercise(exerciseDate));
 Handle<Quote> underlyingH(boost::shared_ptr<Quote>(new
 SimpleQuote(underlying)));

 Handle<YieldTermStructure>
 flatTermStructure(boost::shared_ptr<YieldTermStructure>(
 new FlatForward(settlementDate, riskFreeRate, dayCounter)));
 Handle<YieldTermStructure>
 flatDividendTS(boost::shared_ptr<YieldTermStructure>(
 new FlatForward(settlementDate, dividendYield, dayCounter)));
 Handle<BlackVolTermStructure>
 flatVolTS(boost::shared_ptr<BlackVolTermStructure>(
 new BlackConstantVol(settlementDate, volatility, dayCounter)));

 boost::shared_ptr<StrikedTypePayoff> payoff(
 new PlainVanillaPayoff(type, strike));

 boost::shared_ptr<BlackScholesProcess> stochasticProcess(
 new BlackScholesProcess(underlyingH, flatDividendTS,
flatTermStructure, flatVolTS));

 EuropeanOption option(stochasticProcess, payoff, exercise);

 option.setPricingEngine(boost::shared_ptr<PricingEngine>(
 new AnalyticEuropeanEngine()));

 std::cout << "Black-Scholes value: " << option.NPV() << std::endl;

 return 0;
}




ERROR:
make -k all
g++ -c main.cpp
main.cpp: In function ‘int main()’:
main.cpp:40: error: no matching function for call to
‘QuantLib::BlackScholesProcess::BlackScholesProcess(QuantLib::Handle<QuantLib::Quote>&,
QuantLib::Handle<QuantLib::YieldTermStructure>&,
QuantLib::Handle<QuantLib::YieldTermStructure>&,
QuantLib::Handle<QuantLib::BlackVolTermStructure>&)’
/usr/include/ql/processes/blackscholesprocess.hpp:100: note:
candidates are:
QuantLib::BlackScholesProcess::BlackScholesProcess(const
QuantLib::Handle<QuantLib::Quote>&, const
QuantLib::Handle<QuantLib::YieldTermStructure>&, const
QuantLib::Handle<QuantLib::BlackVolTermStructure>&, const
boost::shared_ptr<QuantLib::StochasticProcess1D::discretization>&)
/usr/include/ql/processes/blackscholesprocess.hpp:93: note:          
      QuantLib::BlackScholesProcess::BlackScholesProcess(const
QuantLib::BlackScholesProcess&)
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Error using QuantLib on Ubuntu using Eclipse SDK

Luigi Ballabio
On Wed, 2008-03-26 at 23:16 +0100, [hidden email] wrote:
> Good evening everyone,
>
> Please, I would appreciate any help on the following error below. I'm
> trying to use QuantLib on Eclipse Eclipse SDK, Version: 3.2.2, with
> Ubuntu 7.10 - the Gutsy Gibbon - released in October 2007, but
> unfortunately I don't even success in running a simple Vanilla
> example. Many thanks in advance for any help.

What version of QuantLib are you using? You'll probably have to use
BlackScholesMertonProcess instead of BlackScholesProcess (the first
includes a dividend yield; the second doesn't.)

Luigi


--

The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
-- Gilbert K. Chesterson



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users