quantlib - "end must be large than start" in Uniform1dMesher -


i try build pyd-file quantlib , boost want calculate npv barrier option. quantlib pyd throws:

runtimeerror: end must large start 

the error originates following quantlib class in uniform1dmesher.hpp:

class uniform1dmesher : public fdm1dmesher { public:     uniform1dmesher(real start, real end, size size)     : fdm1dmesher(size) {         ql_require(end > start, "end must large start");          const real dx = (end-start)/(size-1);          (size i=0; < size-1; ++i) {             locations_[i] = start + i*dx;             dplus_[i] = dminus_[i+1] = dx;         }          locations_.back() = end;         dplus_.back() = dminus_.front() = null<real>();     } }; 

my c++-code following:

struct optioninputs {   quantlib::real s;   quantlib::real k;   quantlib::spread f;   quantlib::rate r;   quantlib::volatility vol;   quantlib::date maturity;   quantlib::daycounter daycounter; };  double fxoptex(const optioninputs &in,           const quantlib::date &todaysdate,           const quantlib::date &settlementdate) {   using namespace quantlib;    calendar calendar = target();   settings::instance().evaluationdate() = todaysdate;   quantlib::real rebate = 0.05;    size timegird = 365;   size underlyinggird = 100;   size dampingsteps = 0;   real theta = 0.05;   bool localvolatility = true;    boost::shared_ptr<exercise> europeanexercise(             new europeanexercise(                 in.maturity));   handle<quote>     underlyingh(boost::shared_ptr<quote>(new simplequote(in.s)));    handle<yieldtermstructure>     rts(boost::shared_ptr<yieldtermstructure>(new flatforward(settlementdate,                                                            in.r,                                                            in.daycounter)));   handle<yieldtermstructure>     fts(boost::shared_ptr<yieldtermstructure>(new flatforward(settlementdate,                                                            in.f,                                                            in.daycounter)));   handle<blackvoltermstructure>     flatvolts(boost::shared_ptr<blackvoltermstructure>(new blackconstantvol(settlementdate,                                                                          calendar,                                                                          in.vol,                                                                          in.daycounter)));    boost::shared_ptr<strikedtypepayoff>     payoff(new plainvanillapayoff(option::put,                                in.k));    boost::shared_ptr<blackscholesmertonprocess> blackscholesmertonprocess(new blackscholesmertonprocess(                                         underlyingh,                                         fts,                                             rts,                                         flatvolts));           barrieroption barrieroption(             quantlib::barrier::upin,             quantlib::option::put,             rebate,             payoff,              europeanexercise);          barrieroption.setpricingengine(             boost::shared_ptr<pricingengine>(                 new fdblackscholesbarrierengine (                     blackscholesmertonprocess,                     timegird,                     underlyinggird,                     dampingsteps,                     fdmschemedesc::impliciteuler(),                     localvolatility,                     -null< real >())));     return barrieroption.npv(); }  struct fxoption {   double value;   void set(int s, int k, double f, double r, double vol, std::string maturity, std::string daycounter)   {     optioninputs in;     in.s=s;     in.k=k;     in.f=f;     in.r=r;     in.vol=vol;     in.maturity=quantlib::dateparser::parseiso(maturity);     if (daycounter == "actual365fixed")     {         in.daycounter = actual365fixed();     }     value = fxoptex(in, date(15, may, 1998), date(17, may, 1998));   }    double get()   {       return value;   }  };   using namespace boost::python; boost_python_module(quant) {      class_<fxoption>("fxoption")         .def("get", &fxoption::get)         .def("set", &fxoption::set)     ; } 

any idea why error thrown?

sorry i'm late party.

difficult without seeing actual invocation, maturity of option earlier settlement date?


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -