遵循有关如何将python QL程序移植到C++的this文档,我尝试:
auto cp = 'C';
auto k = 100.0;
auto u = make_shared<SimpleQuote>(100.0);
auto r = make_shared<SimpleQuote>(0.01);
auto sigma = make_shared<SimpleQuote>(0.20);
auto t = calendar.businessDaysBetween(d1, expiry) / cDays;
auto exercise = EuropeanExercise(expiry);
auto payoff = ('C' == cp ? PlainVanillaPayoff(Option::Call, k) :
PlainVanillaPayoff(Option::Put, k));
auto european_option = EuropeanOption(
boost::make_shared<PlainVanillaPayoff>(payoff),
boost::make_shared<EuropeanExercise>(exercise));
auto riskFreeCurve =
make_shared<FlatForward>(0, TARGET(), Handle<Quote>(r), Actual360());我得到以下错误:
qldate.cpp:49:58: error: no matching function for call to \u2018QuantLib::Handle<QuantLib::Quote>::Handle(std::shared_ptr<QuantLib::SimpleQuote>&)\u2019
make_shared<FlatForward>(0, TARGET(), Handle<Quote>(r), Actual360());发布于 2019-11-14 03:53:08
而不是
auto u = make_shared<SimpleQuote>(100.0);确保您限定了boost版本:
auto u = boost::make_shared<SimpleQuote>(100.0);https://stackoverflow.com/questions/58843973
复制相似问题