2011/4/4 <[hidden email]>
Send QuantLib-users mailing list submissions to
[hidden email]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/quantlib-users
or, via email, send a message with subject or body 'help' to
[hidden email]
You can reach the person managing the list at
[hidden email]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of QuantLib-users digest..."
Today's Topics:
1. How to construct an optimization problem in QuantlibXL? (??)
2. Managed Wrapper (John Maiden)
3. Re: Managed Wrapper (John Maiden)
4. Re: Managed Wrapper (John Maiden)
5. Re: Managed Wrapper (John Maiden)
6. Build QuantlibXL from source code (??)
---------- Forwarded message ----------
From: 李丞 <scrappedprince.li@gmail.com>
To: <[hidden email]>
Date: Mon, 4 Apr 2011 01:20:47 +0800
Subject: [Quantlib-users] How to construct an optimization problem in QuantlibXL?
Hi anyone:
Now I am considering doing some work on optimization problem using QuantlibXL. I saw the sample sheet under the folder \workbooks\math.
But in that sample sheet, only some optimization engine were constructed. I think to construct a complete problem a cost function object should be passed to the
Optimization engine. How this step should be done in QuantlibXL?
Regards
Li Cheng
---------- Forwarded message ----------
From: John Maiden <[hidden email]>
To: [hidden email]
Date: Sun, 3 Apr 2011 22:35:10 +0000 (UTC)
Subject: [Quantlib-users] Managed Wrapper
I'm working on a managed c++/cli wrapper for QuantLib that I can use it with
.net code. I'm using VS 2010 and have the latest code, where I downloaded the
2010 project using the advice from Quantcorner.
I've built the QuantLib code (with no problems) and included the library and
headers in the managed project as a reference. The code compiles, but I'm
getting linking errors that all seem to be centered around the FDM Heston code.
There are 12 linking errors in total; including three example errors for
reference. Hopefully someone will tell me what's going on:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall
QuantLib::FdmSimpleProcess1dMesher::FdmSimpleProcess1dMesher(unsigned int,class
boost::shared_ptr<class QuantLib::StochasticProcess1D> const &,double,unsigned
int,double)"
(??0FdmSimpleProcess1dMesher@QuantLib@@QAE@IABV?$shared_ptr
@VStochasticProcess1D@QuantLib@@@boost@@NIN@Z)
referenced in function "public: virtual void __thiscall
QuantLib::FdHestonHullWhiteVanillaEngine::calculate(void)const "
(?calculate@FdHestonHullWhiteVanillaEngine@QuantLib@@UBEXXZ)
Error 2 error LNK2019: unresolved external symbol "public: __thiscall
QuantLib::Fdm3DimSolver::Fdm3DimSolver(struct QuantLib::FdmSolverDesc const
&,struct QuantLib::FdmSchemeDesc const &,class boost::shared_ptr<class
QuantLib::FdmLinearOpComposite> const &)"
(??0Fdm3DimSolver@QuantLib@@QAE@ABUFdmSolverDesc@1@ABUFdmSchemeDesc
@1@ABV?$shared_ptr@VFdmLinearOpComposite@QuantLib@@@boost@@@Z)
referenced in function "protected: virtual void __thiscall
QuantLib::FdmHestonHullWhiteSolver::performCalculations(void)const "
(?performCalculations@FdmHestonHullWhiteSolver@QuantLib@@MBEXXZ)
Error 12 error LNK2019: unresolved external symbol "public: double __thiscall
QuantLib::Fdm2DimSolver::thetaAt(double,double)const "
(?thetaAt@Fdm2DimSolver@QuantLib@@QBENNN@Z) referenced in function "public:
double __thiscall QuantLib::FdmHestonSolver::thetaAt(double,double)const "
(?thetaAt@FdmHestonSolver@QuantLib@@QBENNN@Z)
---------- Forwarded message ----------
From: John Maiden <[hidden email]>
To: [hidden email]
Date: Mon, 4 Apr 2011 00:49:49 +0000 (UTC)
Subject: Re: [Quantlib-users] Managed Wrapper
To add more color, I'm testing a simple option pricer, using the EquityOption
example. I've done some more testing. I can get an American option to build and
link, but I can't get a European option to link. See code below. If I uncomment
the European section then I can't get the code to link.
void priceOptionEuro(
Date valueDate,
Date settlementDate,
Date maturity,
Real underlying,
Real strike,
Rate riskFreeRate,
Spread dividendYield,
Volatility volatility,
double &NPV)
{
// Hard-coded values for now
Calendar calendar = TARGET();
DayCounter dayCounter = Actual365Fixed();
Option::Type type(Option::Call);
// Exercise type
Handle<Quote> underlyingH(
boost::shared_ptr<Quote>(new SimpleQuote(underlying)));
// bootstrap the yield/dividend/vol curves
// Flat yield structure
Handle<YieldTermStructure> flatTermStructure(
boost::shared_ptr<YieldTermStructure>(
new FlatForward(settlementDate, riskFreeRate, dayCounter)));
// Flat dividend
Handle<YieldTermStructure> flatDividendTS(
boost::shared_ptr<YieldTermStructure>(
new FlatForward(settlementDate, dividendYield, dayCounter)));
// Flat vol
Handle<BlackVolTermStructure> flatVolTS(
boost::shared_ptr<BlackVolTermStructure>(
new BlackConstantVol(settlementDate, calendar, volatility,
dayCounter)));
boost::shared_ptr<StrikedTypePayoff> payoff(
new PlainVanillaPayoff(type, strike));
Size timeSteps = 801;
// BSM process
boost::shared_ptr<BlackScholesMertonProcess> bsmProcess(
new BlackScholesMertonProcess(underlyingH, flatDividendTS,
flatTermStructure, flatVolTS));
// European code that gives linking problem
/*boost::shared_ptr<Exercise> europeanExercise(
new EuropeanExercise(maturity));
VanillaOption europeanOption(payoff, europeanExercise);
europeanOption.setPricingEngine(boost::shared_ptr<PricingEngine>(
new FDEuropeanEngine<CrankNicolson>(bsmProcess, timeSteps,
timeSteps-1)));
NPV = europeanOption.NPV();*/
// American code that builds and links
boost::shared_ptr<Exercise> americanExercise(
new AmericanExercise(settlementDate, maturity));
VanillaOption americanOption(payoff, americanExercise);
americanOption.setPricingEngine(boost::shared_ptr<PricingEngine>(
new FDAmericanEngine<CrankNicolson>(bsmProcess, timeSteps,
timeSteps-1)));
NPV = americanOption.NPV();
}
---------- Forwarded message ----------
From: John Maiden <[hidden email]>
To: [hidden email]
Date: Mon, 4 Apr 2011 02:30:45 +0000 (UTC)
Subject: Re: [Quantlib-users] Managed Wrapper
I can also swap out the American code with a Bermudan one-exercise, which also
builds and links:
std::vector<Date> exerciseDates;
exerciseDates.push_back(maturity);
boost::shared_ptr<Exercise> bermudanExercise(
new BermudanExercise(exerciseDates));
VanillaOption bermudanOption(payoff, bermudanExercise);
bermudanOption.setPricingEngine(boost::shared_ptr<PricingEngine>(
new FDBermudanEngine<CrankNicolson>(bsmProcess, timeSteps,
timeSteps-1)));
NPV = bermudanOption.NPV();
---------- Forwarded message ----------
From: John Maiden <[hidden email]>
To: [hidden email]
Date: Mon, 4 Apr 2011 03:25:42 +0000 (UTC)
Subject: Re: [Quantlib-users] Managed Wrapper
Actually, I'm getting the Bermudan and American code to link, but I'm getting
runtime errors. It happens when FDBermudanEngine/FDAmericanEngine get to their
base class, FDVanillaEngine. The base class tries to initiate the
TridiagonalOperator member with size = 0, which ends up copying an empty array.
This gets caught as an error when copy is called for a null array.
---------- Forwarded message ----------
From: 李丞 <scrappedprince.li@gmail.com>
To: <[hidden email]>
Date: Mon, 4 Apr 2011 17:55:10 +0800
Subject: [Quantlib-users] Build QuantlibXL from source code
Hi all,
I want to build QuantlibXL from source code. I follow the steps described here : http://quantlib.org/quantlibaddin/build__qlxl.html
But finally I get several error report. Such as :
1. Error 35 error C2780: 'bool boost::regex_match(BidiIterator,BidiIterator,boost::match_results<Iterator,Allocator> &,const boost::basic_regex<charT,traits> &,boost::regex_constants::match_flag_type)' : expects 5 arguments - 2 provided c:\build_ql_1_0_1\ObjectHandler\oh\serializationfactory.cpp 273
2. Error 27 error C2039: 'basic_filesystem_error' : is not a member of 'boost::filesystem' c:\build_ql_1_0_1\ObjectHandler\oh\serializationfactory.cpp 194
I am really confused what is wrong. My compiler is VS 2008 pro and quantlib version is 1.0.1. My boost version is 1.46.1.
Regards
Li Cheng
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users