[英]QuantLib Error: “QuantLib::Handle<QuantLib::TermStructure>” cannot convert to “const QuantLib::Handle<QuantLib::YieldTermStructure> &”
[英]Quantlib RiskFreeCurve
下面這個關於如何移植文檔python
QL
程序, C++
,我嘗試:
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());
代替
auto u = make_shared<SimpleQuote>(100.0);
確保您符合boost
版本:
auto u = boost::make_shared<SimpleQuote>(100.0);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.