what are you doing? two kids on the arrival!!!
;-) On Dec 7, 2007 1:16 PM, <[hidden email]> wrote: > Revision: 13734 > http://quantlib.svn.sourceforge.net/quantlib/?rev=13734&view=rev > Author: ericehlers > Date: 2007-12-07 04:16:24 -0800 (Fri, 07 Dec 2007) > > Log Message: > ----------- > C++ addin catching up > > Modified Paths: > -------------- > branches/R000900-branch/QuantLibAddin/Clients/Cpp/qlademo.cpp > branches/R000900-branch/QuantLibAddin/gensrc/metadata/Rules/cpp.xml > > Modified: branches/R000900-branch/QuantLibAddin/Clients/Cpp/qlademo.cpp > =================================================================== > --- branches/R000900-branch/QuantLibAddin/Clients/Cpp/qlademo.cpp 2007-12-07 09:48:48 UTC (rev 13733) > +++ branches/R000900-branch/QuantLibAddin/Clients/Cpp/qlademo.cpp 2007-12-07 12:16:24 UTC (rev 13734) > @@ -22,6 +22,7 @@ > #include <oh/auto_link.hpp> > #endif > > +#define OH_NULL ObjectHandler::Variant() > > using namespace QuantLibAddinCpp; > > @@ -31,16 +32,17 @@ > > initializeAddin(); > > - ohSetLogFile("qlademo.log", 4L, ObjectHandler::Variant()); > - ohSetConsole(1, 4L, ObjectHandler::Variant()); > - ohLogMessage("Begin example program.", 4L, ObjectHandler::Variant()); > - ohLogMessage(qlAddinVersion(ObjectHandler::Variant()), 4L, ObjectHandler::Variant()); > - ohLogMessage(ohVersion(ObjectHandler::Variant()), 4L, ObjectHandler::Variant()); > + ohSetLogFile("qlademo.log", 4L, OH_NULL); > + ohSetConsole(1, 4L, OH_NULL); > + LOG_MESSAGE("Begin example program."); > + LOG_MESSAGE("QuantLibAddin version = " << qlAddinVersion(OH_NULL)); > + LOG_MESSAGE("ObjectHandler version = " << ohVersion(OH_NULL)); > > std::string daycountConvention = "Actual/365 (Fixed)"; > std::string payoffType = "Vanilla"; > std::string optionType = "Put"; > std::string engineType = "AE"; // Analytic European > + std::string calendar = "TARGET"; // Analytic European > std::string xmlFileName = "option_demo.xml"; > double dividendYield = 0.00; > double riskFreeRate = 0.06; > @@ -51,15 +53,16 @@ > long settlementDate = 35932; // 17 May 1998 > long exerciseDate = 36297; // 17 May 1999 > > - qlSettingsSetEvaluationDate(evaluationDate, ObjectHandler::Variant()); > + qlSettingsSetEvaluationDate(evaluationDate, OH_NULL); > > std::string idBlackConstantVol = qlBlackConstantVol( > - "my_blackconstantvol", > + std::string("my_blackconstantvol"), > settlementDate, > + calendar, > volatility, > daycountConvention, > - ObjectHandler::Variant(), > - ObjectHandler::Variant(), > + OH_NULL, > + OH_NULL, > false); > > std::string idGeneralizedBlackScholesProcess = qlGeneralizedBlackScholesProcess( > @@ -70,8 +73,8 @@ > settlementDate, > riskFreeRate, > dividendYield, > - ObjectHandler::Variant(), > - ObjectHandler::Variant(), > + OH_NULL, > + OH_NULL, > false); > > std::string idStrikedTypePayoff = qlStrikedTypePayoff( > @@ -80,40 +83,39 @@ > optionType, > strike, > strike, > - ObjectHandler::Variant(), > - ObjectHandler::Variant(), > + OH_NULL, > + OH_NULL, > false); > > std::string idExercise = qlEuropeanExercise( > "my_exercise", > exerciseDate, > - ObjectHandler::Variant(), > - ObjectHandler::Variant(), > + OH_NULL, > + OH_NULL, > false); > > std::string idPricingEngine = qlPricingEngine( > "my_engine", > engineType, > - ObjectHandler::Variant(), > - ObjectHandler::Variant(), > + idGeneralizedBlackScholesProcess, > + OH_NULL, > + OH_NULL, > false); > > std::string idVanillaOption = qlVanillaOption( > "my_option", > - idGeneralizedBlackScholesProcess, > idStrikedTypePayoff, > idExercise, > - idPricingEngine, > - ObjectHandler::Variant(), > - ObjectHandler::Variant(), > + OH_NULL, > + OH_NULL, > false); > > - std::ostringstream s; > - s << "option NPV() = " << qlInstrumentNPV(idVanillaOption,ObjectHandler::Variant()); > - ohLogMessage(s.str(), 4L, ObjectHandler::Variant()); > + qlInstrumentSetPricingEngine(idVanillaOption, idPricingEngine, OH_NULL); > > - ohLogObject(idVanillaOption, ObjectHandler::Variant()); > + LOG_MESSAGE("option PV = " << qlInstrumentNPV(idVanillaOption, OH_NULL)); > > + ohLogObject(idVanillaOption, OH_NULL); > + > std::vector<std::string> idList; > idList.push_back(idBlackConstantVol); > idList.push_back(idGeneralizedBlackScholesProcess); > @@ -121,18 +123,16 @@ > idList.push_back(idExercise); > idList.push_back(idPricingEngine); > idList.push_back(idVanillaOption); > - ohObjectSave(idList, xmlFileName, ObjectHandler::Variant(), ObjectHandler::Variant()); > + ohObjectSave(idList, xmlFileName, true, OH_NULL); > > - ohLogMessage("End example program.", 4L, ObjectHandler::Variant()); > + LOG_MESSAGE("End example program."); > > return 0; > } catch (const std::exception &e) { > - std::ostringstream s; > - s << "Error: " << e.what(); > - ohLogMessage(s.str(), 1L, ObjectHandler::Variant()); > + LOG_ERROR("Error: " << e.what()); > return 1; > } catch (...) { > - ohLogMessage("unknown error", 1L, ObjectHandler::Variant()); > + LOG_ERROR("Unknown error"); > return 1; > } > > > Modified: branches/R000900-branch/QuantLibAddin/gensrc/metadata/Rules/cpp.xml > =================================================================== > --- branches/R000900-branch/QuantLibAddin/gensrc/metadata/Rules/cpp.xml 2007-12-07 09:48:48 UTC (rev 13733) > +++ branches/R000900-branch/QuantLibAddin/gensrc/metadata/Rules/cpp.xml 2007-12-07 12:16:24 UTC (rev 13734) > @@ -175,7 +175,10 @@ > <RuleGroup name='voCall' checkParameterIgnore='true' checkSkipFirst='true' indent='4' delimiter=', '> > <Wrap> %s</Wrap> > <Rules> > - <Rule tensorRank='scalar' superType='enumeration' default='true'>%(indent)s%(name)sCpp</Rule> > + <!--<Rule tensorRank='scalar' superType='enumeration' default='true'>%(indent)s%(name)sCpp</Rule>--> > + <Rule tensorRank='scalar' type='QuantLib::Natural' default='true'>%(indent)s%(name)s</Rule> > + <Rule tensorRank='scalar' type='QuantLib::Date' default='true'>%(indent)s%(name)s</Rule> > + <Rule tensorRank='scalar' default='true'>%(indent)s%(name)sCpp</Rule> > <Rule>%(indent)s%(name)s</Rule> > </Rules> > </RuleGroup> > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > QuantLib-cvs mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-cvs > ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |