I've done a comparison and I think that the new code seems to be
working..... american dividend - assetSteps=20 price=2.18493 delta=0.520894 vega=7.7514 american - assetSteps=20 price=2.18493 delta=0.520894 vega=7.7514 american dividend - assetSteps=40 price=2.18264 delta=0.519247 vega=7.72734 american - assetSteps=40 price=2.18264 delta=0.519247 vega=7.72734 american dividend - assetSteps=60 price=2.18264 delta=0.519255 vega=7.72739 american - assetSteps=60 price=2.18264 delta=0.519255 vega=7.72739 american dividend - assetSteps=70 price=2.18264 delta=0.519258 vega=7.72743 american - assetSteps=70 price=2.18264 delta=0.519258 vega=7.72743 american dividend - assetSteps=80 price=2.18264 delta=0.519256 vega=7.72749 american - assetSteps=80 price=2.18264 delta=0.519256 vega=7.72749 american dividend - assetSteps=100 price=2.18263 delta=0.519237 vega=7.72731 american - assetSteps=100 price=2.18263 delta=0.519237 vega=7.72731 --------------------------------------- #include <ql/quantlib.hpp> #include <iostream> using namespace std; using namespace QuantLib; int main() { const unsigned timeSteps = 40; vector<unsigned> assetStepsA; assetStepsA.push_back(20); assetStepsA.push_back(40); assetStepsA.push_back(60); assetStepsA.push_back(70); assetStepsA.push_back(80); assetStepsA.push_back(100); vector<double> dividendA, dividendTimeA; double under=54.625; double strike=55; double dividendYield=0; double interestRate=0.052706; double expirationTime=0.126027; double sigma=0.282922; for (unsigned i=0; i<assetStepsA.size(); i++) { const unsigned assetSteps = assetStepsA[i]; FdDividendAmericanOption opt(Option::Call, under, strike, dividendYield, interestRate, expirationTime, sigma, dividendA, dividendTimeA, timeSteps, assetSteps); FdAmericanOption opt1(Option::Call, under, strike, dividendYield, interestRate, expirationTime, sigma, timeSteps, assetSteps); cout << "american dividend - assetSteps=" << assetSteps << " price=" << opt.value() << " delta=" << opt.delta() << " vega=" << opt.vega() << "\n"; cout << "american - assetSteps=" << assetSteps << " price=" << opt1.value() << " delta=" << opt1.delta() << " vega=" << opt1.vega() << "\n"; } return 0; } |
Free forum by Nabble | Edit this page |