Hi,
I try to create a volatility term structures (ATM) using class BlackVarianceCurve.
Below is a simple program. But it fails to compile due to the access the protected member function blackVarianceImpl().
#include <ql/quantlib.hpp>
#include <iostream>
using namespace QuantLib;
int main() {
DayCounter dc = Actual365Fixed();
Date today(25, Feb, 2008);
std::vector<Date> dates;
dates.push_back(Date(25, Aug, 2008));
dates.push_back(Date(25, Feb, 2009));
std::vector<Volatility> vols;
vols.push_back(24.9358/100); // 25 Aug 2008
vols.push_back(21.4448/100); // 25 Aug 2009
// volatility term structures
boost::shared_ptr<BlackVolTermStructure> volTS(
new BlackVarianceCurve(today, dates, vols, dc, false));
Real result_vol = volTS->blackVarianceImpl((Time)0.49863, (Real)0);
std::cout << "result_vol = " << result_vol << std::endl;
}
Here is the compilation error message (using GCC):
main.cpp: In function `int main()':
/usr/local/include/ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp:120: error: `virtual QuantLib::Real QuantLib::BlackVolTermStructure::blackVarianceImpl(QuantLib::Time, QuantLib::Real) const' is protected
main.cpp:23: error: within this context
May I know why the blackVarianceImpl() cannot be accessed in this way?
Also I wonder what is the proper way to create ATM volatility term structure using QuantLib.
Thanks!
Best regards,
Max
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev