FdDividendAmericanOption doesn't like zero time to dividend
Posted by Vadim Ogranovich-3 on
URL: http://quantlib.414.s1.nabble.com/FdDividendAmericanOption-doesn-t-like-zero-time-to-dividend-tp2177.html
Hi,
FdDividendAmericanOption::value() fails, and here is the error message:
QuantLib::Error::Error: A value must be supplied for this type of boundary
condition at:../../ql/FiniteDifferences/boundarycondition.hpp:56,
if the dividendTime is zero.
Could someone please suggest a simple work around? Note that it wouldn't
suffice to simply remove the dividend and adjust the price by its amount
since the the option might need to be exercised that day.
For example I can add some small number to the time, but I am concerned that
this will effectively push the dividend to the next time step. Is this a
valid concern?
Thanks, Vadim
P.S> Here is how to reproduce the error
#include <ql/quantlib.hpp>
using namespace std;
using namespace QuantLib;
using namespace QuantLib::Pricers;
int main() {
const unsigned timeSteps = 20;
const unsigned assetSteps = 20;
vector<double> dividendA, dividendTimeA;
dividendA.push_back(0.125);
dividendTimeA.push_back(0); // this is the crux
double under=40.25;
double strike=35;
double dividendYield=0;
double interestRate=0.05;
double expirationTime=0.1;
double sigma=0.25;
FdDividendAmericanOption opt(Option::Call, under,
strike,
dividendYield, interestRate,
expirationTime, sigma,
dividendA, dividendTimeA,
timeSteps, assetSteps);
double x = opt.value();
return 0;
}
--------------------------------------------------
DISCLAIMER
This e-mail, and any attachments thereto, is intended only for use by the
addressee(s) named herein and may contain legally privileged and/or
confidential information. If you are not the intended recipient of this
e-mail, you are hereby notified that any dissemination, distribution or
copying of this e-mail, and any attachments thereto, is strictly prohibited.
If you have received this e-mail in error, please immediately notify me and
permanently delete the original and any copy of any e-mail and any printout
thereof.
E-mail transmission cannot be guaranteed to be secure or error-free. The
sender therefore does not accept liability for any errors or omissions in
the contents of this message which arise as a result of e-mail transmission.
NOTICE REGARDING PRIVACY AND CONFIDENTIALITY
Knight Trading Group may, at its discretion, monitor and review the content
of all e-mail communications.