Hi All
I'm getting significant differences (about 0.2 vol in some places) between the SABR interpolation in excel and linux for release 0.9.7. For the same input data below, I'm finding alpha, rho and nu have small differences giving about a 0.2% difference between the interpolated curves at the money and elsewhere. Beta is fixed at 1. They should be bang on identical right? I'm probably doing something wrong - could anyone make any suggestions as where to go from here to nail it? The windows computer is a 64bit athlon and the linux is 64 bit intel btw. cheers, Piers
#include <ql/quantlib.hpp> #include <iostream> #include <vector> using namespace QuantLib; using namespace std; int main(int argc, char *argv[]) { Real forward = 3826.25; Time tau = 0.0305936; vector<double> strikes; vector<double> vols; strikes.push_back(3400); vols.push_back(0.368624622242282); strikes.push_back(3500); vols.push_back(0.321037653604485); strikes.push_back(3550); vols.push_back(0.299501682381891); strikes.push_back(3600); vols.push_back(0.279643985001476); strikes.push_back(3650); vols.push_back(0.261615469316373); strikes.push_back(3700); vols.push_back(0.245580215704548); strikes.push_back(3750); vols.push_back(0.231712426785790); strikes.push_back(3800); vols.push_back(0.220204595933114); strikes.push_back(3850); vols.push_back(0.211257342746155); strikes.push_back(3900); vols.push_back(0.205096538218055); strikes.push_back(3950); vols.push_back(0.201943526100016); strikes.push_back(4000); vols.push_back(0.202049566014993); strikes.push_back(4050); vols.push_back(0.205673850628091); strikes.push_back(4100); vols.push_back(0.213089315877449); strikes.push_back(4200); vols.push_back(0.240440352051281); SABRInterpolation sabr( strikes.begin(), strikes.end(), vols.begin(), tau, forward, Null<Real>(), 1, Null<Real>(), Null<Real>(), false, true, false, false ) ; sabr.update(); cout << "forward=" <<sabr.forward() << endl; cout << "expiry=" << sabr.expiry() << endl; cout << "alpha=" << sabr.alpha() << endl; cout << "beta=" << sabr.beta() << endl; cout << "nu=" << sabr.nu() << endl; cout << "rho=" << sabr.rho() << endl; cout << "rmsError=" << sabr.rmsError() << endl; cout << "atmVol=" << sabr(forward) << endl; cout << "endCriteria=" << sabr.endCriteria() << endl; for( unsigned int i = 0; i < strikes.size(); ++i ) cout << strikes[i] << " " << vols[i] << " " << sabr( strikes[i] ) << endl; return 0; } New! Receive and respond to mail from other email accounts from within Hotmail Find out how. ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Thanks for your suggestion Joe, the problem was due to the differing default value for the vegaWeightings arg across the c++ and excel versions!
Piers Excel Parameters:
c++ SABRInterpolation (const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, Time t, const Real &forward, Real alpha, Real beta, Real nu, Real rho, bool alphaIsFixed, bool betaIsFixed, bool nuIsFixed, bool rhoIsFixed, bool vegaWeighted=false, const boost::shared_ptr< EndCriteria > &endCriteria=boost::shared_ptr< EndCriteria >(), const boost::shared_ptr< OptimizationMethod > &optMethod=boost::shared_ptr< OptimizationMethod >()) Date: Mon, 7 Dec 2009 16:41:13 -0500 Subject: Re: [Quantlib-users] SABRInterpolation excel vs linux differences From: [hidden email] To: [hidden email] The floating point rounding mode (fegetround()/fesetround()) and math optimization differences (gcc -mieee-fp and cl.exe /Op) are some usual suspects. 2009/12/7 piers august <[hidden email]>
New! Receive and respond to mail from other email accounts from within Hotmail Find out how. ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |