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-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Max, I believe you should use functions blackVariance() and blackVol() which BlackVarianceCurve inherits from BlackVolTermStructure. See the declaration of the latter in: ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp Best, Bojan -- Bojan Nikolic || http://www.bnikolic.co.uk ------------------------------------------------------------------------- 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-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Bojan,
Thanks for your help! Exactly, I should use blackVariance() or blackVol() rather than the protected method in the derived class. Best regards, Max On Mon, Jul 21, 2008 at 5:42 PM, Bojan Nikolic <[hidden email]> wrote:
------------------------------------------------------------------------- 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-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |