|
From: <tar...@li...> - 2012-10-03 16:55:02
|
Hello,
I have update QuantLib from 1.1 to 1.2 and I got a strange error.
QLSBTesting.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open
the PDB file
'QLSBTesting.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or
open the PDB file
'QLSBTesting.exe': Loaded 'C:\WINDOWS\system32\msvcp100.dll', Cannot find or
open the PDB file
'QLSBTesting.exe': Loaded 'C:\WINDOWS\system32\msvcr100.dll', Cannot find or
open the PDB file
First-chance exception at 0x7c812afb in QLSBTesting.exe: Microsoft C++
exception: QuantLib::Error at memory location 0x0012fc68..
The program '[4108] QLSBTesting.exe: Native' has exited with code 0 (0x0).
Here is the piece of code which worked on 1.1 but return me the above error
after moved to 1.2. The pronlem is when I call the InterpolatedDiscountCurve (
see at the end of the code)
Have you any clue?
Thanks in advance
Paolo
std::vector<std::string> sb_dates;
sb_dates.push_back("2012-10-03");
sb_dates.push_back("2012-11-05");
sb_dates.push_back("2012-11-05");
sb_dates.push_back("2012-12-05");
sb_dates.push_back("2013-10-07");
sb_dates.push_back("2014-10-06");
sb_dates.push_back("2017-10-05");
sb_dates.push_back("2024-10-07");
sb_dates.push_back("2032-10-05");
std::vector<double> sb_values;
sb_values.push_back(1.0);
sb_values.push_back(0.999981);
sb_values.push_back( 0.99997);
sb_values.push_back( 0.999878);
sb_values.push_back( 0.996254);
sb_values.push_back( 0.991456);
sb_values.push_back(0.95465);
sb_values.push_back( 0.785955);
sb_values.push_back(0.623019);
std::string sb_datatype("discountfactor");
std::string sb_dcf("act360");
std::string sb_interpolation("Linear");
std::vector<std::string> sb_dates2interp;
std::vector<QuantLib::Date> dates;
if (dates.size() < sb_dates.size()) { dates.resize(sb_dates.size()); }
std::vector<QuantLib::Date> dates2interp;
if (dates2interp.size() < sb_dates2interp.size()) { dates2interp.resize
(sb_dates2interp.size()); }
// Converting the dates string into QuantLib Date
for (size_t i=0; i<sb_dates.size(); ++i) {
dates[i] = QuantLib::DateParser::parseISO(sb_dates[i]);
}
for (size_t i=0; i<sb_dates2interp.size(); ++i) {
dates2interp[i] = QuantLib::DateParser::parseISO(sb_dates2interp[i]);
}
// Day counter
QuantLib::DayCounter basis = QuantLib::Actual360();
if (sb_dcf.compare("actact") == 0) { basis = QuantLib::ActualActual(); }
if (sb_dcf.compare("act365") == 0) { basis = QuantLib::Actual365Fixed(); }
if (sb_dcf.compare("30360") == 0) { basis = QuantLib::Thirty360(); }
if (sb_dcf.compare("act360") == 0) { basis = QuantLib::Actual360(); }
if (sb_dcf.compare("bus252") == 0) { basis = QuantLib::Business252(); }
// Yield term structure
QuantLib::RelinkableHandle<YieldTermStructure> yc;
if (sb_datatype.compare("discountfactor") == 0) {
std::vector<QuantLib::DiscountFactor> dfs;
if (dfs.size() < sb_values.size()) { dfs.resize(sb_values.size()); }
for (size_t i=0; i<sb_values.size(); ++i) {
dfs[i] = sb_values[i];
std::cout << dfs[i] << std::endl;
}
if (sb_interpolation.compare("Linear") == 0) {
std::cout << "START: " << std::endl;
boost::shared_ptr<YieldTermStructure> dfcurve(new QuantLib::
InterpolatedDiscountCurve<Linear>(dates, dfs, basis));
yc.linkTo(dfcurve);
std::cout << "VALUE DF: " << dfcurve->(dates2interp[1]) << std::endl;
}
}
|