My average-price formula agrees with QuanLib, but my average-strike
formula doesn't. When the dividend yield is zero, the QuanLib results agree with my own implementation perfectly. When the dividend yield isn't zero, they differ in 3rd digit. Could it be that average-strike engine doesn't handle non-zero dividend yield properly? I coded up a special case. (*) No past fixings. (*) Two remaining fixings at dt and 2*dt (midpoint and maturity). (*) Time step dt = 45/365 (i.e. 45 days). (*) Set yield = rate - 0.5*volatility*volatility (for easy derivation). (*) Use NullCalendar and ActualActual (calendar and day counter for theoretical calculations). (*) Set Settings::instance().evaluationDate() to the settlement date. A simple code which implements the above special case is below. QL example and the derivation of formula are in the attachments. The spacial case code agrees with my general implementation. Could someone compare it to QuantLib implementation. Regards, Kakhkhor Abdijalilov. //----------------------------------------------------------------------------------- // Special Case // Analytic Discrete Geometric Average Strike Asian Option //----------------------------------------------------------------------------------- #include <iostream> #include <boost/math/distributions/normal.hpp> int main() { double spot = 22.0; double r = 0.1; // risk free rate double dt = 45.0/365.0; // time between fixings double v = 0.2; // volatility double yield = r - 0.5*v*v; // set dividend yeild std::cout << "Average-strike Call and Put prices:\n"; double a = v*std::sqrt(dt); double s = spot*std::exp(a*a/2 - 2*r*dt); double x = std::exp(a*a/2); double y = std::exp(a*a/8); boost::math::normal_distribution<double> nd; double n1 = boost::math::cdf(nd,a); double n2 = boost::math::cdf(nd,a/2); double c = s*(x*n1 - y*n2); // call double p = s*(x*(n1-1) - y*(n2-1)); // put std::cout << c << '\t' << p << '\n'; } ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |