|
From: R S <raj...@ho...> - 2019-03-22 12:23:07
|
Sorry - my mistake - no idea why I am reading != as == (brain has curdled of late - perhaps)
I have a utility that constructs the deposit helper (I am adding various helpers to a vector through it)
RateUtility::depoHelper(float rate, Period qlperiod, Calendar &calendar,
int fixingDays, bool endOfMonth,
DayCounter &dayCounter,
BusinessDayConvention &bizDayConven) {
Natural _fixingDays = Natural(fixingDays);
boost::shared_ptr<SimpleQuote> quote(new SimpleQuote(rate));
boost::shared_ptr<RateHelper> dh(new DepositRateHelper(Handle<Quote>(quote),
qlperiod, _fixingDays,
calendar, bizDayConven,
endOfMonth, dayCounter));
return dh;
}
I am building two vectors (as I mentioned earlier):
vector<float> rates;
rates.push_back(0.0382);
rates.push_back(0.0372);
vector<Period> qlperiods;
qlperiods.push_back(1 * Weeks);
qlperiods.push_back(4 * Weeks);
then add the helpers in a loop:
for (vector<float>::iterator it = rates.begin(); it < rates.end(); it++) {
vector<Period>::iterator p_it = qlperiods.begin();
helper.push_back(this->depoHelper(*it, *p_it, calendar, fixingDays,
endOfMonth, dayCounter, bizDayConven));
p_it++;
}
The various parameters are:
Calendar calendar = TARGET();
Settings::instance().evaluationDate() = Date(30,August,2010);
DayCounter dayCounter = Actual360();
BusinessDayConvention bizDayConv = ModifiedFollowing;
int fixingDays = 2;
Regards
-RS
On 22 Mar 2019, 11:17 +0000, Luigi Ballabio <lui...@gm...>, wrote:
It's not failing when i == 1. The QL_REQUIRE specifies the condition
to be satisfied, and it is (the dates are different, as required).
It's failing when i == 2, because the two dates are the same. How are
you creating the two deposits?
On Fri, Mar 22, 2019 at 11:50 AM R S <raj...@ho...> wrote:
Both pillars are 40429 (8/Sep/2010) - I can see this under ts_ -> instruments_ -> px -> YieldTermStructure
But I guess its failing when i == 1
because
dates[0] is 40422
and
dates[1] is 40429
Regards
-RS
On 22 Mar 2019, 10:36 +0000, Luigi Ballabio <lui...@gm...>, wrote:
alive_ = 2 means that you have two deposits. dates[0] is the
reference date of the curve. dates[1] is the pillar of the first
deposit. What is the value of dates[2], i.e., the pillar of the
second deposit? If it is equal to dates[1], which seems to be the
case, how are you initializing the deposits?
Luigi
On Thu, Mar 21, 2019 at 9:34 PM R S <raj...@ho...> wrote:
I have been debugging the following use case
Two DepositHelper constructed with the following rates and periods:
0.0382, 1 * Weeks
0.0372, 4 * Weeks
with following parameters:
DayCounter dayCounter = Actual360();
BusinessDayConvention bizDayConv = ModifiedFollowing;
int fixingDays = 2;
Date settlementDate(1, September, 2010);
double tolerance = 1.0e-15;
I am constructing a
PiecewiseYieldCurve<Discount, LogLinear>(settlementDate, helper, ActualActual(ActualActual::ISDA), tolerance)
I am actually constructing the shared pointer as follows:
boost::shared_ptr<PiecewiseYieldCurve<Discount, LogLinear>> depoSwapTermStructure(
new PiecewiseYieldCurve<Discount, LogLinear>(settlementDate, helper,
ActualActual(ActualActual::ISDA),
tolerance)
);
All executes well except when i try and do this:
vector<Date> curvedates = depoSwapTermStructure->dates();
The exception is:
terminate called after throwing an instance of 'QuantLib::Error'
what(): more than one instrument with pillar September 8th, 2010
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
This happens at line 111 (for loop) of iterativebootstrap.hpp
At line 102, dates array is defined as:
dates.resize(alive_+1); where alive_ = 2
firstDate is set to 40422 (1/Sep/2010) which becomes dates[0]
The pillar date is set to 40429 (8/Sep/2010) on the DepositHelpers which becomes dates[1]
which ends up satisfying this condition:
QL_REQUIRE(dates[i-1]!=dates[i],
"more than one instrument with pillar " << dates[i]);
Clearly I am missing an important step in the bootstrap before I extract the dates and rates out (I want to extract the forward rates to feed it back to an InterpolatedCurve to avoid repeating bootstrap)
Any pointers would be appreciated
Regards
-RS
On 13 Mar 2019, 11:57 +0000, Eric Ehlers , wrote:
All three files received - curve_hydration.zip, curve_hydration.tar, and curve_hydration.tar.gz. I will take a look this weekend and report back here.
Regards,
Eric
On 12/03/2019 20:32, R S wrote:
zip was blocked, tar was too large. Trying to send as tar.gz
Regards
-RS
On 11 Mar 2019, 15:10 +0000, Eric Ehlers <eri...@re...>, wrote:
Would you mind sending over the smallest standalone program that recreates the error?
Regards,
Eric
On 08/03/2019 21:16, R S wrote:
As advised here
http://quantlib.10058.n7.nabble.com/How-to-serialize-an-object-in-Quantlibxl-td763.html
I am attempting to save date and rates from my curve in order to reconstruct it (avoid bootstrap)
I am taking a pre-canned example with deposit and swap helpers
rates.push_back(0.0382); qlperiods.push_back(5 * Days);
rates.push_back(0.0372); qlperiods.push_back(1 * Months);
rates.push_back(0.037125); qlperiods.push_back(2 * Years);
(I have more but I have narrowed it to these to keep it simple)
First two go into building DepositRateHelper and the last one, SwapRateHelper
I then construct a PiecewiseYieldCurve<Discount, LogLinear>
When I try to print the dates and rates from. this. depoSwap curve
vector<Date> curvedates = depoSwapTermStructure->dates();
vector<Real> curverates = depoSwapTermStructure->data();
vector<Real>::iterator ri = curverates.begin();
for (vector<Date>::iterator it = curvedates.begin(); it != curvedates.end(); it++) {
cout << *it << " : " << *ri << endl;
ri++;
}
I keep getting this error
terminate called after throwing an instance of 'QuantLib::Error'
what(): more than one instrument with pillar March 19th, 2019
Settlement is set to
Date settlementDate(1, September, 2010);
The error stops if i comment out
rates.push_back(0.0382); qlperiods.push_back(5 * Days);
I am lost as to why
Regards
-RS
_______________________________________________
QuantLib-dev mailing list
Qua...@li...
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
_______________________________________________
QuantLib-dev mailing list
Qua...@li...
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
|