我使用QLNet进行美式期权定价,但它不起作用。 我已在Quantlib forum
上发布了我的问题我的代码:
todaysDate & settlementdate = 2012-12-18, maturity = 2013-01-18,
Calendar calendar = new TARGET();
Settings.setEvaluationDate(TodaysDate);
DayCounter dayCounter = new Actual365Fixed();
Handle<Quote> underlyingH = new Handle<Quote>(new SimpleQuote(100));
var flatTermStructure = new Handle<YieldTermStructure>(new FlatForward(SettlementDate, 0.08, dayCounter));
var flatDividendTS = new Handle<YieldTermStructure>(new FlatForward(SettlementDate, 0, dayCounter));
var flatVolTS = new Handle<BlackVolTermStructure>(new BlackConstantVol(SettlementDate, calendar, 0.2, dayCounter));
StrikedTypePayoff payoff = new PlainVanillaPayoff(Call, 101);
var bsmProcess = new BlackScholesMertonProcess(underlyingH, flatDividendTS, flatTermStructure, flatVolTS);
Exercise exerciseEngine = exerciseEngine = new AmericanExercise(SettlementDate, Maturity);
VanillaOption optionEngine = new VanillaOption(payoff, exerciseEngine);
optionEngine.setPricingEngine(new BinomialVanillaEngine<CoxRossRubinstein>(bsmProcess, 801));
//error:
optionEngine.impliedVolatility(optionEngine.NPV(), bsmProcess, 1.0e-4, 100, 1.0e-7, 4.0);
基础= 100,k = 101,i = 0.08,vol = 0.2,div = 0, 今天的日期和时间settlementdate = 2012-12-18,maturity = 2013-01-18,
在 VanillaOption.cs 中,案例代码Exercise.Type.American是取消注释;
错误消息为:已添加具有相同键的项。 在第111行(results.additionalResults.Add priceCurve,prices_) FDStepConditionEngine.cs
感谢您的帮助。